Configuring multiple static IP interfaces in Arch Linux (netcfg)

By , June 22, 2011 2:29 pm

Being a long-time Ubuntu/Debian user, I’m used to editing the good ol’ /etc/network/interfaces file to configure network interfaces.

Recently, trying Arch Linux, I discovered that networking isn’t always that simple.

Most basic system parameters in Arch are configured in the /etc/rc.conf file. However, that file is limited to configuring one static wired ethernet connection.

In order to configure multiple interfaces, you need to install the netcfg package and create profiles for each NIC in /etc/network.d :

There are some examples provided, however none of them mention how to set a custom netmask or multiple DNS servers. So here are my two network profiles:

interface 1 (/etc/network.d/interface1-static)

CONNECTION='ethernet'
DESCRIPTION='Static IP WAN'
INTERFACE='eth0'
IP='static'
ADDR='172.32.24.108'
GATEWAY='172.32.24.1'
DNS=('172.16.24.1' '172.16.24.3')

interface 2

CONNECTION='ethernet'
DESCRIPTION='Static IP LAN'
INTERFACE='eth1'
IP='static'
ADDR='192.168.2.80'
NETMASK='255.255.254.0'

Once the profiles are created, go back to the /etc/rc.conf and make them activated at boot. The values for the NETWORKS array are the two files previously created in /etc/network.d:

# Enable these netcfg profiles at boot-up. These are useful if you happen to
# need more advanced network features than the simple network service
# supports, such as multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This requires the netcfg package
#
NETWORKS=(interface1-static interface2-static)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
# If something other takes care of your hardware clock (ntpd, dual-boot...)
# you should disable 'hwclock' here.
#
DAEMONS=(hwclock syslog-ng net-profiles sshd netfs crond dbus @cups kdm)

2 Responses to “Configuring multiple static IP interfaces in Arch Linux (netcfg)”

  1. Bob Benoit says:

    Thanks for the succinct tutorial. Just what I needed.

    NOTE: The listed web site (http://uhnklbob.myvnc.com) is under development it will be up and down for the next month or so.

    Google Chrome 16.0.912.63 Google Chrome 16.0.912.63 GNU/Linux GNU/Linux
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
  2. MascH says:

    Thanks for that!

    Its a shame, Arch used to allow the definition of multiple Interfaces in rc.conf – now you have to use a daemon for this simple task (ok with wireless connections its not that simple, so here the solution is ok).

    I used the old style config up to now, but all those warnings about a deprecated feature filled up my boot-screen and made me change my mind.

    Firefox 9.0.1 Firefox 9.0.1 GNU/Linux x64 GNU/Linux x64
    Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

Leave a Reply

Custom theme by me. Based on Panorama by Themocracy

BOFH excuse #110: The rolling stones concert down the road caused a brown out

WordPress Appliance - Powered by TurnKey Linux