现在跟进问题:
我决定查看租约文件:/var/db/dhclient.leases.. 它到底告诉了我什么?/var/db/dhclient.leases.em0 的存在表示 em0 有 DHCP 的地址?该文件似乎不会随着重新启动而消失。
现在跟进问题:
我决定查看租约文件:/var/db/dhclient.leases.. 它到底告诉了我什么?/var/db/dhclient.leases.em0 的存在表示 em0 有 DHCP 的地址?该文件似乎不会随着重新启动而消失。
您应该阅读dhclient
. 这将回答您的大部分问题。如果失败,您可以在/usr/src/sbin/dhclient
.
另一种可能性可能是使用devd(8)
. 如果某个事件发生,这是一个可以执行脚本或程序的守护进程。例如,它可以记录网络接口何时“启动”或“关闭”。从默认值/etc/devd.conf
(另见devd.conf(5)
):
# Try to start dhclient on Ethernet-like interfaces when the link comes
# up. Only devices that are configured to support DHCP will actually
# run it. No link down rule exists because dhclient automatically exits
# when the link goes down.
#
notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/etc/rc.d/dhclient quietstart $subsystem";
};
客户端应该在重新启动后记住 DHCP 租约,并且应该在请求地址时记住特定网络上过去的租约。因此,该文件不应在引导后消失。