FreeBSD: network interface address: dhcp or static
现在跟进问题:
我决定查看租赁文件:/var/db/dhclient.leases..它到底告诉了我什么?/var/db/dhclient.leases.em0 的存在意味着 em0 有 DHCP 地址吗?该文件似乎不会随着重新启动而消失。
最佳答案
您应该阅读 dhclient
的手册页。这将回答您的大部分问题。如果失败,您可以浏览 /usr/src/sbin/dhclient
中的源代码。
另一种可能是使用devd(8)
。这是一个守护进程,可以在发生特定事件时执行脚本或程序。它可以例如请注意网络接口(interface)何时“启动”或“关闭”。从默认的 /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";
};
关于c - FreeBSD:了解/var/db/dhclient.leases.<interface_name> dhcp 租用文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9522567/