Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:10.0.0.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
          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        *               255.255.255.255 UH    0      0        0 ppp0
xx.xxx.xxx.xx   sp.ip           255.255.255.255 UGH   0      0        0 eth1
192.168.3.0     *               255.255.255.0   U     0      0        0 eth2
192.168.2.0     *               255.255.255.0   U     0      0        0 eth1
default         sp.ip           0.0.0.0         UG    100    0        0 eth1
share|improve this question
add comment

2 Answers

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/

share|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
add comment

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

First: Add the route to VPN server

route add $VPN_SERVER_IP gw $GATEWAY_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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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