Linux KVM and bridge network doesn't work
by Patric.F from LinuxQuestions.org on (#5GCTB)
Hi,
I have a Debian 10 server running various services, including Docker. I want to configure virtual machines for some testing purposes but I can't get the networking right.
I want the guests to connect to my LAN and get an IP from my DHCP but no matter what I do I can't get it to work properly.
I started by editing /etc/network/interfaces so it only contains loopback and the bridge like this:
Code:auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.9.2
network 192.168.9.1
netmask 255.255.255.0
broadcast 192.168.9.255
gateway 192.168.9.1
bridge_ports eno1
bridge_stp off
bridge_maxwait 0
bridge_fd 0eno1is my main network interface connected to my LAN.
I then ran the following:
Code:~# ip addr flush dev eno1
~# /etc/init.d/networking restart
~# ip link set eno1 master br0
The host can connect to my LAN and the internet just fine, so far so good.
Code:~# virsh net-destroy default
~# virsh net-undefine default
host-bridge.xml:
<network>
<name>host-bridge</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
~# virsh net-define host-bridge.xml
~# virsh net-start host-bridge
~# virsh net-autostart host-bridge
Now I try to install a guest like this:
Code:virt-install --name Debian --cdrom /mnt/iso/debian.iso --vcpus 1 --memory 1024 --os-type=Linux --os-variant=debian10 --disk size=10 --graphics type=vnc,listen=0.0.0.0 --console pty,target_type=serial --noautoconsole -vDuring the install I don't get any DHCP so the network obviously doesn't work correctly.
I try to set a static IP and if I do that I can ping from guest to host and vice versa but Not the default gateway or any other IP on the network.
The bridge looks like this:
Code:root@debian-01:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.f403435b4748 no eno1
vnet0
docker0 8000.0242cc531387 no veth07025d1
veth12792e5I'm thinking that it might be Docker that is messing with me here?
I don't have any iptables rules more that what Docker is providing.
oh, and these kernel paremeters are set:
Code:net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.br0.proxy_arp = 1
net.ipv4.conf.br0.proxy_arp_pvlan = 1
net.ipv4.conf.eno1.proxy_arp = 1
net.ipv4.conf.eno1.proxy_arp_pvlan = 1Not really sure if that is a must though. I tried both with and without them set without any luck.
Has anyone gotten this to work properly and can point me in the right direction?


I have a Debian 10 server running various services, including Docker. I want to configure virtual machines for some testing purposes but I can't get the networking right.
I want the guests to connect to my LAN and get an IP from my DHCP but no matter what I do I can't get it to work properly.
I started by editing /etc/network/interfaces so it only contains loopback and the bridge like this:
Code:auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.9.2
network 192.168.9.1
netmask 255.255.255.0
broadcast 192.168.9.255
gateway 192.168.9.1
bridge_ports eno1
bridge_stp off
bridge_maxwait 0
bridge_fd 0eno1is my main network interface connected to my LAN.
I then ran the following:
Code:~# ip addr flush dev eno1
~# /etc/init.d/networking restart
~# ip link set eno1 master br0
The host can connect to my LAN and the internet just fine, so far so good.
Code:~# virsh net-destroy default
~# virsh net-undefine default
host-bridge.xml:
<network>
<name>host-bridge</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
~# virsh net-define host-bridge.xml
~# virsh net-start host-bridge
~# virsh net-autostart host-bridge
Now I try to install a guest like this:
Code:virt-install --name Debian --cdrom /mnt/iso/debian.iso --vcpus 1 --memory 1024 --os-type=Linux --os-variant=debian10 --disk size=10 --graphics type=vnc,listen=0.0.0.0 --console pty,target_type=serial --noautoconsole -vDuring the install I don't get any DHCP so the network obviously doesn't work correctly.
I try to set a static IP and if I do that I can ping from guest to host and vice versa but Not the default gateway or any other IP on the network.
The bridge looks like this:
Code:root@debian-01:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.f403435b4748 no eno1
vnet0
docker0 8000.0242cc531387 no veth07025d1
veth12792e5I'm thinking that it might be Docker that is messing with me here?
I don't have any iptables rules more that what Docker is providing.
oh, and these kernel paremeters are set:
Code:net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.br0.proxy_arp = 1
net.ipv4.conf.br0.proxy_arp_pvlan = 1
net.ipv4.conf.eno1.proxy_arp = 1
net.ipv4.conf.eno1.proxy_arp_pvlan = 1Not really sure if that is a must though. I tried both with and without them set without any luck.
Has anyone gotten this to work properly and can point me in the right direction?