Netifrc

netifrc is Article description::Gentoo's default framework for configuring and managing network interfaces. It comes installed as part of the system profile and is available in the stage3 tarballs on all architectures.

netifrc is powerful and convenient, but new users be aware: Using it requires knowledge of the exact system needs. Because of its modular approach it may require additional packages to be installed for what many users would consider "basic functionality" for home users.

The netifrc package can be uninstalled or simply left unused in favor of using another network manager.

USE flags
The OpenRC package has the  USE flag, pulling in the package and enabling Gentoo's network stack ( scripts).

Emerge
The netifrc modules come in standard stage3 tarballs so they should be already installed on the system. In the case they have been removed, they can be re-installed via:

Services
Service scripts located in the directory:
 * : is the generic init script provided by the package. It contains the logic to control all interfaces managed by netifrc with the init system. It's meant to be the target for creating interface symlinks only. Do not edit.

systemd
The systemd service which calls a wrapper script. See the sections below for more information.

Configuration file

 * : The central configuration file. Contains all configuration informations for all network interfaces to be managed by netifrc (details on content can be found below) including physical interfaces, bridges, wireless etc. It is not created by default; it is created by the system administrator.

Determine interface names
The first step in configuring netifrc is to get a list of the network interfaces present on the system. This is possible a couple different ways.

First, the command will list all available interfaces when given the  action. If the -s option is passed to ip, before the action, activity statistics will also display to show connectivity:

Next, the command can be used to get a comprehensive list of available interfaces. It also be an used to detect if there is byte-activity on the interfaces which helps determine connectivity:

For more information on see the man page locally  or online.

Alternately, if is installed, a list of messages should be generated each time the system boots. Although the above method is better in practice, this approach can also be used to determine available network interfaces:

For more information on the use of see the man page locally  or online.

Maximum transmission unit size
To set a specific MTU size for an interface edit the file like below:

Creating symlinks
Provided in the package is a parent script called  which is installed to. This parent script should be symlinked to create additional scripts for each network interface to be configured. For example, to create a script for a network interface called, run the following command:

Replace  with  or whatever the interface is named.

in the example commands above is the appropriate name for this system's network interface. Depending on the system, a number of interface names may be used including:, , , , , etc. Continue creating links for as many interfaces as needed. A system can have more than one interface connected to more than one network if the hardware is available.

Configuration of the interfaces is handled in the file. A default (empty or missing) will automatically use DHCP to configure any network interface(s) started by  scripts.

Enable at boot
Running the is the final step in the configuration process. Add each interface to the system's init process. Normally interfaces are added to the default runlevel:

Repeat the above command for each interface. A status message should appear showing successful adds to the init process.

systemd
The unit is provided. To enable and start this unit:

Removing interfaces
If interfaces are no longer desired to be loaded during the init process they need to be removed from OpenRC or systemd. Run the following command for each interface that should be removed:

OpenRC:

systemd:

Priority of network interfaces
When 2 or more network interfaces are up, to set their priority, as example for preferred internet access on wlan0:

Link event detection
If an Ethernet cable plugged in after the bootup process occurred the network interfaces will not manually refresh themselves, even when using a DHCP client to manage the connections. A new address will not be assigned until the interface is manually refreshed by running the associated init script.

Two packages are available to aid in refreshing the network interface(s) during link events:



The package appears to be more maintained and is the recommended choice:

Once the install is complete network interfaces should be refreshed automatically whenever the system detects a link change event.

Documentation
Netifrc itself has no man page. The full configuration options are found on the netifrc documentation at Gentoo's GitWeb site or locally in. Search " ".

External resources

 * Forum post