I recently bought a VPS, and wanted to set up a VPN with IP forwarding on it, both for resource sharing, and to DDoS protect a company’s windows VPS. I am not very experienced with networking on linux, but generally i can get by. However in this instance, i am a little stuck. When i connect to my pptpd server running on the VPS, the client never gets given a default gateway, and by extension has no internet access when using this connection as primary. I followed this https://help.ubuntu.com/community/PPTPServer precisely, just with the addition of the following lines in /etc/rc.local to fix a GRE and authentication bug. iptables -A INPUT -p gre -j ACCEPT iptables -A OUTPUT -p gre -j ACCEPT iptables -A INPUT -p tcp --sport 1723 -s 192.168.0.1 -j ACCEPT iptables -A OUTPUT -p tcp --dport 1723 -d 192.168.0.1 -j ACCEPT
Which means my rc.local has ONLY the following in it:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356 iptables -A INPUT -p gre -j ACCEPT iptables -A OUTPUT -p gre -j ACCEPT iptables -A INPUT -p tcp --sport 1723 -s 192.168.0.1 -j ACCEPT iptables -A OUTPUT -p tcp --dport 1723 -d 192.168.0.1 -j ACCEPT
In my pptpd.conf i have the following IP setup going on: localip 192.168.0.1-10 remoteip 192.168.0.100-254
I am wondering if the reason this is not working, is because this tut was meant for setups in a NAT environment, which is not the case here, and as a result i have managed to confuse the settings by interchanging the public IP of the server, for a (non existent) NAT one. This is reinforced by when i attempt to ping the servers public IP while connected with no gateway, i get a reply, but when i try and ping 192.168.0.1 there is no reply. Also, if i ping google, DNS resolution seems to work, as i get google's IP, however am unable to route to it, neither can i ping an external IP such as 184.108.40.206.
At first I thought this was a problem with the firewall/IPtables, and so I did apt-get remove iptables, and tried it again, and it still doesn’t work. I’ve also tried testing it on windows 7 clients at 2 different sites, to no avail.
This is the ifconfig of the server, so you can get an idea of how it's currently setup.
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:38 errors:0 dropped:0 overruns:0 frame:0 TX packets:38 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1900 (1.9 KB) TX bytes:1900 (1.9 KB)
ppp1 Link encap:point-to-Point Protocol inet addr:192.168.0.2 P-t-P:192.168.0.101 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1 RX packets:2005 errors:0 dropped:0 overruns:0 frame:0 TX packets:9 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:131227 (131.2 KB) TX bytes:120 (120.0 B)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:217729 errors:0 dropped:0 overruns:0 frame:0 TX packets:216833 errors:0 dropped:3145 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:15090022 (15.0 MB) TX bytes:13313493 (13.3 MB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:172.245.x.x P-t-P:172.245.x.x Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
The host of the VPS said they had to enable IPv4 forwarding as a module for the box for it to work, and I have had them do so and confirm.
I have put the x.x as the last 2 octets of the IP, just so i'm not pasting server public IP's all over the forum.
Anyone have any ideas as to why i cannot get a default gateway, and why the clients are unable to access the internet? Thanks