Sie sind auf Seite 1von 15

Networkconfiguration

FromArchWiki

Thispageexplainshowtosetupawiredconnectiontoanetwork.Ifyouneedto

setupwirelessnetworkingseetheWirelessnetworkconfigurationpage.

Contents

1ChecktheconnectionContents 2Setthehostname 3DeviceDriver 3.1Checkthestatus 3.2Loadthemodule 4NetworkInterfaces 4.1Devicenames

2SetthehostnameContents 1Checktheconnection 3DeviceDriver 3.1Checkthestatus 3.2Loadthemodule 4NetworkInterfaces 4.1Devicenames

3DeviceDriverContents 1Checktheconnection 2Setthehostname 3.1Checkthestatus 3.2Loadthemodule 4NetworkInterfaces 4.1Devicenames

3.1CheckthestatusContents 1Checktheconnection 2Setthehostname 3DeviceDriver 3.2Loadthemodule 4NetworkInterfaces 4.1Devicenames

3.2Loadthemodule2Setthehostname 3DeviceDriver 3.1Checkthestatus 4NetworkInterfaces 4.1Devicenames 4.1.1Getcurrentdevicenames

4NetworkInterfaces3DeviceDriver 3.1Checkthestatus 3.2Loadthemodule 4.1Devicenames 4.1.1Getcurrentdevicenames

4.1Devicenames3.1Checkthestatus 3.2Loadthemodule 4NetworkInterfaces 4.1.1Getcurrentdevicenames 4.1.2Changedevicename

4.1.1Getcurrentdevicenames

4.1.2Changedevicename

4.2SetdeviceMTUandqueuelength

4.3Enablinganddisablingnetworkinterfaces

5ConfiguretheIPaddress

5.1DynamicIPaddress5ConfiguretheIPaddress 5.1.1systemd­networkd 5.1.2dhcpcd 5.2StaticIPaddress

5.1.1systemd­networkd5ConfiguretheIPaddress 5.1DynamicIPaddress 5.1.2dhcpcd 5.2StaticIPaddress 5.2.1Manualassignment

5.1.2dhcpcd5.1DynamicIPaddress 5.1.1systemd­networkd 5.2StaticIPaddress 5.2.1Manualassignment

5.2StaticIPaddress5.1DynamicIPaddress 5.1.1systemd­networkd 5.1.2dhcpcd 5.2.1Manualassignment 5.2.2systemd­networkd

5.2.1Manualassignment5.1.1systemd­networkd 5.1.2dhcpcd 5.2StaticIPaddress 5.2.2systemd­networkd 5.2.3systemdservice

5.2.2systemd­networkd5.1.2dhcpcd 5.2StaticIPaddress 5.2.1Manualassignment 5.2.3systemdservice 5.2.4Calculatingaddresses

5.2.3systemdservice5.2.1Manualassignment 5.2.2systemd­networkd 5.2.4Calculatingaddresses 6Additionalsettings

5.2.4Calculatingaddresses

6Additionalsettings5.2.3systemdservice 5.2.4Calculatingaddresses 6.1ifplugdforlaptops 6.2BondingorLAG 6.3IPaddressaliasing

6.1ifplugdforlaptops5.2.4Calculatingaddresses 6Additionalsettings 6.2BondingorLAG 6.3IPaddressaliasing 6.3.1Example

6.2BondingorLAG6Additionalsettings 6.1ifplugdforlaptops 6.3IPaddressaliasing 6.3.1Example

6.3IPaddressaliasing6Additionalsettings 6.1ifplugdforlaptops 6.2BondingorLAG 6.3.1Example 6.4ChangeMAC/hardwareaddress 6.5Internetsharing

6.3.1Example6.1ifplugdforlaptops 6.2BondingorLAG 6.3IPaddressaliasing 6.4ChangeMAC/hardwareaddress 6.5Internetsharing

6.4ChangeMAC/hardwareaddress

6.5Internetsharing6.3.1Example 6.4ChangeMAC/hardwareaddress 6.6Routerconfiguration 6.7Localnetworkhostnameresolution

6.6Routerconfiguration6.3.1Example 6.4ChangeMAC/hardwareaddress 6.5Internetsharing 6.7Localnetworkhostnameresolution 6.8Promiscuousmode

6.7Localnetworkhostnameresolution

6.8Promiscuousmode6.6Routerconfiguration 6.7Localnetworkhostnameresolution 7Troubleshooting 7.1Swappingcomputersonthecablemodem

7Troubleshooting6.7Localnetworkhostnameresolution 6.8Promiscuousmode 7.1Swappingcomputersonthecablemodem

7.1Swappingcomputersonthecablemodem

7.2TheTCPwindowscalingproblem

7.2.1Howtodiagnosetheproblem

7.2.2Waysoffixingit7.2TheTCPwindowscalingproblem 7.2.1Howtodiagnosetheproblem 7.2.2.1Bad 7.2.2.2Good 7.2.2.3Best 7.2.3Moreaboutit

7.2.2.1Bad7.2.1Howtodiagnosetheproblem 7.2.2Waysoffixingit 7.2.2.2Good 7.2.2.3Best 7.2.3Moreaboutit

7.2.2.2Good7.2.1Howtodiagnosetheproblem 7.2.2Waysoffixingit 7.2.2.1Bad 7.2.2.3Best 7.2.3Moreaboutit 7.3Realteknolink/WOLproblem

7.2.2.3Best7.2.2Waysoffixingit 7.2.2.1Bad 7.2.2.2Good 7.2.3Moreaboutit 7.3Realteknolink/WOLproblem

7.2.3Moreaboutit7.2.2Waysoffixingit 7.2.2.1Bad 7.2.2.2Good 7.2.2.3Best 7.3Realteknolink/WOLproblem

7.3Realteknolink/WOLproblem

7.3.1Method1:enabletheNICdirectlyinLinux

7.3.2Method2:rollback/changeWindowsdriver

7.3.3Method3:enableWOLinWindowsdriver

Relatedarticles

7.3.4Method4:newerRealtekLinuxdriver

7.3.5Method5:enableLANBootROMinBIOS/CMOS

7.4NointerfacewithAtheroschipsets

7.5BroadcomBCM57780

7.6RealtekRTL8111/8168B

Checktheconnection

Note:Ifyoureceiveanerrorlike ping: icmp open socket: Operation not permitted whenexecuting

Manytimes,thebasicinstallationprocedurehascreatedaworkingnetworkconfiguration.Tocheckifthisis

so,usethefollowingcommand:

Note:The ‐c 3 optioncallsitthreetimes.See man ping formoreinformation. $ ping ‐c 3 www.google.com PING
Note:The ‐c 3 optioncallsitthreetimes.See man ping formoreinformation.
$ 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

Ifitworks,thenyoumayonlywishtopersonalizeyoursettingsfromtheoptionsbelow.

Ifthepreviouscommandcomplainsaboutunknownhosts,itmeansthatyourmachinewasunabletoresolve

thisdomainname.Itmightberelatedtoyourserviceprovideroryourrouter/gateway.Youcantrypinginga

staticIPaddresstoprovethatyourmachinehasaccesstotheInternet: $ ping ‐c 3 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes
staticIPaddresstoprovethatyourmachinehasaccesstotheInternet:
$ 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 isastaticaddressthatiseasytoremember.ItistheaddressofGoogle'sprimaryDNS server,thereforeitcanbeconsideredreliable,andisgenerallynotblockedbycontentfilteringsystemsand proxies.

Ifyouareabletoping 8.8.8.8 butnot www.google.com,checkyourDNSconfiguration.Seeresolv.conffor details.

Setthehostname

Ahostnameisauniquenamecreatedtoidentifyamachineonanetwork:itisconfiguredin /etc/hostname. Thefilecancontainthesystem'sdomainname,ifany.Tosetthehostname,do:

#

hostnamectl set‐hostname myhostname

Thiswillput myhostname into /etc/hostname.See man 5 hostname and man 1 hostnamectl fordetails.

Note:

myhostname nssmodule(enabledbydefaultin /etc/nsswitch.conf).Thismeanschanginghostnamesin /etc/hosts isusuallynotnecessary.See#Localnetworkhostnameresolutionifthereareproblemswith hostnameresolution,suchasdelayswithnetwork­basedapplications.

# hostname myhostname

DeviceDriver

Checkthestatus

udevshoulddetectyournetworkinterfacecard(seeWikipedia:Networkinterfacecontroller)and automaticallyloadthenecessarymoduleatstartup.Checkthe"Ethernetcontroller"entry(orsimilar)from the lspci ‐v output.Itshouldtellyouwhichkernelmodulecontainsthedriverforyournetworkdevice.For example:

$ lspci ‐v 02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)
$ 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,checkthatthedriverwasloadedvia dmesg | grep module_name.Forexample:

$ dmesg | grep atl1

atl1 0000:02:00.0: eth0 link is up 100 Mbps full duplex

Skipthenextsectionifthedriverwasloadedsuccessfully.Otherwise,youwillneedtoknowwhichmodule

isneededforyourparticularmodel.

Loadthemodule

SearchintheInternetfortherightmodule/driverforthechipset.Somecommonmodulesare 8139too for cardswithaRealtekchipset,or sis900 forcardswithaSiSchipset.Onceyouknowwhichmoduletouse, trytoloaditmanually.Ifyougetanerrorsayingthatthemodulewasnotfound,it'spossiblethatthedriveris notincludedinArchkernel.YoumaysearchtheAURforthemodulename.

NetworkInterfaces

Devicenames

ForcomputerswithmultipleNICs,itisimportanttohavefixeddevicenames.Manyconfigurationproblems

arecausedbyinterfacenamechanging.

InterfaceNames(http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames), whichautomaticallyassignsstaticnamestonetworkdevices.Interfacesarenowprefixedwith en (ethernet), wl (WLAN),or ww (WWAN)followedbyanautomaticallygeneratedidentifier,creatinganentrysuchas enp0s25.Thisbehaviormaybedisabledbyadding net.ifnames=0 tothekernelparameters.

Getcurrentdevicenames

CurrentNICnamescanbefoundvia sysfs or ip link.Forexample: $ ls /sys/class/net lo enp0s3 $ ip link 1: lo:
CurrentNICnamescanbefoundvia sysfs or ip link.Forexample:
$ ls /sys/class/net
lo enp0s3
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:23:6f:3a brd ff:ff:ff:ff:ff:ff

Changedevicename

Youcanchangethedevicenamebydefiningthenamemanuallywithanudev­rule.Forexample:

/etc/udev/rules.d/10‐network.rules SUBSYSTEM=="net", ACTION=="add",
/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"

Theseruleswillbeappliedautomaticallyatboot.

Acoupleofthingstonote:

TogettheMACaddressofeachcard,usethiscommand: cat /sys/class/net/device_name/address Makesuretousethelower­casehexvaluesinyourudevrules.Itdoesn'tlikeupper­case.

IfthenetworkcardhasadynamicMAC,youcanuse DEVPATH,forexample:

Thedevicepathshouldmatchboththenewandolddevicename,sincetherulemaybeexecutedmorethan

Thedevicepathshouldmatchboththenewandolddevicename,sincetherulemaybeexecutedmorethan onceonbootup.Forexample,inthesecondrule, "/devices/pci*/*1c.0/*/net/enp*" wouldbewrongsince itwillstopmatchingoncethenameischangedto en.Onlythesystem­defaultrulewillfirethesecondtime around,causingthenametobechangedbacktoe.g. enp1s0.

Totestyourrules,theycanbetriggereddirectlyfromuserspacewith udevadm ‐‐debug test /sys/DEVPATH. Remembertofirsttakedowntheinterfaceyouaretryingtorename(ip link set down DEV).

Note:Whenchoosingthestaticnamesitshouldbeavoidedtousenamesintheformatof"ethX"and "wlanX",becausethismayleadtoraceconditionsbetweenthekernelandudevduringboot.Instead,itis bettertouseinterfacenamesthatarenotusedbythekernelasdefault,e.g.: net0, net1, wifi0, wifi1. Forfurtherdetailspleaseseethesystemd (http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames)documentation.

SetdeviceMTUandqueuelength

YoucanchangethedeviceMTUandqueuelengthbydefiningmanuallywithanudev­rule.Forexample:

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

Enablinganddisablingnetworkinterfaces

Youcanactivateordeactivatenetworkinterfacesusing:

# ip link set eth0 up

# ip link set eth0 down

Tochecktheresult:

$ ip link show dev eth0 2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0
$ 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

ConfiguretheIPaddress

Youhavetwooptions:adynamicallyassignedaddressusingDHCP,oranunchanging"static"address.

DynamicIPaddress

systemd­networkd

AneasywaytosetupDHCPforsimplerequirementsistousesystemd­networkdserviceprovidedby

dhcpcd

dhcpcdisusedasdefaultclientinArchLinuxtosetupDHCPontheinstallationISO.Itisamorepowerful

toolandallowstoconfiguremoreDHCPclientoptions.Seedhcpcd#Runningonhowtoactivateitforan

interface.

StaticIPaddress

TherearevariousreasonswhyyoumaywishtoassignstaticIPaddressesonyournetwork.Forinstance,one

maygainacertaindegreeofpredictabilitywithunchangingaddresses,oryoumaynothaveaDHCPserver

available.

AstaticaddresscanbeconfiguredwithmostnetworkingtoolsstandardinArchLinux,forexamplesee

ThefollowingdescribeshowtoconfigureastaticIPaddressmanually.Youneed:

StaticIPaddress SubnetmaskinCIDRnotation ,forexample /24 istheCIDRnotationof 255.255.255.0 netmask. CIDRnotation,forexample /24 istheCIDRnotationof 255.255.255.0 netmask.

Gateway 'sIPaddress Nameserver(DNS)IPaddresses.Seealso resolv.conf . Gateway'sIPaddress Nameserver(DNS)IPaddresses.Seealsoresolv.conf.

Ifyouarerunningaprivatenetwork,itissafetouseIPaddressesin 192.168.*.* foryourIPaddresses,with asubnetmaskof 255.255.255.0 andabroadcastaddressof 192.168.*.255.Thegatewayisusually

192.168.*.1 or 192.168.*.254.

Warning:

IfyoushareyourInternetconnectionfromaWindowsmachinewithoutarouter,besuretousestatic

IPaddressesonbothcomputerstoavoidLANproblems.

Manualassignment

Thismethoddoesnotpersistacrossreboots.Enablethenetworkinterface:

# ip link set interface up

AssignastaticIPaddressintheconsole:

# ip addr add IP_address/subnet_mask broadcast broadcast_address dev interface

Forexample:

# ip addr add 192.168.1.2/24 broadcast 192.168.1.255 dev interface

Formoreoptions,see man ip.

AddyourgatewayIPaddresslikeso:

Forexample:

# ip route add default via 192.168.1.1

systemd­networkd

systemdservice

Firstcreateaconfigurationfileforthesystemdservice,replace interface withthepropernetworkinterface name:

/etc/conf.d/net‐conf‐interface

address=192.168.1.2

netmask=24

broadcast=192.168.1.255

gateway=192.168.1.1

Createnetworkstartandstopscripts:

/usr/local/bin/net‐up

#!/bin/bash ip link set dev "$1" up ip addr add "$address/$netmask" broadcast "$broadcast" dev "$1" [[ ‐z $gateway ]] || ip route add default via "$gateway"

/usr/local/bin/net‐down

#!/bin/bash ip addr flush dev "$1" ip route flush dev "$1" ip link set dev "$1" down

Makebothscriptsexecutable:

# chmod +x /usr/local/bin/net‐{up,down}

systemdservicefile:

/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/net‐conf‐%i ExecStart=/usr/local/bin/net‐up %i ExecStop=/usr/local/bin/net‐down %i

[Install]

WantedBy=multi‐user.target

Enableandstarttheunit network@interface,replacing interface withthenameofyourinterface.

Tip:Ifyoupreferso,youcanskipthescriptsandaddthecommandsasadditional ExecStart= and ExecStop= lines;seethewirelessnetworkexample.

Calculatingaddresses

Youcanuse ipcalc providedbytheipcalc (https://www.archlinux.org/packages/?name=ipcalc)package

tocalculateIPbroadcast,network,netmask,andhostrangesformoreadvancedconfigurations.Anexample

isusingEthernetoverFirewiretoconnectaWindowsmachinetoLinux.Toimprovesecurityand

organization,bothmachineshavetheirownnetworkwiththenetmaskandbroadcastconfiguredaccordingly.

Findingouttherespectivenetmaskandbroadcastaddressesisdonewith ipcalc,byspecifyingtheIPofthe LinuxNIC 10.66.66.1
Findingouttherespectivenetmaskandbroadcastaddressesisdonewith ipcalc,byspecifyingtheIPofthe
LinuxNIC 10.66.66.1 andthenumberofhosts(heretwo):
$ 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

Additionalsettings

ifplugdforlaptops

Tip:dhcpcdprovidesthesamefeatureoutofthebox.

willautomaticallyconfigureyourEthernetdevicewhenacableispluggedinandautomaticallyunconfigure

itifthecableispulled.Thisisusefulonlaptopswithonboardnetworkadapters,sinceitwillonlyconfigure

theinterfacewhenacableisreallyconnected.Anotheruseiswhenyoujustneedtorestartthenetworkbutdo

notwanttorestartthecomputerordoitfromtheshell.

Bydefaultitisconfiguredtoworkforthe eth0 device.Thisandothersettingslikedelayscanbeconfigured

in /etc/ifplugd/ifplugd.conf.

Note:netctlpackageincludes netctl‐ifplugd@.service,otherwiseyoucanuse ifplugd@.service from

ifplugd@eth0.service.

BondingorLAG

IPaddressaliasing

IPaliasingistheprocessofaddingmorethanoneIPaddresstoanetworkinterface.Withthis,onenodeona

networkcanhavemultipleconnectionstoanetwork,eachservingadifferentpurpose.Typicalusesare

virtualhostingofWebandFTPservers,orreorganizingserverswithouthavingtoupdateanyothermachines

(thisisespeciallyusefulfornameservers).

Example

Preparetheconfiguration:

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

Thensimplyexecute:

$ netctl start mynetwork

execute

$ ip addr add 192.168.1.10/24 dev enp1s0 label enp1s0:1

Toremovegivenaliasexecute

$ ip addr del 192.168.1.10/24 dev enp1s0:1

ChangeMAC/hardwareaddress

Internetsharing

Routerconfiguration

SeeRouter.

Localnetworkhostnameresolution

Thepre­requisiteisto#Setthehostnameafterwhichhostnameresolutionworksonthelocalsystemitself:

64 bytes from myhostname (192.168.1.2): icmp_seq=1 ttl=64 time=0.043 ms

Toenableothermachinestoaddressthehostbyname,eitheramanualconfigurationoftherespective /etc/hosts filesoraservicetopropagate/resolvethenameisrequired.Withsystemdthelatterisdonevia the myhostname nssmodule.However,notallnetworkservices(onthesamesystem;examples:[1]

hostname.

Afirstwork­aroundthatcanbetriedistoaddthefollowinglineto /etc/hosts:

127.0.1.1 myhostname.localdomain myhostname

Asaresultthesystemresolvestobothentries:

$ getent hosts

127.0.0.1

localhost

127.0.1.1

myhostname.localdomain myhostname

ForasystemwithapermanentIPaddress,thatpermanentIPaddressshouldbeusedinsteadof 127.0.1.1.

AnotherpossibilityistosetupafullDNSserversuchasBINDorUnbound,butthatisoverkillandtoo

complexformostsystems.Forsmallnetworksanddynamicflexibilitywithhostsjoiningandleavingthe

networkzero­configurationnetworkingservicesmaybemoreapplicable.Therearetwooptionsavailable:

ComputersrunningWindows,OSX,orLinuxwith nmbd running,willbeabletofindyourmachine.

Avahiprovideshostnameresolutionviazeroconf,alsoknownasAvahiorBonjour.Itrequiresslightly

morecomplexconfigurationthanSamba:seeAvahi#Hostnameresolutionfordetails.Computers

runningOSX,orLinuxwithanAvahidaemonrunning,willbeabletofindyourmachine.Windows

doesnothaveanbuilt­inAvahiclientordaemon.

Promiscuousmode

Togglingpromiscuousmodewillmakea(wireless)NICforwardalltrafficitreceivestotheOSforfurther

processing.Thisisoppositeto"normalmode"whereaNICwilldropframesitisnotintendedtoreceive.Itis

mostoftenusedforadvancednetworktroubleshootingandpacketsniffing.

/etc/systemd/system/promiscuous@.service [Unit] Description=Set %i interface in promiscuous mode After=network.target
/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

Ifyouwanttoenablepromiscuousmodeoninterface eth0 runenable promiscuous@eth0.service.

Troubleshooting

Swappingcomputersonthecablemodem

SomecableISPs(videotronforexample)havethecablemodemconfiguredtorecognizeonlyoneclientPC,

bytheMACaddressofitsnetworkinterface.OncethecablemodemhaslearnedtheMACaddressofthefirst

PCorequipmentthattalkstoit,itwillnotrespondtoanotherMACaddressinanyway.Thusifyouswap

onePCforanother(orforarouter),thenewPC(orrouter)willnotworkwiththecablemodem,becausethe

newPC(orrouter)hasaMACaddressdifferentfromtheoldone.Toresetthecablemodemsothatitwill

recognisethenewPC,youmustpowerthecablemodemoffandonagain.Oncethecablemodemhas

rebootedandgonefullyonlineagain(indicatorlightssettleddown),rebootthenewlyconnectedPCsothatit

makesaDHCPrequest,ormanuallymakeitrequestanewDHCPlease.

Ifthismethoddoesnotwork,youwillneedtoclonetheMACaddressoftheoriginalmachine.Seealso

#ChangeMAC/hardwareaddress.

TheTCPwindowscalingproblem

TCPpacketscontaina"window"valueintheirheadersindicatinghowmuchdatatheotherhostmaysendin

return.Thisvalueisrepresentedwithonly16bits,hencethewindowsizeisatmost64Kb.TCPpacketsare

cachedforawhile(theyhavetobereordered),andasmemoryis(orusedtobe)limited,onehostcouldeasily

runoutofit.

"window"value,providedinallpackets,willbemodifiedbyaScaleFactordefinedonce,atthevery

beginningoftheconnection.That8­bitScaleFactorallowstheWindowtobeupto32timeshigherthanthe

initial64Kb.

ItappearsthatsomebrokenroutersandfirewallsontheInternetarerewritingtheScaleFactorto0which

causesmisunderstandingsbetweenhosts.TheLinuxkernel2.6.17introducedanewcalculationscheme

generatinghigherScaleFactors,virtuallymakingtheaftermathsofthebrokenroutersandfirewallsmore

visible.

Theresultingconnectionisatbestverysloworbroken.

Howtodiagnosetheproblem

Firstofall,let'smakeitclear:thisproblemisodd.Insomecases,youwillnotbeabletouseTCP connections(HTTP,FTP, )atallandinothers,youwillbeabletocommunicatewithsomehosts(very few).

Whenyouhavethisproblem,the dmesg'soutputisOK,logsarecleanand ip addr willreportnormal status andactuallyeverythingappearsnormal.

Ifyoucannotbrowseanywebsite,butyoucanpingsomerandomhosts,chancesaregreatthatyou're

experiencingthisproblem:pingusesICMPandisnotaffectedbyTCPproblems.

YoucantrytouseWireshark.YoumightseesuccessfulUDPandICMPcommunicationsbutunsuccessful

TCPcommunications(onlytoforeignhosts).

Waysoffixingit

Bad

Tofixitthebadway,youcanchangethe tcp_rmem value,onwhichScaleFactorcalculationisbased. Althoughitshouldworkformosthosts,itisnotguaranteed,especiallyforverydistantones.

#

echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem

Good

SimplydisableWindowScaling.SinceWindowScalingisaniceTCPfeature,itmaybeuncomfortableto

disableit,especiallyifyoucannotfixthebrokenrouter.ThereareseveralwaystodisableWindowScaling,

anditseemsthatthemostbulletproofway(whichwillworkwithmostkernels)istoaddthefollowinglineto

/etc/sysctl.d/99‐disable_window_scaling.conf (seealsosysctl):

net.ipv4.tcp_window_scaling = 0

Best

Thisproblemiscausedbybrokenrouters/firewalls,solet'schangethem.Someusershavereportedthatthe

brokenrouterwastheirveryownDSLrouter.

Moreaboutit

TherearealsoseveralrelevantthreadsontheLKML.

Realteknolink/WOLproblem

UserswithRealtek8168816981018111(C)basedNICs(cards/andon­board)maynoticeaproblemwhere

theNICseemstobedisabledonbootandhasnoLinklight.Thiscanusuallybefoundonadualbootsystem whereWindowsisalsoinstalled.ItseemsthatusingtheofficalRealtekdrivers(datedanythingafterMay

2007)underWindowsisthecause.ThesenewerdriversdisabletheWake­On­LANfeaturebydisablingthe

NICatWindowsshutdowntime,whereitwillremaindisableduntilthenexttimeWindowsboots.Youwill

beabletonoticeifthisproblemisaffectingyouiftheLinklightremainsoffuntilWindowsbootsup;during

WindowsshutdowntheLinklightwillswitchoff.Normaloperationshouldbethatthelinklightisalwayson

aslongasthesystemison,evenduringPOST.Thisproblemwillalsoaffectotheroperatingsystemswithout

newerdrivers(eg.LiveCDs).Hereareafewfixesforthisproblem.

Method1:enabletheNICdirectlyinLinux

GettheethernetNICnamefromtheoutputof:

$ ip a

BringupthedeviceasrootusingtheNICname:

# ip link set dev enp7s0 up

Ifitworkedandthecardispoweredon,youshouldsee state UP forthegiveninterfaceintheoutputof

ip link.

Method2:rollback/changeWindowsdriver

YoucanrollbackyourWindowsNICdrivertotheMicrosoftprovidedone(ifavailable),orrollback/install

anofficialRealtekdriverpre­datingMay2007(maybeontheCDthatcamewithyourhardware).

Method3:enableWOLinWindowsdriver

ProbablythebestandthefastestfixistochangethissettingintheWindowsdriver.Thiswayitshouldbe

fixedsystem­wideandnotonlyunderArch(eg.liveCDs,otheroperatingsystems).InWindows,under

DeviceManager,findyourRealteknetworkadapteranddouble­clickit.Underthe"Advanced"tab,change

"Wake­on­LANaftershutdown"to"Enable".

InWindowsXP(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:NewerRealtekWindowsdrivers(testedwithRealtek8111/8169LANDriverv5.708.1030.2008,

dated2009/01/22,availablefromGIGABYTE)mayrefertothisoptionslightlydifferently,likeShutdown

Wake­On­LAN­­>Enable.Itseemsthatswitchingitto Disable hasnoeffect(youwillnoticetheLink lightstillturnsoffuponWindowsshutdown).OneratherdirtyworkaroundistoboottoWindowsandjust resetthesystem(performanungracefulrestart/shutdown)thusnotgivingtheWindowsdriverachanceto disableLAN.TheLinklightwillremainonandtheLANadapterwillremainaccessibleafterPOST­that isuntilyoubootbacktoWindowsandshutitdownproperlyagain.

Method4:newerRealtekLinuxdriver

AnynewerdriverfortheseRealtekcardscanbefoundforLinuxontherealteksite(untestedbutbelievedto

alsosolvetheproblem).

Method5:enableLANBootROMinBIOS/CMOS

ItappearsthatsettingIntegratedPeripherals­­>OnboardLANBootROM­­>EnabledinBIOS/CMOS

reactivatestheRealtekLANchiponsystemboot­up,despitetheWindowsdriverdisablingitonOS

shutdown.

Note:ThiswastestedseveraltimesonaGIGABYTEGA­G31M­ES2Lmotherboard,BIOSversionF8

releasedon2009/02/05.

NointerfacewithAtheroschipsets

UsersofsomeAtherosethernetchipsarereportingitdoesnotworkout­of­the­box(withinstallationmediaof

BroadcomBCM57780

ThisBroadcomchipsetsometimesdoesnotbehavewellunlessyouspecifytheorderofthemodulestobe loaded.Themodulesare broadcom and tg3,theformerneedingtobeloadedfirst.

Thesestepsshouldhelpifyourcomputerhasthischipset:

FindyourNICinlspcioutput:

$ lspci | grep Ethernet 02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)

Ifyourwirednetworkingisnotfunctioninginsomewayoranother,tryunpluggingyourcablethen

doingthefollowing:

# modprobe ‐r tg3

# modprobe broadcom

# modprobe tg3

Plugyounetworkcablein.Ifthissolvesyourproblemsyoucanmakethispermanentbyadding

broadcom and tg3 (inthisorder)tothe MODULES arrayin /etc/mkinitcpio.conf:

MODULES="

broadcom tg3

"

/etc/mkinitcpio.conf : MODULES=" broadcom tg3 " Rebuildtheinitramfs: # mkinitcpio ‐p linux

Rebuildtheinitramfs:

# mkinitcpio ‐p linux

Alternatively,youcancreatean /etc/modprobe.d/broadcom.conf:

softdep tg3 pre: broadcom

Note:Thesemethodsmayworkforotherchipsets,suchasBCM57760.

RealtekRTL8111/8168B

# lspci | grep Ethernet 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express
# lspci | grep Ethernet
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev Theadaptershouldberecognizedbythe r8169

Theadaptershouldberecognizedbythe r8169 module.However,withsomechiprevisionstheconnection

maygooffandonallthetime.Thealternativer8168 (https://www.archlinux.org/packages/?name=r8168)

canbefoundintheofficialrepositoriesandshouldbeusedforareliableconnectioninthiscase.Blacklist

addittoyourlistofuserspecifiedmodules.

Thispagewaslastmodifiedon25June2015,at06:30.

ContentisavailableunderGNUFreeDocumentationLicense1.3orlaterunlessotherwisenoted.