2
I am currently setting up a Mac at home. It has a static IP of 10.0.1.254.
This Mac has a VPN connection to my workplace via tunnelblick (192.168.1.x and 192.168.2.x). This Mac can also run a few of my VM's (192.168.170.x).
While on another laptop (also a Mac) on the same network (10.0.1.x), I want to be able to connect to my workplace and to VM via this Mac.
On my laptop, I first tried to setup a routing rule:
sudo route -v add 192.168.170.163 10.0.1.254
On the Mac, I tried to enable IP forwarding, and even bridging:
sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet6.ip6.forwarding=1
sudo sysctl -w net.link.ether.inet.proxyall=1
sudo ifconfig bridge0 create
sudo ifconfig bridge0 addm en0
sudo ifconfig bridge0 addm vmnet2
sudo ifconfig bridge0 up
However, when I tried to access the URL http://192.168.170.163:80/
from my laptop, I don't seem to be routed to the VM on the Mac.
The tunnelblick experiment was worse, as I can't add it to the bridged network.
I could workaround with the VMware Fusion's nat.conf
, or port forwarding via SSH, but prefer to avoid those as I want to preserve the IP address I am accessing via, and avoid too much configuration in /etc/hosts
.
Is there something wrong with my concept/understanding? Is this not a problem that is solved via bridged network and IP forwarding?
Update:
I have performed a workaround:
1. My Mac (10.0.1.254) hosts a Windows 2003 Std Edition Server VM (10.0.1.253) with Routing Service enabled.
2. The Routing Service Windows VM has two network interfaces, 10.0.1.253 and 192.168.170.253.
3. My other VMs (192.168.170.253) configure the default gateway as 192.168.170.253.
4. My laptop on the network 10.0.1.x performs static routing for from 192.168.170.x to 10.0.1.253.
Do you have administrative access to the vpn router? – GnP – 2014-02-16T15:10:40.723
Does the
route -v add 192.168.170.163 10.0.1.254
command work? I have no OS X here but I expected a different command which also used a netmask. (e.g.route -v add 192.168.170.163/32 10.0.1.254
or aroute add -host 192.168.170.163 10.0.1.254
). – Hennes – 2014-02-16T15:19:39.877Nope, i do not have admin access to vpn router, nor the computers on the vpn. If it is not technically possible, then I'm fine. I'm primarily interested more in the routing to the VMs. Changing VMs IP to use bridged mode is an option but I would want to avoid that as I move these VMs around and share with others, so having 192.168.170.x is the preferred IPs. – Kent Lai – 2014-02-17T05:50:23.297
Yes,
route -v add 192.168.170.163 10.0.1.254
works as I validate that it is routing properly via traceroute. – Kent Lai – 2014-02-17T05:51:16.410