How to connect to a Virtualbox guest from the host when network cable unplugged

Posted by Greg K on Super User See other posts from Super User or by Greg K
Published on 2010-06-09T10:44:08Z Indexed on 2010/06/09 10:53 UTC
Read the original article Hit count: 419

I'd like to work offline (I'm flying to the US twice this month), to do this I need access to a linux development server.

When I work from home I boot a VirtualBox VM and that acts as my dev server for the day (providing Apache, PHP & MySQL to run my server side code). However, I'd like to work with my VM when I'm not connected to a network.

I have my Ubuntu VM guest set up with a bridge connection so it can serve HTTP and provide SSH access from inside my local network.

I've tried to manually configure my network settings on both Mac OSX (the host) and Ubuntu (the guest) but I can't even ping my own NIC address (127.0.0.1 can, 192.168.21.x I can't) in OS X when I unplug the cable.

Manual network settings:

$ ifconfig en0
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 00:xx:xx:xx:xx:xx 
inet 192.168.21.5 netmask 0xffffff00 broadcast 192.168.21.255
media: autoselect (100baseTX <full-duplex,flow-control>)
status: active

I can ping localhost fine, as well as my VM (.20) and SSH too.

$ ping 192.168.21.5
PING 192.168.21.5 (192.168.21.5): 56 data bytes
64 bytes from 192.168.21.5: icmp_seq=0 ttl=64 time=0.085 ms
64 bytes from 192.168.21.5: icmp_seq=1 ttl=64 time=0.102 ms
64 bytes from 192.168.21.5: icmp_seq=2 ttl=64 time=0.100 ms
64 bytes from 192.168.21.5: icmp_seq=3 ttl=64 time=0.094 ms

$ ping 192.168.21.20
PING 192.168.21.20 (192.168.21.20): 56 data bytes
64 bytes from 192.168.21.20: icmp_seq=0 ttl=64 time=0.910 ms
64 bytes from 192.168.21.20: icmp_seq=1 ttl=64 time=1.181 ms
64 bytes from 192.168.21.20: icmp_seq=2 ttl=64 time=1.159 ms
64 bytes from 192.168.21.20: icmp_seq=3 ttl=64 time=1.320 ms

Network cable unplugged:

$ ifconfig en0
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 00:xx:xx:xx:xx:xx 
media: autoselect
status: inactive

$ ping 192.168.21.5
PING 192.168.21.5 (192.168.21.5): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
ping: sendto: No route to host
Request timeout for icmp_seq 1

Does OS X disable the NIC when the network cable is unplugged? Any way to stop it doing this?

© Super User or respective owner

Related posts about mac

Related posts about networking