You are not logged in.

#1 2012-04-13 07:39:25

markuman
Member
Registered: 2005-02-18
Posts: 49

Virtualbox Bridge

XkCa

This is what i want smile Or am i completly wrong when i want to use the virtual guest machine as a server.

I try this configuration

/etc/conf.d/bridge

bridge_br0="eth0"
control_br0="setfd br0 0"
BRIDGE_INTERFACES=(br0)

/etc/rc.conf

interface=eth0
address=192.168.0.50
netmask=255.255.255.0
broadcast=192.168.0.255
gateway=192.168.0.50

/etc/network.d/br0

INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="bridge br0 static"
BRIDGE_INTERFACES="eth0"
IP='static'
ADDR='10.0.0.10'
GATEWAY='10.0.0.1'
DNS='10.0.0.1'

First i do /etc/rc.d/network start, then netcfg br0

Virtualbox guest machine i startet in bridge mode and chose the br0 interface.
I give the guest machine the same ip as the br0 nic in the host machine.

I can ping the br0 interface, but this is not the guest machine i guess, because i can't ssh into it.

Any ideas?

Offline

#2 2012-04-13 10:20:46

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: Virtualbox Bridge

Why do you give the guest machine the same IP as the host? The idea behind briding is that the guest gets its own IP in your local network, otherwhise you would have to use NAT/host-only networking for the guest.

Also, with VirtualBox you do not really need to setup a bridge interface in the host, as VirtualBox can use your default eth0 interface for bridging. Just select bridged network and eth0 in the guests setup dialog.

Last edited by teekay (2012-04-13 10:25:27)

Offline

#3 2012-04-13 10:41:01

markuman
Member
Registered: 2005-02-18
Posts: 49

Re: Virtualbox Bridge

teekay wrote:

Why do you give the guest machine the same IP as the host? The idea behind briding is that the guest gets its own IP in your local network,...

You mean e.g.
Host: 192.168.0.1
Bridge: 192.168.0.2
Guest: 192.168.0.3
?

teekay wrote:

Also, with VirtualBox you do not really need to setup a bridge interface in the host, as VirtualBox can use your default eth0 interface for bridging. Just select bridged network and eth0 in the guests setup dialog.

i've already tried this. guest machine said then that the network is unreachable and guest is not reachable too smile

Offline

#4 2012-04-13 11:05:27

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: Virtualbox Bridge

markuman wrote:

You mean e.g.
Host: 192.168.0.1
Bridge: 192.168.0.2
Guest: 192.168.0.3
?

Almost. The bridge ip == host ip. eth0 is in promisc mode without ip assigned to it.
Here it looks like this:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::92e6:baff:fec8:1ee6  prefixlen 64  scopeid 0x20<link>
        ether 90:e6:ba:c8:1e:e6  txqueuelen 0  (Ethernet)
        ...
eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500  metric 1
        ether 90:e6:ba:c8:1e:e6  txqueuelen 1000  (Ethernet)
       ....

i've already tried this. guest machine said then that the network is unreachable and guest is not reachable too smile

Was that with DHCP or static IP? If static, was it the same subnet as the host?

Offline

#5 2012-04-13 12:41:53

markuman
Member
Registered: 2005-02-18
Posts: 49

Re: Virtualbox Bridge

teekay wrote:

Almost. The bridge ip == host ip. eth0 is in promisc mode without ip assigned to it.
Here it looks like this:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::92e6:baff:fec8:1ee6  prefixlen 64  scopeid 0x20<link>
        ether 90:e6:ba:c8:1e:e6  txqueuelen 0  (Ethernet)
        ...
eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500  metric 1
        ether 90:e6:ba:c8:1e:e6  txqueuelen 1000  (Ethernet)
       ....

Let me try this at home this evening.

i've already tried this. guest machine said then that the network is unreachable and guest is not reachable too smile

Was that with DHCP or static IP? If static, was it the same subnet as the host?

It was a stand alone PC. Host was not connected with eth0 on any kind of network. So i give the guest a static ip.

Offline

#6 2012-04-13 15:37:04

markuman
Member
Registered: 2005-02-18
Posts: 49

Re: Virtualbox Bridge

teekay wrote:

Also, with VirtualBox you do not really need to setup a bridge interface in the host, as VirtualBox can use your default eth0 interface for bridging. Just select bridged network and eth0 in the guests setup dialog.

Yay... if i booting the guest with bridge interface eth0, it don't work.

Host eth0 looks like that

interface=eth0
address=192.168.0.50
netmask=255.255.255.0
broadcast=192.168.0.255
gateway=192.168.0.1

And guest eth0 looks like that

interface=eth0
address=192.168.0.3
netmask=255.255.255.0
broadcast=192.168.0.255
gateway=192.168.0.1

And both direction looks like that

# ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3) 56(84) bytes of data.
From 192.168.0.50 icmp_seq=1 Destination Host Unreachable
From 192.168.0.50 icmp_seq=2 Destination Host Unreachable
From 192.168.0.50 icmp_seq=3 Destination Host Unreachable

any other ideas what exactly went wrong?

Offline

#7 2012-04-15 09:45:25

funkypotatoe
Member
Registered: 2012-03-23
Posts: 47

Re: Virtualbox Bridge

I'm using dhcp, here is my confs

$ cat /etc/network.d/bridge

INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="Bridge"
BRIDGE_INTERFACES="eth0"
IP="dhcp"

$ cat /etc/rc.conf

...
#interface=eth0
#address=
#netmask=
#broadcast=
#gateway=
...
NETWORKS=(bridge)
...
DAEMONS=(... net-profiles ...)      # make sure there is no network/networkmanager daemons

VM is bridged to br0.
So, i guess, you simply have to change

INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="bridge br0 static"
BRIDGE_INTERFACES="eth0"
IP='static'
ADDR='10.0.0.10'
GATEWAY='10.0.0.1'
DNS='10.0.0.1'

to

INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="bridge br0 static"
BRIDGE_INTERFACES="eth0"
IP='static'
ADDR='192.168.0.50'
GATEWAY='192.168.0.50'
DNS='192.168.0.50'

and remove eth0 configuration from rc.conf.

Offline

#8 2012-11-02 19:13:41

LinuxRocks
Member
Registered: 2010-01-20
Posts: 27

Re: Virtualbox Bridge

Just out of curiosity,

How would you set this up with the new systemd? So, would I follow the wiki, but then remove dhcpcd@eth0 and add dhcpcd@br0?

Also, would the rc.local and netcfg settings still apply?

I am running on a fresh install of Arch, so most of the files mentioned in the wiki don't exist, so i have to create them. Just wanted to know if the instructions still apply.

Thanks!
Joe

Offline

Board footer

Powered by FluxBB