Template:Article summary start Template:Article summary text Template:Article summary heading Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:Article summary end
- 1 Set the hostname
- 2 Load the device module
- 3 Configure IP
- 4 Load configuration
- 5 Additional settings
- 6 Troubleshooting
- 6.1 DHCP fails at boot
- 6.2 Swapping computers on the cable modem
- 6.3 The TCP window scaling issue
- 6.4 Realtek no link / WOL issue
- 6.5 DLink G604T/DLink G502T DNS issue
- 6.6 Get an ip from the wrong DHCP in linked (by vpn) router cases
Set the hostname
A hostname is a unique name created to identify a machine on a network. With Arch Linux, a machine's hostname is set in Template:Filename or until a restart using the hostname command. Hostnames are restricted to alphanumeric characters. The dash (Template:Codeline) can be used but a hostname cannot start or end with it. Length is restricted to 63 characters.
Edit Template:Filename and set HOSTNAME (archlinux in this example):
After setting a hostname, it is also a good idea to include the same name in Template:Filename. This will help processes that refer to the computer by its hostname to find its IP.
127.0.0.1 archlinux.domain.org localhost.localdomain localhost archlinux
To set the hostname temporarily (until the next reboot) use the hostname command as root:
# hostname archlinux
Load the device module
Udev should detect your network card (NIC) module and load it automatically at startup. Otherwise, you will need to know which module is needed for your particular model:
when you know which module to use, you can load it with:
# modprobe <modulename>
If udev is not detecting and loading the proper module automatically, you can add it into the MODULES= array in
/etc/rc.conf, so you do not need to modprobe it everytime you boot. For example, if tg3 is the network module:
MODULES=(!usbserial tg3 snd-cmipci)
Other common modules are 8139too for cards with the Realtek chipset or sis900 for SiS cards.
For DHCP IP
For this, you need the dhcpcd package (already available on most installations). Edit
/etc/rc.conf like this:
eth0="dhcp" INTERFACES=(eth0) ROUTES=(!gateway)
If you use DHCP and you do not want your DNS servers automatically assigned every time you start your network, be sure to add the following to the last section of /etc/dhcpcd.conf:
Then add your own DNS nameserver to /etc/resolv.conf.
Make sure to test your new settings by stopping and starting the
/etc/rc.d/network daemon as opposed to bringing down your interface and starting dhcp manually. To restart the network daemon:
# /etc/rc.d/network restart
You may use openresolv package from AUR if several things wants to control resolv.conf (i.e. dhcpcd and VPN client). No additional configuration for dhcpcd is needed to use openresolv.
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.
- 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 255.255.255.0 and broadcast address of 192.168.*.255. 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 192.168.100.2 netmask 255.255.255.0 broadcast 192.168.100.255" INTERFACES=(eth0) gateway="default gw 192.168.100.1" ROUTES=(gateway)
To add additional static routes, use the normal syntax for the 'route add' command such as:
static-route1="-net 192.168.200.0/24 gw 192.168.100.15"
static-route1 to your ROUTES array. Note that a route name can not begin with a number,
static-route1 is ok,
1static-route is not.
/etc/resolv.conf like this, substituting your nameservers' IPs and your domain name:
nameserver 18.104.22.168 nameserver 61.95.849.8 search example.com
You may include as many nameserver lines as you wish.
To test your settings either reboot the computer, or as root, run
Try pinging your gateway, DNS server, ISP provider and other Internet sites, in that order, to detect any connection problems along the way.
$ ping google.com
You can install and configure a firewall to feel more secure.
See the Wireless Setup article for more information.
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. Another use is when you just need to restart the network but do not want to restart the computer or do it from the shell.
Installation is very simple since it is 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
Start it with:
# /etc/rc.d/ifplugd start
or add it into DAEMONS array in
See the Jumbo Frames article for more information.
You can install 'ifenslave' to bind two real Ethernet cables with one IP address. /etc/conf.d/bonding:
bond_bond0="eth0 eth1" BOND_INTERFACES=(bond0)
options bonding miimon=100
MODULES=(... bonding ...) bond0="bond0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" INTERFACES=(bond0)
Restart network by:
One IP on one card:
# nano /etc/rc.conf
eth0="eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(lo eth0)
Two IPs on one card: (BUG:/etc/rc.d/network stop)
# nano /etc/rc.conf
eth0="eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" eth0_0="eth0:0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(lo eth0 eth0_0)
One IP on two cards:
# pacman -S ifenslave # nano /etc/rc.conf
bond0="bond0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(lo bond0) MODULES=(... bonding ...)
Two IPs on two cards: (BUG:/etc/rc.d/network stop)
# pacman -S ifenslave # nano /etc/rc.conf
bond0="bond0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" bond01="bond0:1 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(lo bond0 bond01) MODULES=(... bonding ...)
Change MAC/hardware address
Useful in some situations, for example when your ISP binds the access to one of your computers to identify you, but you need to use the connection on more than one computer without running ifconfig every time. Add the usual ifconfig option to your card configuration.
For a ethernet card:
eth0="eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255 hw ether 01:23:45:67:89:ab"
DHCP fails at boot
First, check all the steps that the computer normally executes at boot in order to find out which one failed. These steps are: 1. detect the network device and load its driver, 2. bring up the interface and 3. call dhcp
For step 1 check the "Ethernet controller" entry in the output of
It should tell you which kernel module contains the driver of you network device. For example:
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0) ... Kernel driver in use: atl1 Kernel modules: atl1
Next, check the the driver was loaded via
dmesg | grep <module name> . For example:
$ dmesg |grep atl1 ... atl1 0000:02:00.0: eth0 link is up 100 Mbps full duplex
For step 2, check the output of dmesg for the interface associated with your network device and bring it up via (as root)
ifconfig <interface> up. Check the result with
ifconfig -a. For example:
$ ifconfig -a eth0 Link encap:Ethernet ... inet6 addr: f.../64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ...
What you probably will not see here is an inet address. You need to get that from your router in step 3:
To be on the safe side, start by releasing the lease of your interface with
dhcpcd --release, then try to get a lease with
dhcpcd. As always, the man page is your friend. If all goes well it will look like this:
$ dhcpcd --release eth0 dhcpcd: dhcpcd not running $ dhcpcd eth0 dhcpcd: version 5.1.1 starting dhcpcd: eth0: broadcasting for a lease ... dhcpcd: eth0: leased 192.168.1.70 for 86400 seconds
ifconfig <interface> should show your inet address.
Probably things will not work as described somewhere along these steps, or else the network would have started automatically at boot.
If dhcp works using the steps above but not at boot, add the following to
dhcpcd -k eth0 dhcpcd -nd eth0
See http://bbs.archlinux.org/viewtopic.php?id=63940 for more information.
For some people, dhclient (available in [extra]) works where dhcpcd fails.
Swapping computers on the cable modem
Most domestic cable ISPs (videotron for example) have the cable modem configured to recognise only one client PC, by the MAC address of its network interface. Once the cable modem has learnt the MAC address of the first PC or equipment that talks to it, it will not respond to another MAC address in any way. Thus if you swap one PC for another (or for a router), the new PC (or router) will not work with the cable modem, because the new PC (or router) has a different MAC address to the old one. To reset the cable modem so that it will recognise the new PC, you must power the cable modem off and on again. Once the cable modem has rebooted and gone fully online again (indicator lights settled down), reboot the newly connected PC so that it makes a DHCP request, or manually make it request a new DHCP lease.
If this method does not work, you will need to clone the MAC address of the original machine.
The TCP window scaling issue
TCP packets contain a "window" value in their headers indicating how much data the other host may send in return. This value is represented with only 16 bits, hence the window size is at most 64Kb. TCP packets are cached for a while (they have to be reordered), and as memory is (or used to be) limited, one host could easily run out of it.
Back in 1992, as more and more memory became available, RFC 1323 was written to improve the situation: Window Scaling. The "window" value, provided in all packets, will be modified by a Scale Factor defined once, at the very beginning of the connection.
That 8-bit Scale Factor allows the Window to be up to 32 times higher than the initial 64Kb.
It appears that some broken routers and firewalls on the Internet are rewriting the Scale Factor to 0 which causes misunderstandings between hosts.
The Linux kernel 2.6.17 introduced a new calculation scheme generating higher Scale Factors, virtually making the aftermaths of the broken routers and firewalls more visible.
The resulting connection is at best very slow or broken.
How to diagnose the problem?
First of all, lets make it clear: this problem is odd. In some cases, you will not be able to use TCP connections (HTTP, FTP, ...) at all and in others, you will be able to communicate with some hosts (very few).
dmesg's output is OK, logs are clean and
ifconfig will report normal status — and actually everything is normal.
If you can not browse any website, but you can ping some rare hosts, chances are great that you're experiencing this issue: ping uses the ICMP protocol and is not affected by TCP issues.
You can try to use WireShark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).
How to fix it? (The bad way)
To fix it the bad way, you can change the tcp_rmem value, on which Scale Factor calculation is based. Although it should work for most hosts, it is not guaranteed, especially for very distant ones.
echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem
Or you can try to remove one of your RAM sticks (yes, sir).
How to fix it? (The good way)
Simply disable Window Scaling. Even if Window Scaling is a nice TCP feature, it may be uncomfortable especially if you can not fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof (which will work with most kernels) is to add the following lines to your
echo 0 > /proc/sys/net/ipv4/tcp_window_scaling
How to fix it? (The best way)
This issue is caused by broken routers/firewalls, so lets change them. Some users have reported that the broken router was their very own DSL router.
More about it?
And more recently, some Archers have been hit by this issue:
There are also several relevant threads on the LKML.
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice an issue where the NIC seems to be disabled on boot and has no Link light. This can usually be found on a dual boot system where Windows is also installed. It seems that using the offical Realtek drivers (dated anything after May 2007) under Windows is the cause. These newer drivers disable the Wake-On-LAN feature by disabling the NIC at Windows shutdown time, where it will remain disabled until the next time Windows boots. You will be able to notice if this issue is affecting you if the Link light remains off until Windows boots up; during Windows shutdown the Link light will switch off. Normal operation should be that the link light is always on as long as the system is on, even during POST. This issue will also affect other operative systems without newer drivers (eg. Live CDs). Here are a few fixes for this issue:
Method 1 - Rollback/change Windows driver
You can roll back your Windows NIC driver to the Microsoft provided one (if available), or roll back/install an official Realtek driver pre-dating May 2007 (may be on the CD that came with your hardware).
Method 2 - Enable WOL in Windows driver
Probably the best and the fastest fix is to change this setting in the Windows driver. This way it should be fixed system-wide and not only under Arch (eg. live CDs, other operative systems). In Windows, under Device Manager, find your Realtek network adapter and double-click it. Under the Advanced tab, change "Wake-on-LAN after shutdown" to Enable.
In Windows XP (example) Right click my computer --> Hardware tab --> Device Manager --> Network Adapters --> "double click" Realtek ... --> Advanced tab --> Wake-On-Lan After Shutdown --> Enable
- Note: newer Realtek Windows drivers (tested with Realtek 8111/8169 LAN Driver v5.708.1030.2008, dated 2009/01/22, available from GIGABYTE) may refer to this option slightly differently, like Shutdown Wake-On-LAN --> Enable. It seems that switching it to Disable has no effect (you will notice the Link light still turns off upon Windows shutdown). One rather dirty workaround is to boot to Windows and just reset the system (perform an ungraceful restart/shutdown) thus not giving the Windows driver a chance to disable LAN. The Link light will remain on and the LAN adapter will remain accessible after POST - that is until you boot back to Windows and shut it down properly again.
Method 3 - Newer Realtek Linux driver
Any newer driver for these Realtek cards can be found for Linux on the realtek site. (untested but believed to also solve the problem).
Method 4 - Enable LAN Boot ROM in BIOS/CMOS
It appears that setting Integrated Peripherals --> Onboard LAN Boot ROM --> Enabled in BIOS/CMOS reactivates the Realtek LAN chip on system boot-up, despite the Windows driver disabling it on OS shutdown.
This was tested successfully multiple times with GIGABYTE system board GA-G31M-ES2L with BIOS version F8 released on 2009/02/05. YMMV.
DLink G604T/DLink G502T DNS issue
Users with a DLink G604T/DLink G502T router, using DHCP and have firmware v2.00+ (typically users with AUS firmware) may have issues with certain programs not resolving the DNS. One of these programs are unfortunatley pacman. The problem is basically the router in certain situations is not sending the DNS properly to DHCP, which causes programs to try and connect to servers with an IP of 22.214.171.124 and fail with a connection timed out error
How to diagnose the problem?
The best way to diagnose the problem is to use a firefox/konqueror/links/seamonkey and to enable wget for pacman. If this is a fresh install of Arch Linux, then you may want to consider installing links through the live CD.
Firstly enable wget for pacman (since it gives us info about pacman when its downloading packages) Open /etc/pacman.conf with your favourite editor and uncomment the following line (remove the # if its there)
XferCommand=/usr/bin/wget --passive-ftp -c -O %o %u
While your in pacman.conf, check the default mirror that pacman uses to download packages.
Now open up the default mirror in an internet browser to see if the mirror actually works. If it does work then do pacman -Syy (otherwise pick another working mirror and set it to the pacman default), if you get something similar to the following (notice the 126.96.36.199)
ftp://mirror.pacific.net.au/linux/archlinux/extra/os/i686/extra.db.tar.gz => `/var/lib/pacman/community.db.tar.gz.part' Resolving mirror.pacific.net.au... 188.8.131.52
then you most likely have this problem. The 184.108.40.206 means its unable to resolve the DNS, so we must add it to resolv.conf.
How to fix It?
Basically what we need to do is to manually add the DNS to our /etc/resolv.conf file, The problem is that DHCP automatically deletes and replaces this file on boot, so we need to edit /etc/conf.d/dhcpcd and change the flags to stop DHCP doing this
When you open up /etc/conf.d/dhcpcd, you should see something close to the following
DHCPCD_ARGS="-t 30 -h $HOSTNAME"
add the -R flag to the arguments, i.e.
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"
NOTE: If you are using dhcpcd >=4.0.2 the -R flag has been deprecated, please look here on () section how to use a custom resolv.conf file
Save and close, now open /etc/resolv.conf. You should see a single namespace (most likely 10.1.1.1), this is the gateway to your router, which we need to connect to in order to get the DNS of your ISP. Paste the IP into your browser and login to your router. Go to the DNS section and you should see an IP in the Preferred DNS Server, copy it and paste it as a namespace ABOVE the current gateway one.
i.e. a resolv.conf should look something along the lines of
If my Primary DNS Server is 220.127.116.11 then chance resolv.conf to
namespace 18.104.22.168 namespace 10.1.1.1
Now restart the network daemon by doing /etc/rc.d/network restart and do pacman -Syy, if it syncs fine with the server then problem solved
More about it?
This is the whirlpool forum (Australian ISP community) which talks about and gives the same solution to the problem
In my case i have a network where two routers are tied together through vpn. One router at my home and one at a completely different place in the world, In some rare cases it might be possible that the router that is connected to me by vpn is giving me an ip address. I don't know a way to prevent that but i do know a way to fix that. On a console as root try this:
dhcpcd -k dhcpcd
The first line releases your ip and the next line requests a new one. I had to run those 2 comments 3 times till my issue was fixed so don't expect it to work after just one try. If that also fails you might need to disconnect the vpn connection and try it again with the above commands.
This even works when NetworkManager is installed.