4

At home I have two machines, one linux and one Win 7. The Win 7 box is connected to my work PPTP VPN. Is it possible for the linux box to connect through the windows one to the VPN?

They are both behind a router, so the VPN server only sees one IP address, and PPTP apparently only allows one connection per ip address.

1
  • Tell your Windows box to act as NAT, and tell your Linux box to use the Windows box as a gateway. Either run a DHCP server on the Windows box or use a static IP on the Linux box. I think “professional” enough versions or Windows can do this, but I don't know how. Feb 10, 2011 at 0:59

1 Answer 1

3

Yes, this is possible.

First you need to share the PPTP connection. Right-click on the PPTP connection in the Networking pop-up panel and select Properties. Go to the sharing tab and turn on Allow other network users to connect through this computer's Internet connection

PPTP Sharing Options - Windows 7

Make sure you select the correct Home networking connection for the network adaptor you use to connect to the router.

Secondly you need to route your network traffic from the Linux box through the Windows PC. How you would do that for your version of Linux is beyond the scope of this answer, but the generic command line to do it temporarily would be:

(as root)
# route delete -net default
# route add -net default gw <ip of the windows machine>

All the traffic destined for the internet from the Linux machine will now pass through the PC and down the VPN.

To undo this repeat as above replacing the IP address of the windows machine with the IP address of the router.

If you don't want all the traffic to go down the VPN but only traffic that is destined for the remote network at the other end of the VPN you can use this instead:

(as root)
# route add -net <network range of remote>/<netmask for remote> gw <ip of windows pc>
(for example)
# route add -net 10.1.1.0/24 gw 192.168.1.7

That should then split the traffic from the Linux box - anything destined for (for example) 10.1.1.0 to 10.1.1.255 will be passed on to the PC for forwarding through the VPN. Everything else will continue to go through the router to the internet.

1
  • this has to be the best answer i have found on the internet, unfortunatelly, vpn disconnects as soon i shared the connection :( Aug 18, 2021 at 21:03

You must log in to answer this question.