Posted by & filed under AWS/Linux/Unix/Devops stuff.

There may be times when you wish to SSH or establish some sort of network connection to a local VM guest while you don’t have an internet connection. Using bridged networking you can facilitate this. Here’s how…

There may be times when you wish to SSH or establish some sort of network connection to a local VM guest while you don’t have an internet connection. Using bridged networking you can facilitate this. By default your VM host and guests are probably using DHCP, which means that without the internet connection they will have no IP address (or a self assigned IP). You can “force” an IP address by doing the following:

sudo ifconfig en0 192.168.0.10 netmask 255.255.255.0

where “en0″ is an available network interface (this is the ethernet adapter in OS X), and 192.168.0.10 is some sort of private IP address. If you do this on both your VM host and guest, they will be reachable internally using these respective IP addresses despite having no route to the internet. You can verify that these machines are reachable with a ping to these respective IP addresses. To check to see what interfaces you have available and what IP addresses they have been assigned you can do the following:

ifconfig

As implied, all of this works in OS X as well as other BSD OSes and Linux. Be sure to update any firewall rules to recognize your new IP and/or interface, where applicable, or else just disable your firewall while you are not connected to the internet.