我需要查看一下OpenSUSE Leap 42.2的DHCP租赁时间,我尝试了这些,但它们没有工作:
~> less /etc/dhclient.conf
~> sudo less /var/lib/dhcp/dhclient.leases
# ls -a /var/lib/NetworkManager/
~> sudo ifconfig -a我怎么能这么做?
我按照@MariusMatutiae的建议运行以下命令:
linux-box:/var/log # grep -nriIl dhc
YaST2/mkinitrd.log
YaST2/macro_inst_initial.ycp
YaST2/y2log
zypp/history
audit/audit.log
pk_backend_zypp-1
pk_backend_zypp
zypper.log
boot.log然后,我对每个输出文件执行以下操作,但找不到DHCP提供的租约时间。
linux-box:/var/log # grep -E "dhc" YaST2/y2log发布于 2017-07-04 12:27:29
租约时间存储在一个/var/log文件中,但是哪一个取决于发行版。以下命令
cd /var/log && grep -nriIl dhclient 查找所有提到dhclient的文件,在我的示例中(Debian),很明显该文件是syslog:
# grep -nirIl dhclient
installer/syslog
syslog
syslog.1
kern.log.1
audit/audit.log.4
audit/audit.log.2
audit/audit.log.1
audit/audit.log.3然后我得到:
# grep dhclient syslog
Jul 4 08:30:23 hague dhclient[1357]: DHCPREQUEST of 192.168.73.66 on eth0 to 192.168.73.1 port 67 (xid=0x7251b5d5)
Jul 4 08:30:23 hague dhclient[1357]: DHCPACK of 192.168.73.66 from 192.168.73.1
Jul 4 08:30:23 hague dhclient[1357]: bound to 192.168.73.66 -- renewal in 18682 seconds.
Jul 4 13:41:45 hague dhclient[1357]: DHCPREQUEST of 192.168.73.66 on eth0 to 192.168.73.1 port 67 (xid=0x7251b5d5)
Jul 4 13:41:45 hague dhclient[1357]: DHCPACK of 192.168.73.66 from 192.168.73.1
Jul 4 13:41:45 hague dhclient[1357]: bound to 192.168.73.66 -- renewal in 14622 seconds.给出了你正在寻找的答案。
发布于 2020-02-04 13:17:25
尝试:
less /var/lib/dhcp/db/dhcpd.leaseshttps://unix.stackexchange.com/questions/375192
复制相似问题