Network management using DHCPCD

This article is based on a posting in Gentoo Forums.

Setup
Have dhcpcd installed, then add it to the default runlevel and start the service:

This setup is deviating from Gentoo Handbook and provides automatical switching between wired and wireless network interfaces.

Wireless
Dhcpcd has a hook for wpa_supplicant, so it is best choice to install wpa_supplicant for wireless. However, since dhcpcd-6.10.0, this hook is no longer installed in by default:  After installation of wpa_supplicant copy that hook and restart dhcpcd:

For any questions or problems with wpa_supplicant see its wiki article and upstream.

Testing
Stop dhcpcd and wpa_supplicant, then start dhcpcd with debugging in foreground and you should see dhcpcd starting the connection.

Static IP address
In case the network interface card should be configured with a static IP address, type it into the graphical user interface. Without the graphical user interface, entries can also be manually added to as described in Dhcpcd.

Migration from Gentoo net.* scripts
In case of migration from Gentoo net.* scripts it's essential to remove wpa_supplicant and the net.* scripts from the runlevels.

Any lines starting with "net." must not have a runlevel assigned. In this example, it's net.wlp8s0 to be removed.

Once the network setup works well you might want to completely remove the old Gentoo net.* scripts setup. So disable the netifrc useflag, re-emerge OpenRC without and unmerge netifrc:

Also the old config files and symlinks can be removed

Network dependent services
Start/Stop of Network_dependent_services by dhcpcd is no longer supported since openrc-0.16.4.

Graphical User interface
A graphical user interface is provided by net-misc/dhcpcd-ui.