Sunday, February 25, 2007

Getting around lame networking in VMWare Fusion

NOTE: Host only network now works in VMWare Fusion Beta 3

So I finally broke down and bought an Intel Mac on Friday (a black MacBook for what it is worth) largely because the lack of decent virtualization (and the small screen) on my 12" PowerBook G4. So the Parallels key request email bot (or whatever) is down so no Parallels Desktop yet, so I'm stuck with the VMWare Fusion Beta, which is a bit rough around the edges.

Among other things, I can't seem to figure out. Basically there are no virtual interfaces created on the host, although guest machines can use NAT and Bridged Mode. Host only isn't available through the GUI.

But the good new if you are using NAT within the guest machine you can connect to the host. So it took me a little while, but this means you can use SSH forwarding to

So within a pristine OpenBSD 4.0 Box:

# netstat -an | grep 22
tcp 0 0 172.16.71.130.43556 172.16.71.2.22 ESTABLISHED
tcp 0 0 *.22 *.* LISTEN
udp 0 0 172.16.71.130.37986 84.16.227.163.123
udp 0 0 172.16.71.130.10064 84.16.227.207.123
tcp6 0 48 ::1.22 ::1.13934 ESTABLISHED
tcp6 0 0 ::1.13934 ::1.22 ESTABLISHED
tcp6 0 0 ::1.22 ::1.22840 ESTABLISHED
tcp6 0 0 ::1.22840 ::1.22 ESTABLISHED
tcp6 0 0 *.22 *.* LISTENABLISHED

Now on my MacBook:
franz-macbook:~ mdfranz$ netstat -an | grep 22
tcp4 0 0 127.0.0.1.2222 127.0.0.1.50377 ESTABLISHED
tcp4 0 0 127.0.0.1.50377 127.0.0.1.2222 ESTABLISHED
tcp4 0 0 127.0.0.1.2222 127.0.0.1.50267 ESTABLISHED
tcp4 0 0 127.0.0.1.50267 127.0.0.1.2222 ESTABLISHED
tcp4 0 0 127.0.0.1.2222 *.* LISTEN
tcp6 0 0 ::1.2222 *.* LISTEN
tcp4 0 0 127.0.0.1.22 127.0.0.1.50265 ESTABLISHED
tcp4 0 0 127.0.0.1.50265 127.0.0.1.22 ESTABLISHED
tcp4 0 0 *.22 *.* LISTEN
tcp6 0 0 *.22 *.* LISTEN ESTABLISHED

So it's interesting the connection from source port 43566 is never seen on the MacBook. And of course there are no interfaces on the 172.16.71.0/24 network or routes. So apparently there is some sort of port forwarding/TCP proxying or something going on behind the scenes.

But if you can connect to the host that means the host can connect back to you. The easiest way I thought of was to use remote SSH forwarding. I assume there may be some other ways to do this as well.

On the guest machine (OpenBSD 4.0)
# ssh -v  -R :2222:localhost:22 mdfranz@172.16.71.2
Where 172.16.71.2 is the addr I can get to my Mac.

Then on my MacBook
franz-macbook:~ mdfranz$ ssh -v root@127.0.0.1 -p 2222

A bit of a hack but it works.

No comments: