https://wiki.archlinux.org/api.php?action=feedcontributions&user=Ju1ce&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:10:15ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Talk:PPTP_Client&diff=177682Talk:PPTP Client2012-01-10T16:51:41Z<p>Ju1ce: </p>
<hr />
<div>* The poff fix did not work out of the box on x86_64 as of Jan 10, 2012; I replaced it with an earlier version of the same fix which works. --[[User:Ju1ce|Ju1ce]] 11:51, 10 January 2012 (EST)<br />
<br />
* I've rewritten this article to make it more clear and usable. --[[User:Losl|Losl]] 15:14, 25 April 2011 (EDT)<br />
<br />
* I feel that this page should be renamed to "PPTP VPN client setup with pptpclient". See the [http://www.schneier.com/pptp-faq.html PPTP FAQ from Bruce Schneier] for the reason why. tl;dr: Schneier states that PPTP and Microsoft's implementation of PPTP are two different things. [[User:Jstjohn|Jstjohn]] 22:14, 1 October 2011 (EDT)</div>Ju1cehttps://wiki.archlinux.org/index.php?title=PPTP_Client&diff=177679PPTP Client2012-01-10T16:47:20Z<p>Ju1ce: updated the poff fix http://www.spinics.net/lists/linux-ppp/msg01149.html</p>
<hr />
<div>[[Category:Virtual Private Network (English)]]<br />
{{i18n|Microsoft_VPN_client_setup_with_pptpclient}}<br />
<br />
pptpclient is a program implementing the Microsoft PPTP protocol. As such, it can be used to connect to a Microsoft VPN network (or any PPTP-based VPN) provided by a school or workplace.<br />
<br />
== Installing PPTP Client ==<br />
<br />
PPTP Client is provided by the {{Pkg|pptpclient}} package found in the [[Official Repositories|official repositories]].<br />
<br />
== Configure ==<br />
<br />
To configure pptpclient you will need to collect the following information from your network administrator:<br />
<br />
* The IP address or hostname of the VPN server<br />
* The name you wish to use for the tunnel.<br />
* The authentication (Windows) domain name. This is not provided or needed for certain networks.<br />
* The username you will use to connect.<br />
* The password you will use to connect.<br />
<br />
=== Edit The options.pptp File ===<br />
<br />
With your favorite text editor open {{ic|/etc/ppp/options.pptp}}. This file enables a lot of security for your VPN connection by default. If you have trouble connecting to your network, you can relax the options down. At a minimum, your {{ic|/etc/ppp/options.pptp}} file should contain:<br />
lock<br />
noauth<br />
nobsdcomp<br />
nodeflate<br />
<br />
=== Edit The chap-secrets File ===<br />
<br />
Next, open or create the {{ic|/etc/ppp/chap-secrets}} file. We will be storing your password in this file, so make sure that the permissions are set such that no-one besides root can read this file. <br />
chmod 0600 /etc/ppp/chap-secrets<br />
<br />
The file should have the following format:<br />
<DOMAIN>\\<USERNAME> PPTP <PASSWORD> *<br />
<br />
Or, if your connection does not require a domain:<br />
<USERNAME> PPTP <PASSWORD> *<br />
<br />
Simply replace each bracketed term in the examples with the appropriate value.<br />
<br />
{{Note|If your password contains a special character such as {{ic|$}} you should place the password in double quotation marks ({{ic|"}}).}}<br />
<br />
=== Name Your Tunnel ===<br />
<br />
With your favorite text editor create a {{ic|/etc/ppp/peers/<TUNNEL>}} file, where {{ic|<TUNNEL>}} is the name you wish to use for your VPN connection. The file should look like this:<br />
pty "pptp <SERVER> --nolaunchpppd"<br />
name <DOMAIN>\\<USERNAME><br />
remotename PPTP<br />
require-mppe-128<br />
file /etc/ppp/options.pptp<br />
ipparam <TUNNEL><br />
<br />
{{Note|As before, if your connection does not require a domain, omit {{ic|<DOMAIN>\\}} from the file you create}}<br />
<br />
{{Note|{{ic|remotename PPTP}} is used to find {{ic|<PASSWORD>}} in the {{ic|/etc/ppp/chap-secrets}} File.}}<br />
<br />
{{ic|<SERVER>}} is the remote address of the VPN server, {{ic|<DOMAIN>}} is the domain your user belongs to, {{ic|<USERNAME>}} is the name you will use to connect to the server, and {{ic|<TUNNEL>}} is the name of the connection.<br />
<br />
{{Note|If you do not need MPPE support, you should remove the {{ic|require-mppe-128}} option from this file and from {{ic|/etc/ppp/options.pptp}}}}<br />
<br />
== Making Your Connection ==<br />
<br />
To make sure that everything is configured properly, as root execute:<br />
# pon $TUNNEL debug dump logfd 2 nodetach<br />
<br />
If everything has been configured correctly, the {{ic|pon}} command should not terminate. Once you are satisfied that it has connected successfully, you can terminate the command.<br />
<br />
{{Note|As an additional verification you can run {{ic|ip addr show}} and ensure that a new device, {{ic|ppp0}}, is available.}}<br />
<br />
To connect to your VPN normally, simply execute:<br />
# pon <TUNNEL><br />
<br />
Where {{ic|<TUNNEL>}} is the name of the tunnel you established earlier. Note that this command should be run as root.<br />
<br />
=== Routing ===<br />
<br />
Once you have connected to your VPN, you should be able to interact with anything available on the VPN server. To access anything on the remote network, you need to add a new route to your routing table.<br />
<br />
{{Note|Depending on your configuration, you may need to re-add the routing information every time you connect to your VPN.}}<br />
<br />
For more information on how to add routes, you can read this article which has many more examples: [http://pptpclient.sourceforge.net/routing.phtml PPTP Routing Howto]<br />
<br />
==== Split Tunneling ====<br />
<br />
Packets with a destination of your VPN's network should be routed through the VPN interface (usually {{ic|ppp0}}). To do this, you create the route:<br />
# ip route add 192.168.10.0/24 dev ppp0<br />
<br />
This will route all the traffic with a destination of 192.168.10.* through your VPN's interface, ({{ic|ppp0}}).<br />
<br />
==== Route All Traffic ====<br />
<br />
It may be desirable to route ''all'' traffic through your VPN connection. You can do this by running:<br />
# ip route add default dev ppp0<br />
<br />
{{Note|Routing all traffic through the VPN may result in slower over all connection speed because your traffic will be routed through the remote VPN before being routed normally.}}<br />
<br />
==== Route All Traffic by /etc/ppp/ip-up.d ====<br />
<br />
{{Note|All scripts in {{ic|/etc/ppp/ip-up.d/}} will called when the VPN connection is established.}}<br />
<br />
{{hc|/etc/ppp/ip-up.d/01-routes.sh|<nowiki><br />
#!/bin/bash<br />
<br />
# This script is called with the following arguments:<br />
# Arg Name<br />
# $1 Interface name<br />
# $2 The tty<br />
# $3 The link speed<br />
# $4 Local IP number<br />
# $5 Peer IP number<br />
# $6 Optional ``ipparam'' value foo<br />
<br />
route add default gw $4<br />
</nowiki>}}<br />
<br />
{{Note|This script currently uses {{Pkg|net-tools}} instead of {{Pkg|iproute2}} which the other examples use.}}<br />
<br />
== Disconnecting ==<br />
<br />
To disconnect from your VPN simply execute:<br />
<br />
# poff <TUNNEL><br />
<br />
Where <TUNNEL> is the name of your connection.<br />
<br />
== Making A VPN Daemon and Connecting On Boot==<br />
<br />
You can create a simple daemon for your VPN connection by creating an appropriate {{ic|/etc/rc.d/*}} script:<br />
<br />
{{Note|As always, {{ic|<TUNNEL>}} is the name of your tunnel. {{ic|<ROUTING COMMAND>}} is the command you use to add the appropriate route to the routing table.}}<br />
<br />
{{Note|1=The ''stop'' functionality of this script '''will not work''' if the {{ic|updetach}} and {{ic|persist}} arguments are passed to {{ic|/usr/bin/pon}} when pon is started. The reason for this is that the {{ic|/usr/bin/poff}} script contains a bug when determining the PID of the specified {{ic|pppd}} process if arguments were passed to {{ic|pon}}.<br />
<br />
To resolve this issue, you can patch your {{ic|/usr/bin/poff}} file by making the following changes on line 93:<br />
{{bc|<nowiki>-PID=`ps axw | grep "[ /]pppd call $1 *\$" | awk '{print $1}'`<br />
+PID=`ps axw | grep "[ /]pppd call $1" | awk '{print $1}'`</nowiki>}}}}<br />
<br />
{{hc|/etc/rc.d/name-of-your-vpn|<nowiki><br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
DAEMON=<TUNNEL>-vpn<br />
ARGS=<br />
<br />
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON<br />
<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting $DAEMON"<br />
pon <TUNNEL> updetach persist &>/dev/null && <ROUTING COMMAND> &>/dev/null<br />
if [ $? = 0 ]; then<br />
add_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping $DAEMON"<br />
poff <TUNNEL> &>/dev/null<br />
if [ $? = 0 ]; then<br />
rm_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
</nowiki>}}<br />
<br />
{{Note|We call {{ic|pon}} in the script with two additional arguments: {{ic|updetach}} and {{ic|persist}}. The argument {{ic|updetach}} makes pon block until the connection has been established. The other argument, {{ic|persist}}, makes the network automatically reconnect in the event of a failure. To connect at boot add @<TUNNEL>-vpn to the end of your {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}.}}<br />
<br />
== Remarks ==<br />
<br />
You can find more information about configuring pptpclient at their website: [http://pptpclient.sourceforge.net/ pptpclient website]. The contents of this article where adapted from their Ubuntu How-To which also provides some hints on how to do things such as connecting on boot. These examples should be easy to adapt into daemons or other scripts to help automate your configuration.</div>Ju1cehttps://wiki.archlinux.org/index.php?title=Network_configuration&diff=162445Network configuration2011-09-26T10:45:33Z<p>Ju1ce: Will not work without quotes around interface=eth0. Spend an hour figuring that out...</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:Getting and installing Arch (English)]]<br />
{{i18n|Configuring Network}}<br />
{{Article summary start}}<br />
{{Article summary text|A simple guide for setting up and troubleshooting network.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Networking overview}}}}<br />
{{Article summary end}}<br />
<br />
==Check first==<br />
Many times, the basic installation procedure has created a working network configuration. To check if this is so, use the following command:<br />
{{command| ping -c 3 www.google.com|<nowiki><br />
PING www.l.google.com (74.125.224.146) 56(84) bytes of data.<br />
64 bytes from 74.125.224.146: icmp_req=1 ttl=50 time=437 ms<br />
64 bytes from 74.125.224.146: icmp_req=2 ttl=50 time=385 ms<br />
64 bytes from 74.125.224.146: icmp_req=3 ttl=50 time=298 ms<br />
<br />
--- www.l.google.com ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 1999ms<br />
rtt min/avg/max/mdev = 298.107/373.642/437.202/57.415 ms<br />
</nowiki>|prompt=$}}<br />
{{Tip| The {{codeline|-c 3}} options instruct {{codeline|ping}} to do so three times. See {{codeline|man ping}} for more information.}}<br />
<br />
If it works, then you may only wish to personalize your settings from the options below.<br />
<br />
==Set the hostname==<br />
A hostname is a unique name created to identify a machine on a network. With Arch Linux, a machine's hostname is set in {{Filename|/etc/[[rc.conf]]}} or until a restart using the ''hostname'' command.<br />
Hostnames are restricted to alphanumeric characters. The dash ({{Codeline|-}}) can be used but a hostname cannot start or end with it. Length is restricted to 63 characters.<br />
<br />
Edit {{Filename|/etc/rc.conf}} and set HOSTNAME (archlinux in this example):<br />
HOSTNAME="archlinux"<br />
<br />
After setting a hostname, it is also a good idea to include the same name in {{Filename|/etc/hosts}}. This will help processes that refer to the computer by its hostname to find its IP.<br />
<br />
Edit {{Filename|/etc/hosts}} and add the same HOSTNAME you entered in {{Filename|/etc/rc.conf}}:<br />
127.0.0.1 archlinux.domain.org localhost.localdomain localhost archlinux<br />
<br />
To set the hostname temporarily (until the next reboot) use the {{codeline|hostname}} command as root:<br />
{{cli|# hostname archlinux}}<br />
<br />
==Load the device module==<br />
Udev should detect your network card (NIC) module and load it automatically at startup. If it does, skip this section. Otherwise, you will need to know which module is needed for your particular model:<br />
{{cli|# hwdetect --show-net}}<br />
<br />
Once you recognize which module to use, you can load it with:<br />
{{cli|# modprobe ''<modulename>''}}<br />
<br />
If [[udev]] is not detecting and loading the proper module automatically during bootup, you can add it into the '''MODULES=''' array in {{codeline|/etc/rc.conf}}, so you do not need to "modprobe" it everytime you boot. For example, if tg3 is the network module:<br />
MODULES=(... !usbserial tg3 snd-cmipci ...)<br />
<br />
Other common modules are 8139too for cards with the Realtek chipset or sis900 for SiS cards.<br />
<br />
==Configure IP==<br />
It is important to realize that you may have a dynamically-assigned address using DHCP, or an unchanging and set "static" address.<br />
{{Note|For motherboards that have integrated NICs it is important to know which one is considered the primary (i.e. eth0) and which is considered the secondary (i.e. eth1) NIC. Many configuration issues are caused by users incorrectly configuring eth0 in their /etc/rc.conf when in fact, they have their eth1 plugged into the LAN!}}<br />
<br />
===For DHCP IP===<br />
For this option, you need the '''dhcpcd''' package (already available on most installations). To make use of it, edit {{filename|/etc/rc.conf}} like this:<br />
<br />
interface="eth0"<br />
address=<br />
netmask=<br />
gateway=<br />
<br />
Only the interface has to be defined, as leaving the other options blank will set network to DHCP.<br />
<br />
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 {{filename|/etc/dhcpcd.conf}}:<br />
nohook resolv.conf<br />
<br />
Then add your own DNS nameserver to {{filename|/etc/resolv.conf}}.<br />
<br />
Make sure to test your new settings by stopping and starting the {{filename|/etc/rc.d/network}} daemon, as opposed to bringing down your interface and starting dhcp manually. To restart the network daemon: <br />
{{cli|# /etc/rc.d/network restart}}<br />
<br />
You may use the {{Package Official|openresolv}} package if several different processes want to control resolv.conf (i.e. dhcpcd and VPN client). No additional configuration for dhcpcd is needed to use openresolv.<br />
<br />
{{Note|1=It is possible to have a static ip using dhcpcd. Simply edit your {{filename|/etc/conf.d/dhcpcd}} file to look something like this (where x.x.x.x is your desired ip):<br />
<pre><br />
DHCPCD_ARGS="-q -s x.x.x.x"<br />
</pre>}}<br />
<br />
===For Static IP===<br />
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, and a particular type of security benefit. Also, 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.<br />
<br />
You need:<br />
* Your static IP address,<br />
* The netmask,<br />
* The broadcast address,<br />
* Your gateway,<br />
* Your nameservers' IP addresses,<br />
* Your domain name.<br />
<br />
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 {{filename|/etc/rc.conf}} like this, substituting your own values for the IP, netmask, broadcast, and gateway:<br />
<br />
interface=eth0<br />
address=192.168.0.2<br />
netmask=255.255.255.0<br />
gateway=192.168.22.1<br />
<br />
Edit your {{filename|/etc/resolv.conf}} like this, substituting your nameservers' IPs and your domain name:<br />
nameserver 61.23.173.5<br />
nameserver 61.95.849.8<br />
search example.com<br />
<br />
{{Note|Currently you may include a maximum of 3 nameserver lines.}}<br />
<br />
====Manual assignment====<br />
You can assign a static IP in console:<br />
{{cli|# ip addr add <ip>/<netmask> dev <interface>}}<br />
For example: {{cli|# ip addr add 192.168.1.2/24 dev eth0}}. For more options, see: {{codeline|man ip}}<br />
<br />
Add your gateway like so:<br />
{{cli|# ip route add default via <ip>}}<br />
(Substitute your own gateway IP)<br />
<br />
For example:<br />
{{cli|# ip route add default via 192.168.1.1}}<br />
<br />
==Load configuration==<br />
To test your settings either reboot the computer, or as root:<br />
{{cli|# /etc/rc.d/network restart}}<br />
<br />
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:<br />
{{cli|$ ping -c 3 www.google.com}}<br />
<br />
==Additional settings==<br />
<br />
===Enable/disable interface===<br />
You can activate or deactivate net interface:<br />
{{cli|# ip link set <interface> up/down}}<br />
<br />
===Firewall===<br />
You can install and configure a [[Firewalls|firewall]] to feel more secure.<br />
<br />
===Wireless Setup===<br />
See the [[Wireless Setup]] article for more information.<br />
<br />
===Laptops, 'ifplugd'===<br />
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.<br />
<br />
Installation is very simple since it is in [extra]:<br />
{{cli|# pacman -S ifplugd}}<br />
<br />
By default it is configured to work for {{codeline|eth0}} device. This and other settings like delays can be configured in {{filename|/etc/ifplugd/ifplugd.conf}}.<br />
<br />
[[Daemon#Performing daemon actions manually|Start the ifplugd daemon]] and add ifplugd to your [[Daemons#Starting on Boot|DAEMONS array]] so it starts automatically on boot.<br />
<br />
===Jumbo Frames===<br />
See the [[Jumbo Frames]] article for more information.<br />
<br />
===Bonding===<br />
You can install the {{codeline|ifenslave}} package to bind two real Ethernet cables with one IP address. After installation, you will need to edit each of the following files:<br />
<br />
{{filename|/etc/conf.d/bonding}}:<br />
bond_bond0="eth0 eth1"<br />
BOND_INTERFACES=(bond0)<br />
<br />
{{filename|/etc/modprobe.d/modprobe.conf}}:<br />
{{Note | The new {{codeline|module-init-tools}} 3.8 package changes the location of the configuration file: {{filename|/etc/modprobe.conf}} is no longer read, instead {{filename|/etc/modprobe.d/modprobe.conf}} is used. [http://www.archlinux.org/news/450/ link]}}<br />
options bonding miimon=100<br />
<br />
{{filename|/etc/rc.conf}}:<br />
MODULES=(... bonding ...)<br />
interface=bond0<br />
address=192.168.1.1<br />
netmask=255.255.255.0<br />
gateway=192.168.1.255<br />
<br />
To activate the new bonded ports, restart your network by:<br />
{{cli|# rc.d restart network}}<br />
<br />
===IP aliasing===<br />
{{Expansion}}<br />
If you want to use multiple IP adresses on an interface, you will have to use [[netcfg]] and its POST_UP and PRE_DOWN commands in your network profile to set up the additional IPs manually. See [https://bbs.archlinux.org/viewtopic.php?pid=951573#p951573 here] for details.<br />
<br />
====Example====<br />
You will need {{codeline|netcfg}}<br />
<br />
{{cli|# pacman -S netcfg}}<br />
<br />
Prepare configuration<br />
<br />
{{File<br />
|name=/etc/network.d/mynetwork<br />
|content=<nowiki><br />
<br />
# CONNECTION='ethernet'<br />
# DESCRIPTION='Five different addresses on the same NIC.'<br />
# INTERFACE='eth0'<br />
# IP='static'<br />
# ADDR='192.168.1.10'<br />
# GATEWAY='192.168.1.1'<br />
# DNS=('192.168.1.1')<br />
# DOMAIN=''<br />
# POST_UP='for i in 11 12 13 14 ; do ip addr add 192.168.1.$i/24 brd 192.168.1.255 dev eth0 ; done'<br />
# PRE_DOWN='for i in 11 12 13 14 ; do ip addr del 192.168.1.$i/24 dev eth0 ; done'<br />
<br />
</nowiki>}}<br />
<br />
{{File<br />
|name=/etc/rc.conf<br />
|content=<nowiki><br />
NETWORKS=(mynetwork)<br />
<br />
...<br />
<br />
DAEMONS=(... net-profiles ...)<br />
</nowiki>}}<br />
<br />
===Change MAC/hardware address===<br />
Changing your MAC address is not possible anymore via {{filename|/etc/rc.conf}}. See [[MAC Address Spoofing]] for details.<br />
<br />
==Troubleshooting==<br />
<br />
=== DHCP fails at boot ===<br />
First, check all the steps that the computer normally executes at boot in order to find out which one failed. <br />
These steps are:<br />
# Detect the network device and load its driver. <br />
# Bring up the interface. <br />
# Call {{codeline|dhcp}}<br />
<br />
====Step 1====<br />
Check the "Ethernet controller" entry in the output of {{codeline|lspci -v}}.<br />
It should tell you which kernel module contains the driver of your network device. For example:<br />
{{command|lspci -v|<nowiki><br />
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)<br />
...<br />
Kernel driver in use: atl1<br />
Kernel modules: atl1<br />
</nowiki>|prompt=$}}<br />
Next, check the the driver was loaded via ''dmesg | grep <module name>''. For example:<br />
$ dmesg |grep atl1<br />
...<br />
atl1 0000:02:00.0: eth0 link is up 100 Mbps full duplex<br />
<br />
====Step 2====<br />
Check the output of {{codeline|dmesg}} for the interface associated with your network device and bring it up via (as root) <br />
{{cli|# ip link set <interface> up}}<br />
<br />
Check the result with {{codeline|ip addr show dev eth0}}. For example:<br />
{{command|ip addr show dev eth0|<nowiki><br />
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc vboxnetflt state UP qlen 1000<br />
[...]<br />
</nowiki>|prompt=$}}<br />
<br />
====Step 3====<br />
To be on the safe side, start by releasing the lease of your interface with {{codeline|dhcpcd --release}}, then try to get a lease with {{codeline|dhcpcd}}. Refer to {{codeline| man dhcpcd}} for more information.<br />
<br />
If all goes well it will look like this:<br />
{{command|dhcpcd --release eth0|<nowiki><br />
dhcpcd: dhcpcd not running</nowiki>|prompt=#}}<br />
{{command|dhcpcd eth0|<nowiki><br />
dhcpcd: version 5.1.1 starting<br />
dhcpcd: eth0: broadcasting for a lease<br />
...<br />
dhcpcd: eth0: leased 192.168.1.70 for 86400 seconds<br />
</nowiki>|prompt=#}}<br />
<br />
And now {{codeline|ip addr show dev <interface>}} should show your inet address.<br />
<br />
Probably things will not work as described somewhere along these steps, or else the network would have started automatically at boot.<br />
<br />
If {{codeline|dhcp}} works using the steps above but not at boot, add the following to {{filename|/etc/rc.local}}:<br />
dhcpcd -k eth0 <br />
dhcpcd -nd eth0<br />
<br />
See http://bbs.archlinux.org/viewtopic.php?id=63940 for more information.<br />
<br />
For some people, the {{codeline|dhclient}} package (available in [extra]) works where {{codeline|dhcpcd}} fails.<br />
<br />
===Swapping computers on the cable modem===<br />
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.<br />
<br />
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]].<br />
<br />
===The TCP window scaling issue===<br />
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.<br />
<br />
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.<br />
<br />
That 8-bit Scale Factor allows the Window to be up to 32 times higher than the initial 64Kb.<br />
<br />
It appears that some broken routers and firewalls on the Internet are rewriting the Scale Factor to 0 which causes misunderstandings between hosts.<br />
<br />
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. <br />
<br />
The resulting connection is at best very slow or broken.<br />
<br />
====How to diagnose the problem====<br />
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).<br />
<br />
When you have this problem, the <code>dmesg</code>'s output is OK, logs are clean and <code>ip addr</code> will report normal status &mdash; and actually everything appears normal.<br />
<br />
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.<br />
<br />
You can try to use Wireshark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).<br />
<br />
====How to fix it (The bad way)====<br />
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.<br />
<br />
echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem<br />
<br />
====How to fix it (The good way)====<br />
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 {{Filename|/etc/sysctl.conf}} (see also [[sysctl]])<br />
<br />
net.ipv4.tcp_window_scaling = 0<br />
<br />
====How to fix it (The best way)====<br />
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.<br />
<br />
====More about it====<br />
This section is based on the LWN article [http://lwn.net/Articles/92727/ TCP window scaling and broken routers] and a Kernel Trap article: [http://kerneltrap.org/node/6723 Window Scaling on the Internet].<br />
<br />
There are also several relevant threads on the LKML.<br />
<br />
=== Interface names varying ===<br />
<br />
Your network cards are sometimes named differently between two reboot. Configuring your network connection is hard if you do not know if your card will be called {{Codeline|eth0}} or {{Codeline|eth1}}.<br />
<br />
It is possible to specify the module loading order in {{Filename|/etc/rc.conf}}, but of course this only works if the kernel does not include the drivers as built-in AND if different network cards are in use (i.e. rely on different drivers)<br />
# Always load 8139too before e100<br />
MODULES=(8139too e100)<br />
<br />
'''-OR-'''<br />
<br />
With {{Codeline|ifrename}}, see [[Rename network interfaces]]<br />
<br />
'''-OR-'''<br />
<br />
It is also possible to manually create udev rules that assign interface names based on the interface's MAC address.<br />
<br />
{{File|name=/etc/udev/rules.d/10-network.rules|content=<nowiki><br />
SUBSYSTEM=="net", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="lan0"<br />
SUBSYSTEM=="net", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="wlan0"<br />
</nowiki>}}<br />
<br />
For more information or the original udev guide on the last two methods, see the [[Udev]] wiki entry on this issue.<br />
<br />
[[Udev#Mixed Up Devices, Sound/Network Cards Changing Order Each Boot]]<br />
<br />
===Realtek no link / WOL issue===<br />
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:<br />
<br />
====Method 1 - Rollback/change Windows driver====<br />
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).<br />
<br />
====Method 2 - Enable WOL in Windows driver====<br />
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.<br />
In Windows XP (example)<br />
Right click my computer<br />
--> Hardware tab<br />
--> Device Manager<br />
--> Network Adapters<br />
--> "double click" Realtek ...<br />
--> Advanced tab<br />
--> Wake-On-Lan After Shutdown<br />
--> Enable<br />
<br />
{{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 {{Codeline|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.}}<br />
<br />
====Method 3 - Newer Realtek Linux driver====<br />
Any newer driver for these Realtek cards can be found for Linux on the realtek site. (untested but believed to also solve the problem).<br />
<br />
====Method 4 - Enable ''LAN Boot ROM'' in BIOS/CMOS====<br />
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.<br />
<br><small>This was tested successfully multiple times with GIGABYTE system board GA-G31M-ES2L with BIOS version F8 released on 2009/02/05. YMMV.</small><br />
<br />
===DLink G604T/DLink G502T DNS issue===<br />
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 1.0.0.0 and fail with a connection timed out error<br />
<br />
====How to diagnose the problem====<br />
The best way to diagnose the problem is to use 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 {{Codeline|links}} through the live CD.<br />
<br />
Firstly enable wget for pacman (since it gives us info about pacman when its downloading packages)<br />
Open {{Filename|/etc/pacman.conf}} with your favourite editor and uncomment the following line (remove the # if its there)<br />
<br />
XferCommand=/usr/bin/wget --passive-ftp -c -O %o %u<br />
<br />
While you are editing {{Filename|/etc/pacman.conf}}, check the default mirror that pacman uses to download packages.<br />
<br />
Now open up the default mirror in an Internet browser to see if the mirror actually works. If it does work, then do {{Codeline|pacman -Syy}} (otherwise pick another working mirror and set it to the pacman default). If you get something similar to the following (notice the 1.0.0.0),<br />
<nowiki>ftp://mirror.pacific.net.au/linux/archlinux/extra/os/i686/extra.db.tar.gz</nowiki> <br />
<nowiki>=> `/var/lib/pacman/community.db.tar.gz.part'</nowiki><br />
Resolving mirror.pacific.net.au... 1.0.0.0<br />
then you most likely have this problem. The 1.0.0.0 means its unable to resolve DNS, so we must add it to {{Filename|/etc/resolv.conf}}.<br />
<br />
====How to fix It====<br />
Basically what we need to do is to manually add the DNS to our {{Filename|/etc/resolv.conf}} file, The problem is that DHCP automatically deletes and replaces this file on boot, so we need to edit {{Filename|/etc/conf.d/dhcpcd}} and change the flags to stop DHCP doing this<br />
<br />
When you open up {{Filename|/etc/conf.d/dhcpcd}}, you should see something close to the following<br />
DHCPCD_ARGS="-t 30 -h $HOSTNAME"<br />
add the -R flag to the arguments, e.g.<br />
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"<br />
<br />
{{Note|1=If you are using dhcpcd >= 4.0.2 the -R flag has been deprecated. Please see the [[#For DHCP IP]] section for information on how to use a custom {{Filename|/etc/resolv.conf}} file.}}<br />
<br />
Save and close the file; now open {{Filename|/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 address into your browser and log in to your router. Go to the DNS section, and you should see an IP address in the Preferred DNS Server, copy it and paste it as a namespace ABOVE the current gateway one.<br />
<br />
E.g. a {{Filename|/etc/resolv.conf}} should look something along the lines of<br />
namespace 10.1.1.1<br />
<br />
If my Primary DNS Server is 211.29.132.12, then change {{Filename|/etc/resolv.conf}} to<br />
namespace 211.29.132.12<br />
namespace 10.1.1.1<br />
<br />
Now restart the network daemon by doing {{Codeline|/etc/rc.d/network restart}} and do {{Codeline|pacman -Syy}}. If it syncs correctly with the server, then the problem is solved.<br />
<br />
====More about it====<br />
This is the whirlpool forum (Australian ISP community) which talks about and gives the same solution to the problem<br />
http://forums.whirlpool.net.au/forum-replies-archive.cfm/461625.html<br />
<br />
===Get an IP from the wrong DHCP in linked (by VPN) router cases===<br />
In my case, I have a network where two routers are tied together through VPN. I have one router at my home, and one at a completely different place in the world. In some rare cases, it it appears that the router that is connected to me by VPN is assigning me an IP address. I don't know a way to prevent that process, but I do know a way to fix it. On a console, as root, try this:<br />
dhcpcd -k<br />
dhcpcd<br />
The first line releases your IP and the next line requests a new one. I had to run those two commands three 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 commands above.<br />
<br />
This even works when NetworkManager is installed.<br />
<br />
===Realtek 8111E loses lots of packets/dmesg is flooded with link messages===<br />
This issue currently plagues rev6 of the 8111. To check if you have this chip, check the output of the following:<br />
lspci | grep 8111<br />
<br />
If you see a line like the following:<br />
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)<br />
and dmesg has a bunch of this:<br />
r8169 0000:03:00.0: eth0: link up<br />
You are using a bad r8169 driver. To fix this, install the {{Codeline|r8168}} package from the AUR, blacklist the r8169 driver in {{Filename|/etc/modprobe.d/modprobe.conf}}, and reboot in order to fix the issue.<br />
Supposedly there is a fix for this in Linux 3.0<br />
<br />
Source: http://forums.gentoo.org/viewtopic-t-881217-start-0.html<br />
<br />
==Related==<br />
[[Samba]]</div>Ju1ce