I couldn’t think of a good title for this post :).

I work from home and I often have to connect to my workplace network.  I work from several different machines from within my home network and hate setting up VPN on each of these machines.

I recently setup a linux server/router at home.  To solve this problem I configured a VPN connection to my workplace on this machine by following the instructions here.  After playing around with my firewall settings and setting up the route so that all traffic destined for my workplace’s subnet is routed over the ppp interface, I was able to ping my workplace machines from the linux box.  I was, however, still not able to reach my work machine from other machines on my network.

To solve this problem I figured that I needed to NAT the address before sending the packet over to the workplace network.  This can be done very easily with iptables:

/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to 192.168.23.0

Here ppp0 is the PPP VPN Link interface and 192.168.23.0 is the workplace’s subnet.  Once I did this all of my machines on the network were able to ping and connect to my workplace machines, which is sweeeeet!! :)

I configured my VPN connection to start on boot and setup all these routing and firewall settings on startup. So I will now have a persistent connection to my workplace from home.  With some DNS settings I can now easily access my workplace from any computer in my home network.

HTH

/