Bridging ethernet interface
If you really want to bridge eth0 with your kvm guests you should only configure your stuff via your bridge e.g:
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 188.165.X.Y
netmask 255.255.255.0
network 188.165.255.0
broadcast 188.165.255.255
gateway 188.165.255.254
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
If you don't want to bridge but just create a router (this depends on your network setup) you would have to create a bridge without any ports in your /etc/network/interface
and create the appropriate routing entries. libvirt can create a correct bridge but the bridge will have to have an extra ip.
Related videos on Youtube
Comments
-
blacksoul over 1 year
I have a server with 4 public IP's. I have it with this configuration and I want to bridge the interface eth0 for using it with KVM:
So, I have 3 IP's (A.B.C.144, A.B.C.145, A.B.C.146) and another interface with the main IP that I want to bridge (188.165.X.Y)
/etc/network/interfaces:
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 188.165.X.Y netmask 255.255.255.0 network 188.165.255.0 broadcast 188.165.255.255 gateway 188.165.255.254 # KVM Bridge auto br0 iface br0 inet static address 188.165.X.Y netmask 255.255.255.0 network 188.165.255.0 broadcast 188.165.255.255 gateway 188.165.255.254 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off auto eth0:0 iface eth0:0 inet static address A.B.C.145 netmask 255.255.255.255 auto eth0:1 iface eth0:1 inet static address A.B.C.146 netmask 255.255.255.255 auto eth0:2 iface eth0:2 inet static address A.B.C.147 netmask 255.255.255.255
Everything (eth0, eth0:0: eth0:1, eth0:2) is working fine except the bridge (br0). But, If I do:
ifup br0
I lose the connection and I have to restore configuration without br0.
What should I do?
With @Ulrich configuration:
device eth0 entered promiscuous mode e1000e 0000:00:19.0: irq 43 for MSI/MSI-X e1000e 0000:00:19.0: irq 43 for MSI/MSI-X ADDRCONF(NETDEV_UP): eth0: link is not ready ADDRCONF(NETDEV_UP): br0: link is not ready e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None e1000e 0000:00:19.0: eth0: 10/100 speed: disabling TSO ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready br0: port 1(eth0) entering forwarding state br0: port 1(eth0) entering forwarding state ADDRCONF(NETDEV_CHANGE): br0: link becomes ready
-
blacksoul almost 12 yearsAnd the eth0:0 eth0:1 eth0:2 also because there are difference ip. Right?
-
blacksoul almost 12 yearsI did it and I lost the connection again. In my question I have just pasted the
dmsg
code -
sunnysideup almost 12 years@JavierMartinez what do you mean with you lost the connection? If you use this and activate the changes your new network device will be
br0
instead ofeth0
with a different mac address. You also have to deconfigureeth0
, try to reboot the system. If this is a remote system where you don't have access to a rescue system you can run a script after some time withat
which resets your configuration -
blacksoul almost 12 yearsYes, it is a remote system. I mean that if I use your configuration , when I do reboot I can't access to the server again without restore my previous configuration
-
sunnysideup almost 12 years@JavierMartinez is there maybe some kind of port security or port pinning enabled? anyway just setup bridge for the virtual machines themselves and don't bridge it to the network. Another problem may be caused due to some restrictive firewall rules on your server?
-
blacksoul almost 12 yearsThe server gives me ping answer but I can't access it by SSH. So I have to reboot it with network rescue and restore my configuration. Lol! If I cancel the ping (when it's replying OK) and try to ping it again it doesn't answer
-
blacksoul almost 12 yearsOkay, I forget the shorewall ¬¬. I think that everything is going OK now. Im going to test it for a while and, if there is not any problem else, I will mark this answer as valid :) Thanks you
-
blacksoul almost 12 yearsIt seems to be all right. Now I am trying to install a Debian on mi VM, but it does not get data from DHCP. Should I specify a manual configuration for the VM?
-
sunnysideup almost 12 years@JavierMartinez has your network a dhcp server? if not you have to specify the network setup yourself