6:56 - Wednesday, 16 April 2014

Connecting VirtualBox To LAN

#Topics: virtual box to lan,virtualbox not connecting to LAN

My host computer is OS X Snow Leopard and is connected to the network via Ethernet. The guest virtual machine is Ubuntu 12.04

My goal is for my virtual machine to behave like any other machine on the LAN. Specifically, I want to be able to SSH to and from the virtual machine and all the other machines on the network.

I thought of two solutions, but I haven’t been able to get either solution to work.

Solution #1:

A virtual machine with a bridged adapter should behave like a normal machine on the LAN, so I set the adapter 1 for the virtual machine to bridged and selected en0 (ethernet) for the name. I then turned on the virtual machine and found I did not have any Internet access, so I couldn’t install OpenSSH Server. To fix this I added a NAT adapter (adapter 2) so that I could install OpenSSH. I could then SSH from my VM to any other machines (I believe the NAT adapter allows me to do this) on the network, but I could not SSH from any other machine to the virtual machine (connection timed out). Here’s some results from ifconfig that might be useful:

For guest:

eth0      Link encap:Ethernet  HWaddr 08:00:27:e1:60:d4            inet addr:128.102.109.21  Bcast:128.102.111.255  Mask:255.255.248.0          inet6 addr: fe80::a00:27ff:fee1:60d4/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

For host:

en0: flags=8963 mtu 1500    ether 00:25:bc:dd:62:80     inet6 fe80::225:bcff:fedd:6280%en0 prefixlen 64 scopeid 0x4     inet 128.102.109.20 netmask 0xfffff800 broadcast 128.102.111.255    media: autoselect (1000baseT )    status: active

I should mention that the host has a firewall (I think that this might affect things)

Solution 2:

The second thing I was considering is port forwarding ssh from the host to the guest. I can set it up so that port XXXX on the host machine forwards to port 22 on the guest machine, however the port XXXX on the host machine cannot be accessed.

ssh -p 2222 128.102.109.20

gives a connection timed out error.

I am pretty sure this is related to the firewall, but I can’t play around with the firewall because I don’t have administrative access.

How can I get this working?

The problem is that when you fire up the VM with the bridged connection, the VM has it’s own MAC address associated with the virtual LAN card.

This address is not registered with the smart switches that NASA are using. So your “new machine” cannot connect to the LAN.

The only way around this is to register the VM’s MAC address with the switches. You will need to get the IT guys to do this.

Share

Advertisement

Comment