Gentoo Wiki




This article is mainly for users that use portable computers and need to adjust their network configuration very often, depending on the network they want to connect.

Required software

In order to achieve this you need to emerge the following:

Emerge them:

emerge iputils arping


Edit /etc/conf.d/net using your favorite editor. Consider the following scenario. You want to create three network profiles, one for your home network, one for your work network and one that will handle networks with DHCP:

This is what your configuration should look like:

# Enable arping mode
config_eth0=( "arping" )
# Define the gateways you want to configure
# You can consider each gateway as a profile
# Define the IP and netmask when using gateway
config_010000000138=( "" )
# Define the default route for gateway
routes_010000000138=( "default via" )
# Define the DNS servers to use with gateway
dns_servers_010000000138=( "" )
# Define the IP and netmask when using gateway
config_192168010001=( "" )
# Define the default route for gateway
routes_192168010001=( "default via" )
# Define the DNS servers to use with gateway
dns_servers_192168010001=( "" )
# If any of the above profiles fail use DHCP
fallback_eth0=( "dhcp" )


dns_servers_eth0=( "" )
dhcpcd_eth0="-t 5"
dhcp_eth0="nodns nontp nonis"

Same Gateway on Different Networks

In case different networks use the same gateway, you can include a specific MAC address for each gateway. For example, I use a laptop to connect to different networks, and it might be the case that another network has the same gateway that my home network. In that case, I use the MAC address of my home router (00:14:BF:F6:F0:FB) to give my laptop a particular IP address ( in my home network.

config_192168001001_0014BFF6F0FB=( "" )
routes_192168001001_0014BFF6F0FB=( "default via" )
dns_servers_192168001001_0014BFF6F0FB=( "" )


Retrieved from ""

Last modified: Wed, 20 Aug 2008 06:28:00 +0000 Hits: 8,436