Showing posts with label vpn. Show all posts
Showing posts with label vpn. Show all posts

Thursday, June 2, 2011

Accessing Remote Resources or LAN via PPTP VPN in Ubuntu

I have a problem where I can establish a connection to my VPN server but cant access remote resources or my LAN except for the VPN server.

To solve this issue assuming you can already connect to your VPN:

$> cat /proc/sys/net/ipv4/ip_forward
If the commmand returns 0 then:

$> sudo bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
$> cat /proc/sys/net/ipv4/ip_forward
Should return 1 now.

* To make it permanent edit:
/etc/sysctl.conf and uncomment the line: net.ipv4.ip_forward=1

Props to: http://bizante.com/2010/01/pptp-vpn-server-on-ubuntu-using-webmin/
for the fix but that alone didn't do for me, I need to configure the IP routing for PPTP.

Continuing...You need to configure your PPTP settings:
$> sudo vim /etc/pptpd.conf

Edit from the recommended:
localip 192.168.0.234-238,192.168.0.245 
remoteip 192.168.1.234-238,192.168.1.245

To:
localip 192.168.1.100
remoteip 192.168.1.234-238,192.168.1.245


NOTES:
My LAN's subnet mask is 255.255.255.0 from 192.168.1.1. The PPTP local server's (192.168.1.100) subnet will be 255.255.255.255 and the remote IPs will start from 192.168.1.234 which is also 255.255.255.255 according to my configurations. I do not know how to change the subnet for the VPN so it would be nice to learn that. I tried prepending the subnet as a CIDR notation like 192.169.1.100/24 but doesnt seem to work.

In any case, by changing from 192.168.0.100(default) to 192.168.1.100 (notice the "1") the local LAN being requested from the client VPN should forward now. I chose a high number 100 to avoid collision with my LAN so just be aware of that if you have tons of computer connecting to your network!


This may not work for others but it worked for me so just my 1 cent.