3

I have a desktop linux (Ubuntu based 12.10, laptop, 1 network card) from which I connect to work vpn via standard pptp, so I can access local network and work network from the machine. On the desktop I have Windows Server 2008 VirtualBox machine with bridged network adapter, so it gets ip from local router. Desktop and virtual see each other without problems. Desktop see vpn subnet ok, but virtual does not of course.

Is there a way to provide access to work network to other machines on local lan (mainly my virtual)?

I tried something like adding route (in virtual) to work subnet to go through my desktop ip, but I don't know how to setup the router service on desktop (and create route to my vpn connection).

2 Answers 2

1

You need to follow these steps:

  1. Add route to any LAN host which you want to connect to work network. Firstly, add route to virtual machine. The gateway for work network is your laptop's IP.
  2. Enable forwarding on the laptop. echo 1 > /proc/sys/net/ipv4/ip_forward and uncomment net.ipv4.ip_forward = 1 in /etc/sysctl.conf to make this parameter enabled across reboots.
  3. Since your LAN hosts have no address on VPN, you might want to masquerade their IP with your laptop's VPN IP. iptables -t nat -A POSTROUTING -o tunX -j MASQUERADE, tunX is your virtual tunnel interface.
1
  • Works! I didn't know forwarding is so easy :) Thanks! Commented Mar 16, 2013 at 13:40
0

Easiest would be setup virtual to use NAT. In VirtualBox it is a click away. It should take care of most of the stuff outlined in slimsuperhero's answer. For my money, I'd rather offload the vpn to my ADSL router, setup NAT there and solve it thusly.

1
  • Works as well! This is probably the easiest way. However for some reason I cannot remember now I wanted my virtual to have lan address, so it's reachable from other lan machines. Thanks anyway! Commented Mar 16, 2013 at 13:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.