Network management using DHCPCD

Abstract
With dhcpcd it is possible to have a working network stack without resorting to Gentoo net.* scripts at all on simple configuration.


 * Only hardware interfaces are needed, i.e. no virtual interfaces;
 * IP addresses delivered through DHCP (eventually APIPA)

In such conditions all hardware interfaces can be configured, even the loopback interface, lo.

Basic configuration
Install dhcpcd

Remove all network scripts from all runlevels

Add dhcpcd to the default runlevel:

Wireless
When you need wireless support also install wpa_supplicant and add the ctrl_interface on top of its configuration. To make it work you need wext compatibility enabled in your kernel.

There is no need for having wpa_supplicant in the runlevel as dhcpcd will detect the interface, whatever it is called and set its IP address automatically. Also note a nice thing Linux does when having wired and wireless interfaces together on the same network is that the one with the lowest metric takes precedence over existing connections.

Suppose for instance you have an ongoing transfer of a very large file over your wireless interface to an existing network mountpoint. Plug the cable and wait for dhcpcd to set the IP address of the ethernet interface and you'll see the network activity switch to the fastest interface. You don't even need to interrupt and restart the transfer. That feature comes handy when you cannot bond interfaces, especially with wireless.

Cleanup
When the net setup is working well you might want to remove the old netifrc setup. So disable the netifrc useflag and reemerge openrc.

Now you can remove netifrc.

Also the old config files and symlinks can be removed

Network dependant services
Starting/stopping network dependant services is still in development. Services having "need net" in their init.d scripts like fetchmail will start after dhcpcd is started.

They will be stopped when dhcpcd turns inactive and will be restarted when dhcpcd is back.

In case there is only "use net" in the init.d script the "need" can be put in the conf.d file.