DHCP

Gentoo HOWTO & Notes

23/09/2010


DHCP Client

I use the dhcpcd package, because I am familiar with it and because it is actively supported by the Gentoo folks. I only use DHCP to connect to my ADSL router, so the configuration examples reflects this situation. As always, YMWDV.

Installation

The current (4.0.15) package has two use flags:

compat
zeroconf

Both these flags default to on, so unless you know what you are doing make sure they are, then ...

gentoo ~ # emerge net-misc/dhcpcd

Configuration

Most on the configuration is done in /etc/conf.d/net:

gentoo ~ # nano -w /etc/conf.d/net

… config_eth1=( "dhcp" ) dhcpcd_eth1="-t 10" dhcp_eth1="release nodns nontp nonis"

Now we want dhcpcd to log to its own file, instead of cluttering /var/log/messages:

gentoo ~ # nano -w /etc/syslog-ng/syslog-ng.conf

… destination dhcpcd { file("/var/log/dhcpcd.log"); }; filter f_dhcpcd { program("dhcpcd"); }; log { source(src); filter(f_dhcpcd); destination(dhcpcd); flags(final); }; …

After making sure that the appropriate /etc/init.d/net.ethX file exists, fire it up:

gentoo ~ # /etc/init.d/net.eth1 start

And remember to add the interface to the correct runlevel:

gentoo ~ # rc-update add net.eth1 default

Discussion

There is really not much to discuss regarding the DHCP client, as it is a very simple program that works flawlessly most of the time. If you have problems, then go check the DHCP server.