- /etc/dhclient.conf
dhclient requires a configuration file, /etc/dhclient.conf. Typically the file contains only comments, the defaults being reasonably sane. This configuration file is described by the dhclient.conf(5) manual page. - /sbin/dhclient
dhclient is statically linked and resides in /sbin. The dhclient(8) manual page gives more information about dhclient. - /sbin/dhclient-script
dhclient-script is the FreeBSD-specific DHCP client configuration script. It is described in dhclient-script(8), but should not need any user modification to function properly. - /var/db/dhclient.leases
The DHCP client keeps a database of valid leases in this file, which is written as a log. dhclient.leases(5) gives a slightly longer description.
# man dhclient
# man dhclient-script
# man dhclient.conf
# man dhclient.leases
# cat /var/db/dhclient.leases.fxp0
# less /sbin/dhclient-script
To connect to a DHCP server in the background while other startup continues (asynchronous mode), use the "DHCP" value in /etc/rc.conf:
# vim /etc/rc.conf
ifconfig_fxp0="DHCP"
To pause startup while DHCP completes, use synchronous mode with the "SYNCDHCP" value:
# vim /etc/rc.conf
ifconfig_fxp0="SYNCDHCP"
Note: preferred method.
Create a dhclient hook script:
# vim /etc/dhclient-enter-hooks
### these two functions below will prevent dhclient from deleting and adding routes.
### Have a look at /sbin/dhclient-script. You can redefine all the functions in dhclient-enter-hooks.
add_new_routes() {
return 0
}
delete_old_routes () {
return 0
}
### this will prevent /etc/resolv.conf being overwritten as it 'overloads' the function of dhclient.
add_new_resolv_conf() {
# We don't want /etc/resolv.conf changed
# So this is an empty function
return 0
}
Request dhcp lease renew:
# dhclient interface
Reference:
http://www.freebsd.org/doc/handbook/network-dhcp.html
http://forums.freebsd.org/showthread.php?t=15283
http://forums.freebsd.org/showthread.php?p=36089
http://forums.freebsd.org/showthread.php?t=6984
No comments:
Post a Comment