I'm trying to connect a Linux (Ubuntu 10.04 LST) server to a VPN server via the PPTP client to an VPN server. I configured the PPTP client as said in the documentation. The connection is correctly added as an interface, but somehow the connection dose not work. ping -I ppp0 google.com dose not return anything and traceroute -i ppp0 only shows the first hop, and then displays nothing. Any ideas of what is going wrong? Incorrect routing configuration?

ifconfig output for the configured interface:

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:xx.x.xxx.xxx  P-t-P:  Mask:
          RX packets:415 errors:0 dropped:0 overruns:0 frame:0
          TX packets:468 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:31428 (31.4 KB)  TX bytes:32394 (32.3 KB)

route output

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xx.x.x.1        *      UH    0      0        0 ppp0
xx.xxx.xxx.xx   sp.ip  UGH   0      0        0 eth1     *        U     0      0        0 eth2     *        U     0      0        0 eth1
default         sp.ip          UG    100    0        0 eth1

You need to configure NAT IP-Masquerading with iptables on the remote server. Otherwise your client server can't access the internet via the vpn with a single IP address of the remote server.

in a nut shell:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

these two lines show how IP-Masquerading could be setup.

if you are not familiar with iptables, there are plenty tutorials for it on the internet.

FYI, tldp hosts a rather detailed instruction on setting up ip-masquerading. http://tldp.org/HOWTO/html_single/Masquerading-Simple-HOWTO/

| improve this answer | |
  • The VPN server is configured properly. I have some Windows and Mac clients connecting to it and they work fine. Could it be a problem with the iptables configuration on the the server I'm running the PPTP client on? – wowpatrick Jul 15 '12 at 17:31
  • @wowpatric can you ping the server via the vpn connection? – Huang Tao Jul 16 '12 at 1:13
  • No I can't. I added the output from ifconfig for the interface to the question, hope it helps. – wowpatrick Jul 16 '12 at 15:29
  • I still think it's a routing problem, so I added the output of route too! – wowpatrick Jul 16 '12 at 15:31

How can you ping something through ppp0, if you dont have a route for this.

First: Add the route to VPN server


(as i see $GATEWAY_TO_VPN_SERVER=sp.ip)

Second: Delete the default route for eth1

route del default dev eth1

Third: Add the default route for ppp0

route add default dev ppp0

And since this moment all packages will be routing through dev ppp0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.