Monday, August 15, 2011

Trying Ubuntu Linux (6)

Continuing with my Ubuntu Linux (11.0.4) server running in a VirtualBox VM under Mac OS X Lion, and making its capabilities available to other machines on my LAN. In two previous posts I described my search for a solution (here), and the actual solution (here), which used port forwarding with VirtualBox networking in NAT mode.

There is at least one other possible solution, which is to do the networking in bridged mode. To quote the docs:

With bridged networking, VirtualBox uses a device driver on your host system that filters data from your physical network adapter. This driver is therefore called a "net filter" driver. This allows VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software. When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable: the host can send data to the guest through that interface and receive data from it. This means that you can set up routing or bridging between the guest and the rest of your network.


To begin with I did something (that may not be necessary), I turned off the NAT rule from before (in OS X):

VBoxManage modifyvm Ubuntu --natpf1 delete "server"

Then I set networking to bridged in the VirtualBox Settings:



And restarted Apache (in Ubuntu):

sudo /etc/init.d/apache2 restart

ifconfig gives me the IP address that we have obtained from the DHCP server in Airport Extreme:



If I use the AirPort Utility I can see the corresponding MAC and IP addresses.



Now if I go to another machine on the network and point Safari at that IP, it works:



[ UPDATE: In the screenshot we specified port 8080, and that works because of what we did last time. But you can also do the ipadress only and it works too. ]

No comments: