[Solved] Multiple bridged interfaces creation problems

Discussions related to using VirtualBox on Linux hosts.
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

[Solved] Multiple bridged interfaces creation problems

Post by Lemmy78 »

Hi,

I'm using VBox on ubuntu 7.04. I've created an Windows XP Virtual Machine and created a bridged interface tpa1 for this host.

Now I need to install a debian etch server virtual machine and want it to use a tpa2 bridged interface as my 2 virtual machines and my ubuntu could communicate together.

But I don't succeed to create the 2nd bridged interface.

Can anybody help me to do it or to give me a link to documentation ?

Thanks

Regards
Last edited by Lemmy78 on 26. Sep 2007, 22:22, edited 1 time in total.
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Post by Ingo »

You should have installed bridge-utils. So have a look into
/usr/share/doc/bridge-utils/
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

Yes I've installed bridge-utils and also read the doc.

What I understand is with 1 network card it is not possible to created more than one bridge as with vmware.

:(
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Post by Ingo »

Only some ideas for discussion, I do not have realized that:
in a real network environment you have two subnets. These subnets are connected together thru one bridge so you get one broadcast domain of the two subnets.
Maybe you can realize this virtual. You have e.g. 3 VM with their own internal network (no problem, see user manual). Only one of the VM build the bridge to your host as normal. Isn't it right?
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

It could be right but I'd hoped to use virtualbox as vmware did running on windows.
I mean each guest machine is member of the same LAN as the host and the host has only one network adapter. It is what I do at work.
tonym
Posts: 16
Joined: 18. Aug 2007, 23:07
Location: Newport, Wales

Post by tonym »

I don't have Ubuntu, but I may be able to clarify what I think you need to achieve.

My reading of section 6.3 of the VirtualBox manual is that you can do exactly what you say you want to, so the problem seems to be to find out how.

It seems that what you are trying to achieve is a single bridge (br0), attached to your single real network adapter (eth0), also attached to multiple virtual interfaces (vbox0, vbox1, vbox2, ...). Each virtual interface is then connected to a Virtual Machine, so virtual interface vbox0 is connected to the virtual adapter of VM1, vbox1 is connected to the virtual adapter of VM2, etc

If you read my post at http://forums.virtualbox.org/viewtopic.php?t=1636, my IP address plan would be something as follows:

192.168.1.1 Wireless Router Gateway

192.168.1.10 eth0

192.168.1.50 vbox0
192.168.1.51 VM1 virtual network adapter

192.168.1.52 vbox1
192.168.1.53 VM2 virtual network adapter

I hope this sheds some light on the general direction I think you should be heading, and doesn't confuse you more than you are already.

:?

Tony M
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

Hi,

Thanks for your post but I have some problem to make my bridge & network run.

I followed your post http://forums.virtualbox.org/viewtopic.php?t=1636

My network is :
router WRTG54GL 192.168.1254
Dhcp plan is from 192.168.1.1 to 192.168.1.50
I want my PC is 192.168.1.100
Vbox0 in 192.168.1.110
Vbox1 in 192.168.1.111

As I'm not a Linux guru, ehere is what I did : Put all in remark in /etc/network/interfaces

Add the following to rc.local :
# For VirtualBox Host Interface Networking
/sbin/modprobe tun
/usr/sbin/brctl addbr br0
/sbin/ifconfig eth0 0.0.0.0
/usr/sbin/brctl addif br0 eth0
/sbin/ifconfig br0 192.168.1.100 netmask 255.255.255.0
/usr/bin/VBoxAddIF vbox0 <user> br0
/sbin/ifconfig vbox0 192.168.1.110 netmask 255.255.255.
/usr/bin/VBoxAddIF vbox1 <user> br0
/sbin/ifconfig vbox1 192.168.1.111 netmask 255.255.255.

After reboot, Ifconfig is :
br0 Lien encap:Ethernet HWaddr 00:1B:FC:59:4F:03
inet adr:192.168.1.100 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::21b:fcff:fe59:4f03/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reçus:26 erreurs:0 :0 overruns:0 frame:0
TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
Octets reçus:4477 (4.3 KiB) Octets transmis:9976 (9.7 KiB)

eth0 Lien encap:Ethernet HWaddr 00:1B:FC:59:4F:03
inet adr:192.168.1.1 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::21b:fcff:fe59:4f03/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reçus:62 erreurs:0 :0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:7295 (7.1 KiB) Octets transmis:6316 (6.1 KiB)
Interruption:23 Adresse de base:0x8000

lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:16436 Metric:1
Packets reçus:12 erreurs:0 :0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
Octets reçus:1013 (1013.0 b) Octets transmis:1013 (1013.0 b)

vbox0 Lien encap:Ethernet HWaddr 0A:16:7B:BF:46:4A
inet adr:192.168.1.110 Bcast:192.168.1.255 Masque:255.255.255.0
adr inet6: fe80::816:7bff:febf:464a/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
TX packets:0 errors:0 dropped:32 overruns:0 carrier:0
collisions:0 lg file transmission:500
Octets reçus:0 (0.0 b) Octets transmis:0 (0.0 b)

But I have no internet access.

If you could help me a little bit more...

Thanks

Regards
no1youknowz
Posts: 18
Joined: 12. Aug 2007, 16:08

Post by no1youknowz »

I have up to 6 guests using TAP interfaces bridged from br0.

The process is like this.

Eth0 - Primary Network Card

Br0 is bridged off Eth0

TAPX devices are bridged off Br0 using VBoxTunCtl.

Then you assign the TAP devices into the Host Interface, for the Guest in your GUI.

Its that simple ;)
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

ok that exactly what I want to do. But your answer didn't tell me if what I did is good or wrong or if I missed something ???
pascal31
Posts: 1
Joined: 18. Sep 2007, 21:51

Post by pascal31 »

no1youknowz wrote:I have up to 6 guests using TAP interfaces bridged from br0.

The process is like this.

Eth0 - Primary Network Card

Br0 is bridged off Eth0

TAPX devices are bridged off Br0 using VBoxTunCtl.

Then you assign the TAP devices into the Host Interface, for the Guest in your GUI.

Its that simple ;)
Hello,

I have the same issue, so can you post please your /etc/network/interfaces ?

Thanks,
Pascal
tonym
Posts: 16
Joined: 18. Aug 2007, 23:07
Location: Newport, Wales

Post by tonym »

I don't know whether these are simply errors in the post or in your actual rc.local script additions, but you have set the netmasks for vbox0 and vbox1 to 255.255.255.255 instead of 255.255.255.0

Also, your eth0 interface seems to have picked up an IP address of 192.168.1.1 via DHCP and is different to the IP address of bridge br0, whereas I seem to have the same IP address for both, see below:

# ifconfig
br0 Link encap:Ethernet HWaddr 00:50:8D:93:31:71
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:8dff:fe93:3171/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2718 errors:0 dropped:0 overruns:0 frame:0
TX packets:1736 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3701840 (3.5 MiB) TX bytes:129895 (126.8 KiB)

eth0 Link encap:Ethernet HWaddr 00:50:8D:93:31:71
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:8dff:fe93:3171/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2718 errors:0 dropped:0 overruns:0 frame:0
TX packets:1773 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3739904 (3.5 MiB) TX bytes:142610 (139.2 KiB)
Interrupt:22 Base address:0xc000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12722 errors:0 dropped:0 overruns:0 frame:0
TX packets:12722 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:96924904 (92.4 MiB) TX bytes:96924904 (92.4 MiB)

vbox0 Link encap:Ethernet HWaddr 00:FF:51:1F:C9:94
inet addr:192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2ff:51ff:fe1f:c994/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:91 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
192.168.1.0 * 255.255.255.0 U 0 0 0 vbox0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 br0
Fedora 7 x86_64
AMD Athlon 64 X2 3800+
Abit KN9-Ultra
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

I did several tests but net get succeed !!

Here is my rc.local :

# For VirtualBox Host Interface Networking
/sbin/modprobe tun
/usr/sbin/brctl addbr br0
/sbin/ifconfig eth0 0.0.0.0
/usr/sbin/brctl addif br0 eth0
/sbin/ifconfig br0 192.168.1.100 netmask 255.255.255.0
/usr/bin/VBoxAddIF vbox0 polo br0
/sbin/ifconfig vbox0 192.168.1.101 netmask 255.255.255.0
/usr/bin/VBoxAddIF vbox1 polo br0
/sbin/ifconfig vbox1 192.168.1.102 netmask 255.255.255.0
/sbin/service network restart


I've tried with the following in /etc/network/interfaces :


auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.254


Or with all in comment excepted auto lo.

When I run ifconfig, br0 has the IP 192.168.1.100, eth0 no ip (or 192.168.1.100 when it is uncommented is interfaces), vbox0 & vbox1 have the assigned IP.

But each time networking on the host is not working but working for Vbox machines or depending of interfaces file not.

It could be more simple if you could copy your rc.local and interfaces files.

Thanks in advance

Regards
Ubuntu 7.04 x86_64
no1youknowz
Posts: 18
Joined: 12. Aug 2007, 16:08

Post by no1youknowz »

this is what I do, I have several machines running on my server.

Im using CentOS, so you distribution may be different.

In /etc/sysconfig/network-scripts, I have changed my eth0 and added a br0

ifcfg-eth0
----------

DEVICE=eth0
BOOTPROTO=static
#BROADCAST=192.168.0.255
HWADDR=00:15:F2:C6:3B:8E
#IPADDR=192.168.0.1
IPV6ADDR=
IPV6PREFIX=
IPV6INIT=no
#NETMASK=255.255.255.0
#NETWORK=192.168.0.0
ONBOOT=yes
TYPE=ETHER
BRIDGE=br0

ifcfg-br0
---------

DEVICE=br0
TYPE=Bridge
IPADDR=192.168.0.1
IPV6INIT=no
NETMASK=255.255.255.0
ONBOOT=yes

--------------------------

This means that br0 is bridged to eth0 and is accessible by 192.168.0.1

On startup of the server.. in /etc/rc.local

# Set network cards to promisc mode
ifconfig eth0 promisc

# Add virtual network interfaces for virtual machines
VBoxAddIF vbox0 root br0 #

# Assign IP's to virtual network interfaces
ifconfig vbox0 192.168.0.10 netmask 255.255.255.0

I do the last step, so that I can RDP into the guest natively.

---------------------------------

So I have vboxX (virtual network interface) -> br0 (bridged) -> eth0 (actual network interface)

All automatic :)
Lemmy78
Posts: 7
Joined: 10. Sep 2007, 13:26

Post by Lemmy78 »

I found a topic here : http://www.virtualbox.de/discussion/1/1 ... =flat-desc
another in french here : http://atmaniak.net/blog/279-virtualbox ... buntu.html

I set my interfaces files like this :


auto lo
iface lo inet loopback

# L'interface réseau physique de la machine
auto eth0
iface eth0 inet manual

# L'interface qui sera utilisée par VirtualBox
auto tap0
iface tap0 inet manual
tunctl_user <username>

auto tap1
iface tap1 inet manual
tunctl_user <username>

# Le bridge, permettant au réseau d’être accessible aux deux interfaces réseaux.
auto br0
iface br0 inet static
address 192.168.1.100
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
post-up chmod ugo+rw /dev/net/tun
bridge-ports eth0 tap0 tap1
bridge-ageing 7200
bridge-fd 0

[/size]

Everything is worked fine for my 2 VM (XP & DEbian Srv)[/i][/url]
Ubuntu 7.04 x86_64
vokke
Posts: 1
Joined: 4. Oct 2007, 11:34

thanks!

Post by vokke »

Hi Lemmy78,
thanks for sharing your /etc/network/interfaces.
now it works for me, too!

best regards,
vokke
Post Reply