Virtualbox - routing subnet to bridge adapters
Posted
by user42384
on Server Fault
See other posts from Server Fault
or by user42384
Published on 2010-05-06T08:26:18Z
Indexed on
2010/05/06
8:28 UTC
Read the original article
Hit count: 264
Hello,
I have set up a Debian Lenny box with 3 vbox Lenny machines running eth0 of the host in bridged mode (on virtualbox 3.1.6). When testing in my local LAN, this all worked perfectly well and traffic flowed to and from the IPs of the virtual machines as it should. However, now that it's in its co-lo home, the networking setup is a bit different, and I'm unable to get traffic to flow to the vboxes properly.
Specifically, the host has its own Primary IP, and I have a separate subnet of 8 (6 usable) IPs routed to the box for use by the vboxes.
So, eth0 on host is:
Machine IP: 2x.x.x.137
Gateway IP: 2x.x.x.138
Subnet Msk: 255.255.255.252
Subnet for vboxes is
Subnet: 2x.x.x.240/29
Netmask: 255.255.255.248
vbox1 is configured to 2x.x.x.241 on eth0 as follows:
auto eth0
iface eth0 inet static
address 2x.x.x.241
netmask 255.255.255.248
Setting up a virtual interface (eth0:0) on the host with one of these subnet IPs allows me to ping to that address only from vbox1, and it allows me to ping vbox1 from the host. I can also ping that virtual interface perfectly well from outside, so the IPs are definitely landing at my machine.
It seems I'm missing some sort of routing instruction either on the host or vbox1 to get traffic moving between the subnet and the default gateway, but I can't seem to figure out what it should be, or what glaringly obvious thing i'm missing. Most of my obvious attempts (the gw of eth0, the ip of eth0) were rejected by route command with SIOCADDRT: No such device (eg - i can't find it).
I tried setting vbox1 to bridge on eth0:0, but this was not an acceptable device name and VBoxHeadless refused to start. The physical machine does have an unused physical NIC at eth1 that can be used if necessary for something or other.
Host machine is running iptables configured by ferm, have experimented with it allowing forwarding for that subnet, but I wouldn't have thought this was necessary given the nature of the virtualbox devices (nor did it actually work). Clearing out all of these rules for a blank iptables set does not resolve the issue. (you can see ferm generated iptables at http://codedumper.com/ojaze)
Thanks for any help you can give...
Patrick
© Server Fault or respective owner