Difference between revisions of "Network configuration"

From ArchWiki
Jump to navigation Jump to search
(→‎Some more settings: link to wireless stuff)
Line 3: Line 3:
{{i18n_entry|English|Static IP and DHCP}}
{{i18n_entry|English|Static IP and DHCP}}
{{i18n_entry|Slovak|Statická IP a DHCP}}
{{i18n_entry|Slovensky|Statická IP a DHCP}}
{{i18n_entry|Русский|Статический IP и DHCP}}
{{i18n_entry|Русский|Статический IP и DHCP}}

Revision as of 11:13, 25 March 2006

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end


A simple guide to get your network running. (tried and tested with prolink 9000/c adsl ethernet modem with a prolink PFE100TX ethernet card and a SingNet connection in Singapore)

Load the device module

First you need to know which module is needed for your network card (NIC). If you use hwdetect or lshwd, they should do it for you and load it automatically at startup. If not, ask google or try some other distro (liveCD) to find out the name of the needed module. lsmod will show you all loaded modules.

Now when you know which module to use you can load it:

# modprobe <modulename>

If you don't want / can't use some auto-loader like hwdetect you can add it into the modules array in /etc/rc.conf, so you don't need to modprobe it everytime you boot. For example, tg3 is the network module:

MODULES=(!usbserial tg3 snd-cmipci)

Other common modules are 8139too for cards with realtek chipset or sis900 for SiS cards.

Configure IP


Edit /etc/rc.conf like this:

  INTERFACES=(lo eth0)

For Static IP

If you share your internet connection from a Windows box without a router, be sure to use static IPs on both computers. Otherwise you will have LAN issues.

You need:

  • Your static IP address,
  • The netmask,
  • The broadcast address,
  • Your gateway,
  • Your nameservers' IP addresses,
  • Your domain name.

If you are running a private network, it is safe to use IP addresses in 192.168.*.'* for your IPs, with a netmask of and broadcast address of Unless your network has a router, the gateway address does not matter. Edit /etc/rc.conf like this, substituting your own values for the IP, netmask, broadcast, and gateway:

   eth0="eth0 netmask broadcast"
   INTERFACES=(lo eth0)
   gateway="default gw"

and your /etc/resolv.conf like this, substituting your nameservers' IPs and your domain name:

  nameserver 61.95.849.8
  search example.com

You may include as many nameserver lines as you wish.

If you use DHCP and you don't want your DNS servers to change every time you start your network, be sure to add the -R option to DHCPCD_ARGS in /etc/conf.d/dhcpcd (used by in /etc/rc.d/network). This prevents DHCP from rewritting your /etc/resolv.conf every time:


Final Solution

You might need to add the "-S" option to your dhcpcd arguments in order to get your network to work" DHCPCD_ARGS="-S -t 30 -h $HOSTNAME"

Set computer name

Edit /etc/rc.conf and set HOSTNAME to your desired computer name :



Set host name/ip

Edit /etc/hosts and add a similar line with the same HOSTNAME you entered at /etc/rc.conf :               banana.localdomain             banana

Some more settings

Wireless Setup

The wireless (wlan) configuration is topic of another wiki page.


You can install and configure a firewall to feel more secure ;-)


You can install a daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected. Other use is when you just need to restart network but don't want to restart computer or do it from shell.

Installation is very simple since it's in [extra]:

# pacman -S ifplugd

By default it is configured to work for eth0 device. This and other settings like delays can be configured in /etc/ifplugd/ifplugd.conf.

Start it with

# /etc/rc.d/ifplugd start

or add it into DAEMONS array in /etc/rc.conf