Linux bridged network VMware Fusion OSX

Bridged network configuration with VMware Fusion 3 and a Macbook Pro’s Internal Wireless Card

For one of my development set ups, I use a virtual machine of CentOS through VMware Fusion 3 on a host of Mac OSX Snow Leopard running on a Macbook Pro.

My host uses the Airport (Wireless card) for its internet and my VM needs access to its internet to push to the development Git repository. My host also needs access to my Virtual Machine’s web server for testing the site before committing.

Pretty basic setup, all in all, so here it is:

I have VMware Fusion configured as a Bridged network with the internal wireless card. This will bind my Host’s wireless card (en1) to the ethernet of the virtual machine (eth0).

Note: The wireless card will be interpreted as an ethernet port in the Virtual Machine. If you want it to be interpreted as a wireless card, then you’ll have to use a USB wireless card.

1. Configure the network interface, set the IP address and the netmask:

ifconfig eth0 up 192.168.0.200 netmask 255.255.255.0

2. Add a route to the default gateway (router)… 192.168.0.1 is my router’s IP and eth0 is my card from the virtual machine:

route add default gw 192.168.0.1 eth0

3.
a) Add our DNS entry so we can resolve host names to IP addresses:

vi /etc/resolv.conf

b) Add the following to the /etc/resolve.conf file:

nameserver 192.168.0.1

Save, quit vi.

Check to make sure it worked!


ping google.ca

And there we have it!

This information was found from the following link, and this may offer more details if you need it:

http://www.fdlinux.com/networksetuphowto.html

That’s all you need for networking, but there’s one more step to allow the host to access the virtual machine’s website.

4. Edit the /etc/hosts file to resolve the chosen name to the VM’s web server:

192.168.0.200 local.dev.com

Now, when typing in “local.dev.com” in a web browser on the host’s machine it will load the virtual machine’s web server… assuming your virtual machine’s web server is configured correctly (which is beyond the scope of this article).