开发者

VMWare fusion NAT + host tunnel; access from vm

开发者 https://www.devze.com 2023-01-20 13:35 出处:网络
I\'m having trouble accessing a port on my OSX host from a vm. I\'m using NAT in VMware fusion. In my (OSX host) hosts file, I have the ip address for vmnet8 mapped to \'mac\'.

I'm having trouble accessing a port on my OSX host from a vm.

I'm using NAT in VMware fusion. In my (OSX host) hosts file, I have the ip address for vmnet8 mapped to 'mac'.

From my vm, I can 'ssh user@mac' and it works as expected: I am logged into the host. So, my hosts file is working.

I have a tunnel from my OSX host to an Oracle server at work. I can use the tunnel (localhost:6004) 开发者_如何转开发from the host no problem. However if I try to use the name 'mac' instead of 'localhost' this does not work. As a result, I am not able to access the tunnel from the vm, either. (I can't use the localhost name from the vm, obviously).

Why isn't the tunnel accessible using 'mac', while ssh works fine?


Okay, I got things working the way I want - I think.

10.0.0.1 is mapped to 'mac' in /etc/hosts

sudo ifconfig lo0 add 10.0.0.1

sudo ipfw add fwd 127.0.0.1 tcp from any to 10.0.0.1

Not a networking expert, obviously, so I couldn't say exactly why this works and my first attempt didn't.

Anyway, it allows me to refer to the host os as 'mac' from my VMs, and in addition allows me to access any ssh tunnels on the host from within the VMs (e.g. mac:9004). In addition, by mapping my VM ip addresses in /etc/hosts (on the host), all VMs and the host seem to be able to communicate flawlessly by name.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号