You are not logged in.

#1 2013-06-28 19:59:53

newpipe
Member
Registered: 2013-01-23
Posts: 7

[Solved] How to create a ntework bridge device?

Hi!
I'm trying to create a network bridge device for using it with KVM.
Therefore I installed netctl and bridge-utils.
I have two network interfaces in my computer. net0 and net1.
net0 is connected to a network switch and gets its address via DHCP.
net1 is disconnected.

My aim was to create a new device, br0, that uses net0 to get an IP address from the DHCP server of my network.
So I created the following configuration:

[mine@intelmine ~]$ cat /etc/netctl/bridgekvm 
Description="Bridge for KVM"
Interface=br0
Connection=bridge
BindsToInterfaces=(net0)
IP=no
## sets forward delay time
FwdDelay=0
## sets max age of hello message
#MaxAge=10

When I start this configuration with the command

 systemctl start netctl@bridgekvm 

The br0 interface appears:

[root@intelmine ~]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::225:22ff:fe67:d6c0  prefixlen 64  scopeid 0x20<link>
        ether 00:25:22:11:d6:c0  txqueuelen 0  (Ethernet)
        RX packets 2  bytes 382 (382.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5  bytes 478 (478.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 757  bytes 53267 (52.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 757  bytes 53267 (52.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

net0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
        inet 192.168.5.10  netmask 255.255.255.0  broadcast 192.168.5.255
        ether 00:25:22:11:d6:c0  txqueuelen 1000  (Ethernet)
        RX packets 560686  bytes 773497800 (737.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 321142  bytes 49144250 (46.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

net1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:02:12:3d:23:a4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.38.0.18  netmask 255.255.255.255  destination 10.38.0.17
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        RX packets 548425  bytes 720892580 (687.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 541569  bytes 362557409 (345.7 MiB)
        TX errors 0  dropped 227425 overruns 0  carrier 0  collisions 0

The strange thing is, that the br0 device gets the same MAC address as the net0 device.
Right after activating the netctl profile, I cannot ping any host on the network anymore.

When stopping the netctl profile both devices, net0 and br0 disappear:

[root@intelmine ~]# systemctl stop netctl@bridgekvm
[root@intelmine ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 2597  bytes 147170 (143.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2597  bytes 147170 (143.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

net1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:02:44:3d:23:a4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.38.0.18  netmask 255.255.255.255  destination 10.38.0.17
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        RX packets 548425  bytes 720892580 (687.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5308955  bytes 7506979179 (6.9 GiB)
        TX errors 0  dropped 4987835 overruns 0  carrier 0  collisions 0

What is going on here? How can I simply create a bridge device for a KVM host?

Thanks,
newpipe

Last edited by newpipe (2013-07-01 08:07:56)

Offline

#2 2013-06-28 20:11:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] How to create a ntework bridge device?

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-06-28 20:19:54

newpipe
Member
Registered: 2013-01-23
Posts: 7

Re: [Solved] How to create a ntework bridge device?

jasonwryan wrote:

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code

Sorry for the carelessness. I updated my post.

newpipe

Last edited by newpipe (2013-06-28 20:21:26)

Offline

#4 2013-06-29 09:54:36

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

Re: [Solved] How to create a ntework bridge device?

Works as designed. The bridge gets the same MAC as net0, because it's bound to it. In order for connections to work, you need to configure an IP/DHCP for br0.
Also you need to stop ethernet profile before starting the bridge profile.

Offline

#5 2013-06-29 09:59:47

newpipe
Member
Registered: 2013-01-23
Posts: 7

Re: [Solved] How to create a ntework bridge device?

Thanks for your replay!
How many bridges per real network interfaces can be made at the same time? I assume one, since the bridge seem to always have the same MAC as the physical interface.
That means, if my computer had only one network interface, I could not use the network on the host and the client computer at the same time?

newpipe

Offline

#6 2013-06-29 19:28:04

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

Re: [Solved] How to create a ntework bridge device?

Not sure if I understand you correctly. The bridge makes it possible to share the host's physical network with many virtual machines. The VMs use an emulated NIC with a random generated or given MAC, though. So both the host and the VMs can use the Network at the same time with one physical NIC on the host. So actually the second NIC is only, or especially, usefull to do stuff like NIC bonding or putting the host in different subnets at once.

Offline

#7 2013-07-01 08:05:51

newpipe
Member
Registered: 2013-01-23
Posts: 7

Re: [Solved] How to create a ntework bridge device?

Thanks for the clarification, teekay!
I was just confused because of the behaviour of virtualbox. There you can also set bridged network to the guests, but you don't need to change anything on the host config.

Now I understand that I just need to disable the interface in the Network Manager, create the bridge device with the wished IP config for the host and tell the guest to use that bridge interface. The guest then gets a new interface with a new MAC and IP config but connected to the bridge interface.

Now everything works for me. Thanks a lot for your help!

newpipe

Offline

Board footer

Powered by FluxBB