Difference between revisions of "Network configuration"

From ArchWiki
Jump to: navigation, search
(systemd-networkd: covered in systemd-networkd)
(Undo revision 322085 by Al.janitor (talk) - ip-link(8) puts up/down at the end, let's follow it)
(46 intermediate revisions by 16 users not shown)
Line 10: Line 10:
 
[[pt:Configuring Network]]
 
[[pt:Configuring Network]]
 
[[ro:Configurare retea]]
 
[[ro:Configurare retea]]
[[ru:Configuring Network]]
+
[[ru:Network configuration]]
 
[[sk:Configuring Network]]
 
[[sk:Configuring Network]]
 
[[tr:Ağ_Yapılandırması]]
 
[[tr:Ağ_Yapılandırması]]
Line 19: Line 19:
 
{{Related|Firewalls}}
 
{{Related|Firewalls}}
 
{{Related|Wireless network configuration}}
 
{{Related|Wireless network configuration}}
{{Related|List of Applications#Network Managers}}
+
{{Related|List of applications/Internet#Network managers}}
 
{{Related articles end}}
 
{{Related articles end}}
  
Line 26: Line 26:
 
== Check the connection ==
 
== Check the connection ==
  
{{Note|If you receive an error like {{ic|ping: icmp open socket: Operation not permitted}} when executing ping, try to re-install the {{ic|iputils}} package.}}   
+
{{Note|If you receive an error like {{ic|ping: icmp open socket: Operation not permitted}} when executing ''ping'', try to re-install the {{Pkg|iputils}} package.}}   
  
 
Many times, the basic installation procedure has created a working network configuration. To check if this is so, use the following command:
 
Many times, the basic installation procedure has created a working network configuration. To check if this is so, use the following command:
Line 45: Line 45:
 
If it works, then you may only wish to personalize your settings from the options below.
 
If it works, then you may only wish to personalize your settings from the options below.
  
If the previous command complains about unknown hosts, it means that your machine was unable to resolve this domain name. It might be related to your service provider or your router/gateway. You can try pinging a static IP address to prove that your machine has access to the Internet.
+
If the previous command complains about unknown hosts, it means that your machine was unable to resolve this domain name. It might be related to your service provider or your router/gateway. You can try pinging a static IP address to prove that your machine has access to the Internet:
  
 
{{hc|$ ping -c 3 8.8.8.8|<nowiki>
 
{{hc|$ ping -c 3 8.8.8.8|<nowiki>
Line 86: Line 86:
 
== Device Driver ==
 
== Device Driver ==
  
=== Check the driver status ===
+
=== Check the status ===
  
[[udev]] should detect your network interface card ([[Wikipedia:Network_interface_controller|NIC]]) and automatically load the necessary module at start up. Check the "Ethernet controller" entry (or similar) from the {{ic|lspci -v}} output. It should tell you which kernel module contains the driver for your network device. For example:
+
[[udev]] should detect your network interface card (see [[Wikipedia:Network_interface_controller]]) and automatically load the necessary module at start up. Check the "Ethernet controller" entry (or similar) from the {{ic|lspci -v}} output. It should tell you which kernel module contains the driver for your network device. For example:
  
 
{{hc|$ lspci -v|
 
{{hc|$ lspci -v|
Line 105: Line 105:
 
Skip the next section if the driver was loaded successfully. Otherwise, you will need to know which module is needed for your particular model.
 
Skip the next section if the driver was loaded successfully. Otherwise, you will need to know which module is needed for your particular model.
  
=== Load the device module ===
+
=== Load the module ===
  
Google for the right module/driver for the chipset. Some common modules are {{ic|8139too}} for cards with a Realtek chipset, or {{ic|sis900}} for cards with a SiS chipset. Once you know which module to use, try to [[Kernel modules#Manual module handling|load it manually]]. If you get an error saying that the module was not found, it's possible that the driver is not included in Arch kernel. You may search the [[AUR]] for the module name.
+
Search in the Internet for the right module/driver for the chipset. Some common modules are {{ic|8139too}} for cards with a Realtek chipset, or {{ic|sis900}} for cards with a SiS chipset. Once you know which module to use, try to [[Kernel modules#Manual module handling|load it manually]]. If you get an error saying that the module was not found, it's possible that the driver is not included in Arch kernel. You may search the [[AUR]] for the module name.
  
 
If udev is not detecting and loading the proper module automatically during bootup, see [[Kernel modules#Loading]].
 
If udev is not detecting and loading the proper module automatically during bootup, see [[Kernel modules#Loading]].
Line 115: Line 115:
 
=== Device names ===
 
=== Device names ===
  
For computers with multiple NICs, it is important to have fixed device name. Many configuration problems are caused by interface name changing.
+
For computers with multiple NICs, it is important to have fixed device names. Many configuration problems are caused by interface name changing.
  
 
[[udev]] is responsible for which device gets which name. Systemd v197 introduced [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames Predictable Network Interface Names], which automatically assigns static names to network devices. Interfaces are now prefixed with {{ic|en}} (ethernet), {{ic|wl}} (WLAN), or {{ic|ww}} (WWAN) followed by an automatically generated identifier, creating an entry such as {{ic|enp0s25}}.  
 
[[udev]] is responsible for which device gets which name. Systemd v197 introduced [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames Predictable Network Interface Names], which automatically assigns static names to network devices. Interfaces are now prefixed with {{ic|en}} (ethernet), {{ic|wl}} (WLAN), or {{ic|ww}} (WWAN) followed by an automatically generated identifier, creating an entry such as {{ic|enp0s25}}.  
Line 124: Line 124:
  
 
{{Note|When changing the interface naming scheme, do not forget to update all network-related configuration files and custom systemd unit files to reflect the change. Specifically, if you have [[netctl#Basic method|netctl static profiles]] enabled, run {{ic|netctl reenable ''profile''}} to update the generated service file.}}
 
{{Note|When changing the interface naming scheme, do not forget to update all network-related configuration files and custom systemd unit files to reflect the change. Specifically, if you have [[netctl#Basic method|netctl static profiles]] enabled, run {{ic|netctl reenable ''profile''}} to update the generated service file.}}
 +
 +
==== Get current device names ====
 +
 +
Current NIC names can be found via {{ic|sysfs}}:
 +
 +
{{hc|$ ls /sys/class/net|
 +
lo eth0 eth1 firewire0
 +
}}
  
 
==== Change device name ====
 
==== Change device name ====
Line 134: Line 142:
 
</nowiki>}}
 
</nowiki>}}
  
A couple things to note:
+
A couple of things to note:
  
 
* To get the MAC address of each card, use this command: {{ic|cat /sys/class/net/''device_name''/address}}
 
* To get the MAC address of each card, use this command: {{ic|cat /sys/class/net/''device_name''/address}}
 
* Make sure to use the lower-case hex values in your udev rules. It doesn't like upper-case.
 
* Make sure to use the lower-case hex values in your udev rules. It doesn't like upper-case.
  
If the network card has a dynamic MAC, you can use DEVPATH, for example:
+
If the network card has a dynamic MAC, you can use {{ic|DEVPATH}}, for example:
  
 
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki>
 
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki>
Line 147: Line 155:
 
{{Note|When choosing the static names '''it should be avoided to use names in the format of "eth''X''" and "wlan''X''"''', because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g.: {{ic|net0}}, {{ic|net1}}, {{ic|wifi0}}, {{ic|wifi1}}. For further details please see the [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames systemd] documentation.}}
 
{{Note|When choosing the static names '''it should be avoided to use names in the format of "eth''X''" and "wlan''X''"''', because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g.: {{ic|net0}}, {{ic|net1}}, {{ic|wifi0}}, {{ic|wifi1}}. For further details please see the [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames systemd] documentation.}}
  
=== Set device MTU and queue Length ===
+
=== Set device MTU and queue length ===
  
 
You can change the device MTU and queue length by defining manually with an udev-rule. For example:
 
You can change the device MTU and queue length by defining manually with an udev-rule. For example:
Line 154: Line 162:
 
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"
 
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"
 
</nowiki>}}
 
</nowiki>}}
 
=== Get current device names ===
 
 
Current NIC names can be found via sysfs
 
 
{{hc|$ ls /sys/class/net|
 
lo eth0 eth1 firewire0
 
}}
 
  
 
=== Enabling and disabling network interfaces ===
 
=== Enabling and disabling network interfaces ===
Line 182: Line 182:
 
   
 
   
 
=== Dynamic IP address ===
 
=== Dynamic IP address ===
 
==== dhcpcd ====
 
The easiest is to use [[dhcpcd]], which is included in the {{Grp|base}} group. Either use the provided service file {{ic|dhcpcd@.service}}, passing the interface name as an argument, or start it manually by running {{ic|dhcpcd ''interface''}}.
 
  
 
==== systemd-networkd ====
 
==== systemd-networkd ====
  
With [[systemd]] version >= 209, it is possible to manage network connections with [[systemd-networkd]], which is intended to easily set up network on containers and virtual machines.
+
An easy way to setup DHCP for simple requirements is to use [[systemd-networkd]] service provided by systemd. See [[Systemd-networkd#Basic_DHCP_network]].
 +
 
 +
==== dhcpcd ====
 +
 
 +
[[dhcpcd]] is used as default client in Arch Linux to setup DHCP on the installation ISO. It is a more powerful tool and allows to configure more DHCP client options. See [[Dhcpcd#Running]] on how to activate it for an interface.
  
 
=== Static IP address ===
 
=== Static IP address ===
  
There are various reasons why you may wish to assign static IP addresses on your network. For instance, one may gain a certain degree of predictability with unchanging addresses, or you may not have a DHCP server available.
+
There are various reasons why you may wish to assign static IP addresses on your network. For instance, one may gain a certain degree of predictability with unchanging addresses, or you may not have a DHCP server available.  
  
{{Note|If you share your Internet connection from a Windows machine without a router, be sure to use static IP addresses on both computers to avoid LAN problems.}}
+
A static address can be configured with most networking tools standard in Arch Linux, for example see [[netctl]], [[systemd-networkd]], [[dhcpcd]].  
  
You need:
+
The following describes how to configure a static IP address '''manually'''. You need:
  
 
* Static IP address
 
* Static IP address
Line 206: Line 207:
  
 
{{Tip|You may need to manually set the DNS servers, see [[resolv.conf]] for details.}}
 
{{Tip|You may need to manually set the DNS servers, see [[resolv.conf]] for details.}}
 +
{{Note|If you share your Internet connection from a Windows machine without a router, be sure to use static IP addresses on both computers to avoid LAN problems.}}
  
 
==== Manual assignment ====
 
==== Manual assignment ====
Line 229: Line 231:
 
  # ip route add default via 192.168.1.1
 
  # ip route add default via 192.168.1.1
  
If you the get the error "No such process", it means you have to run {{ic|ip link set dev eth0 up}} as root.
+
If you get an error "No such process", it means you have to run {{ic|ip link set dev eth0 up}} as root.
  
 
==== Persistent configuration on boot using systemd and udev rules ====
 
==== Persistent configuration on boot using systemd and udev rules ====
Line 268: Line 270:
 
</nowiki>}}
 
</nowiki>}}
  
Enable the unit and start it, passing the name of the interface:
+
[[systemd#Using units|Enable and start]] the unit {{ic|network@''interface''}}, passing your name of the interface.
  
# systemctl enable network@''interface''.service
+
==== Calculating addresses ====
# systemctl start network@''interface''.service
+
  
==== Persistent configuration on boot using systemd-networkd ====
+
You can use {{ic|ipcalc}} provided by the {{Pkg|ipcalc}} package to calculate IP broadcast, network, netmask, and host ranges for more advanced configurations. An example is using Ethernet over Firewire to connect a Windows machine to Linux. To improve security and organization, both machines have their own network with the netmask and broadcast configured accordingly.
  
{{Merge|systemd-networkd|Since a separate page exists, there should be only quick introduction + link (as for [[#dhcpcd]] above).}}
+
Finding out the respective netmask and broadcast addresses is done with {{ic|ipcalc}}, by specifying the IP of the Linux NIC {{ic|10.66.66.1}} and the number of hosts (here two):
 
+
With [[systemd]] version >= 209, it's possible to manage network connections with the integrated systemd-networkd service (which is disabled by default with version 210). With this approach, only a single configuration file per interface is needed, for example:
+
 
+
{{hc|/etc/systemd/network/10-static-ethernet.network|<nowiki>
+
[Match]
+
Name=enp0s25
+
 
+
[Network]
+
Address=192.168.0.15/24
+
Gateway=192.168.0.1
+
</nowiki>}}
+
''Name'' has to be the name of the interface you want to configure, see {{ic|ip link}} for the names of available interfaces.
+
 
+
Then start/enable {{ic|systemd-networkd.service}}.
+
 
+
Further examples: https://coreos.com/blog/intro-to-systemd-networkd/ and in the [[Systemd-networkd|Systemd-networkd Arch wiki]]
+
 
+
==== Calculating addresses ====
+
 
+
You can use {{ic|ipcalc}} provided by the {{Pkg|ipcalc}} package to calculate IP broadcast, network, netmask, and host ranges for more advanced configurations. For example, I use ethernet over firewire to connect a windows machine to arch. For security and network organization, I placed them on their own network and configured the netmask and broadcast so that they are the only 2 machines on it. To figure out the netmask and broadcast addresses for this, I used ipcalc, providing it with the IP of the arch firewire nic 10.66.66.1, and specifying ipcalc should create a network of only 2 hosts.
+
  
 
{{hc|$ ipcalc -nb 10.66.66.1 -s 1|<nowiki>
 
{{hc|$ ipcalc -nb 10.66.66.1 -s 1|<nowiki>
Line 315: Line 296:
  
 
== Additional settings ==
 
== Additional settings ==
 +
 +
{{Merge|NetworkManager#Connect faster|Those section contains mostly generally applicable tips}}
  
 
=== ifplugd for laptops ===
 
=== ifplugd for laptops ===
Line 324: Line 307:
 
By default it is configured to work for the {{ic|eth0}} device. This and other settings like delays can be configured in {{ic|/etc/ifplugd/ifplugd.conf}}.
 
By default it is configured to work for the {{ic|eth0}} device. This and other settings like delays can be configured in {{ic|/etc/ifplugd/ifplugd.conf}}.
  
{{Note|[[Netctl]] package includes {{ic|netctl-ifplugd@.service}}, otherwise you can use {{ic|ifplugd@.service}} from {{Pkg|ifplugd}} package. Use for example {{ic|systemctl enable ifplugd@eth0.service}}.}}
+
{{Note|[[netctl]] package includes {{ic|netctl-ifplugd@.service}}, otherwise you can use {{ic|ifplugd@.service}} from {{Pkg|ifplugd}} package. Use for example {{ic|systemctl enable ifplugd@eth0.service}}.}}
  
 
=== Bonding or LAG ===
 
=== Bonding or LAG ===
Line 342: Line 325:
 
Prepare the configuration:
 
Prepare the configuration:
  
{{hc|/etc/netctl/mynetwork|<nowiki>
+
{{hc|/etc/netctl/''mynetwork''|<nowiki>
 
Connection='ethernet'
 
Connection='ethernet'
 
Description='Five different addresses on the same NIC.'
 
Description='Five different addresses on the same NIC.'
Line 354: Line 337:
 
Then simply execute:  
 
Then simply execute:  
  
  $ netctl start mynetwork
+
  $ netctl start ''mynetwork''
  
 
=== Change MAC/hardware address ===
 
=== Change MAC/hardware address ===
Line 360: Line 343:
 
See [[MAC Address Spoofing]].
 
See [[MAC Address Spoofing]].
  
=== Internet Sharing ===
+
=== Internet sharing ===
  
 
See [[Internet sharing]].
 
See [[Internet sharing]].
  
=== Router Configuration ===
+
=== Router configuration ===
  
 
See [[Router]].
 
See [[Router]].
Line 370: Line 353:
 
=== Local network hostname resolution ===
 
=== Local network hostname resolution ===
  
The pre-requisite is to [[#Set the hostname]] after which hostname resolution works on the local system itself {{hc|$ ping hostname|
+
The pre-requisite is to [[#Set the hostname]] after which hostname resolution works on the local system itself:
PING hostname <nowiki>(192.168.1.2) 56(84) bytes of data.
+
 
64 bytes from hostname (192.168.1.2): icmp_seq=1 ttl=64 time=0.043 ms</nowiki>}}
+
{{hc|$ ping ''hostname''|2=
 +
PING hostname (192.168.1.2) 56(84) bytes of data.
 +
64 bytes from hostname (192.168.1.2): icmp_seq=1 ttl=64 time=0.043 ms}}
 +
 
 
To enable other machines to address the host by name, either a manual configuration of the respective {{ic|/etc/hosts}} files or a service to propagate/resolve the name is required.   
 
To enable other machines to address the host by name, either a manual configuration of the respective {{ic|/etc/hosts}} files or a service to propagate/resolve the name is required.   
  
Line 383: Line 369:
 
=== Promiscuous mode ===
 
=== Promiscuous mode ===
  
{{Expansion|Explain what is promiscuous mode, provide some reference links}}
+
Toggling [[wikipedia:Promiscuous_mode|promiscuous mode]] will make a (wireless) NIC forward all traffic it receives to the OS for further processing. This is opposite to "normal mode" where a NIC will drop frames it is not intended to receive. It is most often used for advanced network troubleshooting and [[wikipedia:Packet_sniffing|packet sniffing]].
  
 
{{hc|/etc/systemd/system/promiscuous@.service|<nowiki>
 
{{hc|/etc/systemd/system/promiscuous@.service|<nowiki>
Line 409: Line 395:
 
Some cable ISPs (videotron for example) have the cable modem configured to recognize only one client PC, by the MAC address of its network interface. Once the cable modem has learned 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 MAC address different from 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.
 
Some cable ISPs (videotron for example) have the cable modem configured to recognize only one client PC, by the MAC address of its network interface. Once the cable modem has learned 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 MAC address different from 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. See also [[Configuring Network#Change MAC/hardware address|Change MAC/hardware address]].
+
If this method does not work, you will need to clone the MAC address of the original machine. See also [[#Change MAC/hardware address]].
  
 
=== The TCP window scaling problem ===
 
=== The TCP window scaling problem ===
Line 415: Line 401:
 
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.
 
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, [http://www.faqs.org/rfcs/rfc1323.html 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.
+
Back in 1992, as more and more memory became available, [http://www.faqs.org/rfcs/rfc1323.html 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.
  
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.
 
+
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.
 
The resulting connection is at best very slow or broken.
Line 433: Line 415:
 
If you cannot browse any website, but you can ping some random hosts, chances are great that you're experiencing this problem: ping uses ICMP and is not affected by TCP problems.
 
If you cannot browse any website, but you can ping some random hosts, chances are great that you're experiencing this problem: ping uses ICMP and is not affected by TCP problems.
  
You can try to use Wireshark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).
+
You can try to use [[Wireshark]]. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).
 +
 
 +
==== Ways of fixing it ====
  
==== How to fix it (The bad way) ====
+
===== Bad =====
  
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.
+
To fix it the bad way, you can change the {{ic|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
 
  # echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem
  
==== How to fix it (The good way) ====
+
===== Good =====
  
Simply disable Window Scaling. Since Window Scaling is a nice TCP feature, it may be uncomfortable to disable it, especially if you cannot fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof way (which will work with most kernels) is to add the following line to {{ic|/etc/sysctl.d/99-disable_window_scaling.conf}} (see also [[sysctl]])
+
Simply disable Window Scaling. Since Window Scaling is a nice TCP feature, it may be uncomfortable to disable it, especially if you cannot fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof way (which will work with most kernels) is to add the following line to {{ic|/etc/sysctl.d/99-disable_window_scaling.conf}} (see also [[sysctl]]):
  
 
  net.ipv4.tcp_window_scaling = 0
 
  net.ipv4.tcp_window_scaling = 0
  
==== How to fix it (The best way) ====
+
===== Best =====
  
 
This problem is caused by broken routers/firewalls, so let's change them. Some users have reported that the broken router was their very own DSL router.
 
This problem is caused by broken routers/firewalls, so let's change them. Some users have reported that the broken router was their very own DSL router.
Line 459: Line 443:
 
=== Realtek no link / WOL problem ===
 
=== Realtek no link / WOL problem ===
  
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem 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 problem 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 problem will also affect other operative systems without newer drivers (eg. Live CDs). Here are a few fixes for this problem:
+
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem 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 problem 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 problem will also affect other operating systems without newer drivers (eg. Live CDs). Here are a few fixes for this problem.
  
==== Method 1 - Enable the NIC directly in Linux ====
+
==== Method 1: enable the NIC directly in Linux ====
  
Get the ethernet NIC name from the output of
+
Get the ethernet NIC name from the output of:
  
 
  $ ip a
 
  $ ip a
Line 469: Line 453:
 
Bring up the device as root using the NIC name:
 
Bring up the device as root using the NIC name:
  
  # ip link set dev <NIC_name> up
+
  # ip link set dev ''NIC_name'' up
  
For ex, if <NIC_name> is enp7s0
+
For ex, if ''NIC_name'' is enp7s0:
  
 
  # ip link set dev enp7s0 up
 
  # ip link set dev enp7s0 up
  
If it worked and the card is powered on, a new interface should appear in the output of {{ic|ifconfig}}
+
If it worked and the card is powered on, you should see {{ic|state UP}} for the given interface in the output of {{ic|ip link}}.
  
==== Method 2 - Rollback/change Windows driver ====
+
==== Method 2: 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).
 
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 3 - Enable WOL in Windows driver ====
+
==== Method 3: 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.
+
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)
+
In Windows XP (example):
  Right click my computer
+
 
  --> Hardware tab
+
  Right click my computer and choose "Properties"
 +
  --> "Hardware" tab
 
   --> Device Manager
 
   --> Device Manager
 
     --> Network Adapters
 
     --> Network Adapters
Line 497: Line 482:
 
{{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 {{ic|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.}}
 
{{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 {{ic|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 4 - Newer Realtek Linux driver ====
+
==== Method 4: 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).
+
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 5 - Enable ''LAN Boot ROM'' in BIOS/CMOS ====
+
==== Method 5: 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.
 
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.
  
{{Note|This was tested successfully multiple times with GIGABYTE system board GA-G31M-ES2L with BIOS version F8 released on 2009/02/05. YMMV.}}
+
{{Note|This was tested several times on a GIGABYTE GA-G31M-ES2L motherboard, BIOS version F8 released on 2009/02/05.}}
  
=== No eth0 with Atheros AR9485 ===
+
=== No interface with Atheros chipsets ===
  
The ethernet (eth0) for Atheros AR9485 are not working out-of-the-box (with installation media of February 2014). The working solution for this is to install the package {{AUR|backports-patched}} from AUR.
+
Users of some Atheros ethernet chips are reporting it does not work out-of-the-box (with installation media of February 2014). The working solution for this is to install the package {{AUR|backports-patched}} from AUR.
  
 
=== Broadcom BCM57780 ===
 
=== Broadcom BCM57780 ===
Line 516: Line 501:
  
 
These steps should help if your computer has this chipset:
 
These steps should help if your computer has this chipset:
 +
 +
* Find your NIC in ''lspci'' output:
 +
 
  $ lspci | grep Ethernet
 
  $ lspci | grep Ethernet
 
  02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)
 
  02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)
  
If your wired networking is not functioning in some way or another, try unplugging your cable then doing the following (as root):
+
* If your wired networking is not functioning in some way or another, try unplugging your cable then doing the following:
 +
 
 
  # modprobe -r tg3
 
  # modprobe -r tg3
 
  # modprobe broadcom
 
  # modprobe broadcom
 
  # modprobe tg3
 
  # modprobe tg3
  
Now plug you network cable in. If this solves your problems you can make this permanent by adding {{ic|broadcom}} and {{ic|tg3}} (in this order) to the {{ic|MODULES}} array in {{ic|/etc/mkinitcpio.conf}}:
+
* Plug you network cable in. If this solves your problems you can make this permanent by adding {{ic|broadcom}} and {{ic|tg3}} (in this order) to the {{ic|MODULES}} array in {{ic|/etc/mkinitcpio.conf}}:
  
 
  MODULES=".. broadcom tg3 .."
 
  MODULES=".. broadcom tg3 .."
  
Then rebuild the initramfs:
+
* Rebuild the initramfs:
  
 
  # mkinitcpio -p linux
 
  # mkinitcpio -p linux
  
 
{{Note|These methods may work for other chipsets, such as BCM57760.}}
 
{{Note|These methods may work for other chipsets, such as BCM57760.}}

Revision as of 16:30, 28 June 2014

This page explains how to set up a wired connection to a network. If you need to set up wireless networking see the Wireless network configuration page.

Check the connection

Note: If you receive an error like ping: icmp open socket: Operation not permitted when executing ping, try to re-install the iputils package.

Many times, the basic installation procedure has created a working network configuration. To check if this is so, use the following command:

Note: The -c 3 option calls it three times. See man ping for more information.
$ ping -c 3 www.google.com
PING www.l.google.com (74.125.224.146) 56(84) bytes of data.
64 bytes from 74.125.224.146: icmp_req=1 ttl=50 time=437 ms
64 bytes from 74.125.224.146: icmp_req=2 ttl=50 time=385 ms
64 bytes from 74.125.224.146: icmp_req=3 ttl=50 time=298 ms

--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 298.107/373.642/437.202/57.415 ms

If it works, then you may only wish to personalize your settings from the options below.

If the previous command complains about unknown hosts, it means that your machine was unable to resolve this domain name. It might be related to your service provider or your router/gateway. You can try pinging a static IP address to prove that your machine has access to the Internet:

$ ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=52.9 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=72.5 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=53 time=70.6 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 52.975/65.375/72.543/8.803 ms
Note: 8.8.8.8 is a static address that is easy to remember. It is the address of Google's primary DNS server, therefore it can be considered reliable, and is generally not blocked by content filtering systems and proxies.

If you are able to ping 8.8.8.8 but not www.google.com, check your DNS configuration. See resolv.conf for details.

Set the hostname

A hostname is a unique name created to identify a machine on a network: it is configured in /etc/hostname. The file can contain the system's domain name, if any. To set the hostname, do:

# hostnamectl set-hostname myhostname

This will put myhostname into /etc/hostname.

See man 5 hostname and man 1 hostnamectl for details.

Add the same hostname to /etc/hosts:

/etc/hosts
#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain	localhost myhostname
::1		localhost.localdomain	localhost

To set the hostname temporarily (until a reboot), use hostname from inetutils:

# hostname myhostname

Device Driver

Check the status

udev should detect your network interface card (see Wikipedia:Network_interface_controller) and automatically load the necessary module at start up. Check the "Ethernet controller" entry (or similar) from the lspci -v output. It should tell you which kernel module contains the driver for your network device. For example:

$ lspci -v
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)
 	...
 	Kernel driver in use: atl1
 	Kernel modules: atl1

Next, check that 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

Skip the next section if the driver was loaded successfully. Otherwise, you will need to know which module is needed for your particular model.

Load the module

Search in the Internet for the right module/driver for the chipset. Some common modules are 8139too for cards with a Realtek chipset, or sis900 for cards with a SiS chipset. Once you know which module to use, try to load it manually. If you get an error saying that the module was not found, it's possible that the driver is not included in Arch kernel. You may search the AUR for the module name.

If udev is not detecting and loading the proper module automatically during bootup, see Kernel modules#Loading.

Network Interfaces

Device names

For computers with multiple NICs, it is important to have fixed device names. Many configuration problems are caused by interface name changing.

udev is responsible for which device gets which name. Systemd v197 introduced Predictable Network Interface Names, which automatically assigns static names to network devices. Interfaces are now prefixed with en (ethernet), wl (WLAN), or ww (WWAN) followed by an automatically generated identifier, creating an entry such as enp0s25.

This behavior may be disabled by adding net.ifnames=0 in your kernel command line.

Tip: You can run ip link or ls /sys/class/net to list all available interfaces.
Note: When changing the interface naming scheme, do not forget to update all network-related configuration files and custom systemd unit files to reflect the change. Specifically, if you have netctl static profiles enabled, run netctl reenable profile to update the generated service file.

Get current device names

Current NIC names can be found via sysfs:

$ ls /sys/class/net
lo eth0 eth1 firewire0

Change device name

You can change the device name by defining the name manually with an udev-rule. For example:

/etc/udev/rules.d/10-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="net0"

A couple of things to note:

  • To get the MAC address of each card, use this command: cat /sys/class/net/device_name/address
  • Make sure to use the lower-case hex values in your udev rules. It doesn't like upper-case.

If the network card has a dynamic MAC, you can use DEVPATH, for example:

/etc/udev/rules.d/10-network.rules
SUBSYSTEM=="net", DEVPATH=="/devices/platform/wemac.*", NAME="int"
Note: When choosing the static names it should be avoided to use names in the format of "ethX" and "wlanX", because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g.: net0, net1, wifi0, wifi1. For further details please see the systemd documentation.

Set device MTU and queue length

You can change the device MTU and queue length by defining manually with an udev-rule. For example:

/etc/udev/rules.d/10-network.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"

Enabling and disabling network interfaces

You can activate or deactivate network interfaces using:

# ip link set eth0 up
# ip link set eth0 down

To check the result:

$ ip link show dev eth0
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000
...

Configure the IP address

You have two options: a dynamically assigned address using DHCP, or an unchanging "static" address.

Dynamic IP address

systemd-networkd

An easy way to setup DHCP for simple requirements is to use systemd-networkd service provided by systemd. See Systemd-networkd#Basic_DHCP_network.

dhcpcd

dhcpcd is used as default client in Arch Linux to setup DHCP on the installation ISO. It is a more powerful tool and allows to configure more DHCP client options. See Dhcpcd#Running on how to activate it for an interface.

Static IP address

There are various reasons why you may wish to assign static IP addresses on your network. For instance, one may gain a certain degree of predictability with unchanging addresses, or you may not have a DHCP server available.

A static address can be configured with most networking tools standard in Arch Linux, for example see netctl, systemd-networkd, dhcpcd.

The following describes how to configure a static IP address manually. You need:

If you are running a private network, it is safe to use IP addresses in 192.168.*.* for your IP addresses, with a subnet mask of 255.255.255.0 and a broadcast address of 192.168.*.255. The gateway is usually 192.168.*.1 or 192.168.*.254.

Tip: You may need to manually set the DNS servers, see resolv.conf for details.
Note: If you share your Internet connection from a Windows machine without a router, be sure to use static IP addresses on both computers to avoid LAN problems.

Manual assignment

You can assign a static IP address in the console:

# ip addr add IP_address/subnet_mask broadcast broadcast_address dev interface

For example:

# ip addr add 192.168.1.2/24 broadcast 192.168.1.255 dev eth0
Note: The subnet mask was specified using CIDR notation.

For more options, see man ip.

Add your gateway IP address like so:

# ip route add default via default_gateway

For example:

# ip route add default via 192.168.1.1

If you get an error "No such process", it means you have to run ip link set dev eth0 up as root.

Persistent configuration on boot using systemd and udev rules

First create a configuration file for the systemd service, replace interface with the proper network interface name:

/etc/conf.d/network@interface
address=192.168.0.15
netmask=24
broadcast=192.168.0.255
gateway=192.168.0.1

Create a systemd unit file:

/etc/systemd/system/network@.service
[Unit]
Description=Network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network@%i

ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i
ExecStart=/usr/bin/sh -c 'test -n ${gateway} && /usr/bin/ip route add default via ${gateway}'

ExecStop=/usr/bin/ip addr flush dev %i
ExecStop=/usr/bin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

Enable and start the unit network@interface, passing your name of the interface.

Calculating addresses

You can use ipcalc provided by the ipcalc package to calculate IP broadcast, network, netmask, and host ranges for more advanced configurations. An example is using Ethernet over Firewire to connect a Windows machine to Linux. To improve security and organization, both machines have their own network with the netmask and broadcast configured accordingly.

Finding out the respective netmask and broadcast addresses is done with ipcalc, by specifying the IP of the Linux NIC 10.66.66.1 and the number of hosts (here two):

$ ipcalc -nb 10.66.66.1 -s 1
Address:   10.66.66.1

Netmask:   255.255.255.252 = 30
Network:   10.66.66.0/30
HostMin:   10.66.66.1
HostMax:   10.66.66.2
Broadcast: 10.66.66.3
Hosts/Net: 2                     Class A, Private Internet

Load configuration

To test your settings either reboot the computer or reload the relevant systemd services. Then try pinging your gateway, DNS server, ISP provider and other Internet sites, in that order, to detect any connection problems along the way, as in this example:

$ ping -c 3 www.google.com

Additional settings

Merge-arrows-2.pngThis article or section is a candidate for merging with NetworkManager#Connect faster.Merge-arrows-2.png

Notes: Those section contains mostly generally applicable tips (Discuss in Talk:Network configuration#)

ifplugd for laptops

Tip: dhcpcd provides the same feature out of the box.

ifplugd in official repositories is 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.

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

Note: netctl package includes netctl-ifplugd@.service, otherwise you can use ifplugd@.service from ifplugd package. Use for example systemctl enable ifplugd@eth0.service.

Bonding or LAG

See netctl#Bonding.

IP address aliasing

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Manual method using ip should be added; then move current example using netctl into netctl. (Discuss in Talk:Network configuration#)

IP aliasing is the process of adding more than one IP address to a network interface. With this, one node on a network can have multiple connections to a network, each serving a different purpose. Typical uses are virtual hosting of Web and FTP servers, or reorganizing servers without having to update any other machines (this is especially useful for nameservers).

Example

You will need netctl from the official repositories.

Prepare the configuration:

/etc/netctl/mynetwork
Connection='ethernet'
Description='Five different addresses on the same NIC.'
Interface='eth0'
IP='static'
Address=('192.168.1.10' '192.168.178.11' '192.168.1.12' '192.168.1.13' '192.168.1.14' '192.168.1.15')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

Then simply execute:

$ netctl start mynetwork

Change MAC/hardware address

See MAC Address Spoofing.

Internet sharing

See Internet sharing.

Router configuration

See Router.

Local network hostname resolution

The pre-requisite is to #Set the hostname after which hostname resolution works on the local system itself:

$ ping hostname
PING hostname (192.168.1.2) 56(84) bytes of data.
64 bytes from hostname (192.168.1.2): icmp_seq=1 ttl=64 time=0.043 ms

To enable other machines to address the host by name, either a manual configuration of the respective /etc/hosts files or a service to propagate/resolve the name is required.

When setting up a DNS server such as BIND or Unbound is overkill, manually editing your /etc/hosts is too cumbersome, or when you want more flexibility with dynamic leaving and joining of hosts to the network, it is possible to handle hostname resolution on your local network using zero-configuration networking. There are two options available:

  • Samba provides hostname resolution via Microsoft's NetBIOS. It only requires installation of samba and enabling of the nmbd.service service. Computers running Windows, OS X, or Linux with nmbd running, will be able to find your machine.
  • Avahi provides hostname resolution via zeroconf, also known as Avahi or Bonjour. It requires slightly more complex configuration than Samba: see Avahi#Hostname resolution for details. Computers running OS X, or Linux with an Avahi daemon running, will be able to find your machine. Windows does not have an built-in Avahi client or daemon.

Promiscuous mode

Toggling promiscuous mode will make a (wireless) NIC forward all traffic it receives to the OS for further processing. This is opposite to "normal mode" where a NIC will drop frames it is not intended to receive. It is most often used for advanced network troubleshooting and packet sniffing.

/etc/systemd/system/promiscuous@.service
[Unit]
Description=Set %i interface in promiscuous mode
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set dev %i promisc on
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

If you want to enable promiscuous mode on interface eth0 run:

# systemctl enable promiscuous@eth0.service

Troubleshooting

Swapping computers on the cable modem

Some cable ISPs (videotron for example) have the cable modem configured to recognize only one client PC, by the MAC address of its network interface. Once the cable modem has learned 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 MAC address different from 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. See also #Change MAC/hardware address.

The TCP window scaling problem

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, let's 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).

When you have this problem, the dmesg's output is OK, logs are clean and ip addr will report normal status... and actually everything appears normal.

If you cannot browse any website, but you can ping some random hosts, chances are great that you're experiencing this problem: ping uses ICMP and is not affected by TCP problems.

You can try to use Wireshark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).

Ways of fixing it

Bad

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
Good

Simply disable Window Scaling. Since Window Scaling is a nice TCP feature, it may be uncomfortable to disable it, especially if you cannot fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof way (which will work with most kernels) is to add the following line to /etc/sysctl.d/99-disable_window_scaling.conf (see also sysctl):

net.ipv4.tcp_window_scaling = 0
Best

This problem is caused by broken routers/firewalls, so let's change them. Some users have reported that the broken router was their very own DSL router.

More about it

This section is based on the LWN article TCP window scaling and broken routers and a Kernel Trap article: Window Scaling on the Internet.

There are also several relevant threads on the LKML.

Realtek no link / WOL problem

Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem 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 problem 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 problem will also affect other operating systems without newer drivers (eg. Live CDs). Here are a few fixes for this problem.

Method 1: enable the NIC directly in Linux

Get the ethernet NIC name from the output of:

$ ip a

Bring up the device as root using the NIC name:

# ip link set dev NIC_name up

For ex, if NIC_name is enp7s0:

# ip link set dev enp7s0 up

If it worked and the card is powered on, you should see state UP for the given interface in the output of ip link.

Method 2: 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 3: 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 and choose "Properties"
--> "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 4: 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 5: 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.

Note: This was tested several times on a GIGABYTE GA-G31M-ES2L motherboard, BIOS version F8 released on 2009/02/05.

No interface with Atheros chipsets

Users of some Atheros ethernet chips are reporting it does not work out-of-the-box (with installation media of February 2014). The working solution for this is to install the package backports-patchedAUR from AUR.

Broadcom BCM57780

This Broadcom chipset sometimes does not behave well unless you specify the order of the modules to be loaded. The modules are broadcom and tg3, the former needing to be loaded first.

These steps should help if your computer has this chipset:

  • Find your NIC in lspci output:
$ lspci | grep Ethernet
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)
  • If your wired networking is not functioning in some way or another, try unplugging your cable then doing the following:
# modprobe -r tg3
# modprobe broadcom
# modprobe tg3
  • Plug you network cable in. If this solves your problems you can make this permanent by adding broadcom and tg3 (in this order) to the MODULES array in /etc/mkinitcpio.conf:
MODULES=".. broadcom tg3 .."
  • Rebuild the initramfs:
# mkinitcpio -p linux
Note: These methods may work for other chipsets, such as BCM57760.