Guest networking not working on Debian Jessie Host server KVM with br0 bridged network
Solution 1
Well seems I figured out the problem. To diagnose, I installed a Windows guest and installed windows virtio drivers. I was able to use virtio networking in windows so the problem is with the Linux guest kernels or kernel drivers, since the Linux guest did have virtio pci/block etc kernel modules loaded it could be the kernel needs recompiling. So there was nothing wrong the the "HOST" side.
Also, I should point out in my research it was annoying to find people always giving advice in virtualization without specifying if they're referring to the GUEST or the HOST, in fact due to this there's a lot of confusion out there, with people loading virtio kernel modules on the host instead of the guest etc...(I had them loaded on both, unnecessarily on the host...but doesn't matter either way, doesn't fix my issue, seems i'll have to recompile the Linux Kernel on my centos Linux guest.)
Solution 2
Did you enable masquerading in iptables?
Check with
iptables -L -t nat
You should see something like:
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.0.0.0/24 !10.0.0.0/24
If you don't see MASQUERADE in your iptables, you can allow it using:
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 ! -d 10.0.0.0/24 -j MASQUERADE
Of course, replace the IP range with the one you're using.
Related videos on Youtube
htfree
Updated on September 18, 2022Comments
-
htfree almost 2 years
GUESTS networking not working at all. In other words guest can not ping host or lan gateway.
- I have br0 bridge already created, also brctl show that vnet0 was properly added by KVM to br0 on guest startup
- I have set ip_forward to 1
- Iptables is off and not even installed which should not be needed since I just need the GUESTS to have direct access to the router/lan through the bridged br0
I have this setup working on other systems with centos host but I'm new to debian and not sure what I may have forgotten to do.
Host networking seems to work fine, eth0 no longer has an IP and br0 has the IP that eth0 used to have. brctl show command shows br0 with eth0 enslaved when Guests are off and when Guest is on it shows both eth0 and vnet0
I JUST GOT IT TO WORK by simply changing from VIRTIO to the RTL network interface, which is the same thing as choosing "hypervisor default". Also the output of
lsmod | grep virtio
virtio_pci 17389 0 virtio_net 26553 0 virtio_blk 17341 0 virtio_ring 17469 3 virtio_blk,virtio_net,virtio_pci virtio 13058 3 virtio_blk,virtio_net,virtio_pci
I had to manually add virtio with modprobe virtio but it still didn't fix problem. I did not reboot after adding kernel modules with modprobe virtio etc but I did restart libvirtd and virt-manager
It is working properly but not with virtio. Is there potential issue with kernel? how do I check kernel config, this is a debian Jessie with
uname -a
outputLinux vmserver 3.14-2-amd64 #1 SMP Debian 3.14.15-2 (2014-08-09) x86_64 GNU/Linux
Thanks to mase. for cleaning up my first post. I just noticed that /sys/devices/virtio folder does not exist on the guest but /sys/devices/virtual/net/lo does, but no /sys/devices/virtual/net/eth0
ifconfig on the centos 6.4 "guest" shows that eth0 got 0 bytes RX but 14kB TX so I guess its not receiving any communication. I don't give up to easy but I wasn't looking forward to rebuilding kernels from scratch on both guest and host.
-
Tero Kilkanen almost 10 yearsWe cannot diagnose the problem without config information. What is the network configuration on both host and guest? L2 and L3 please.
-
htfree almost 10 yearssee my update, it works but not if I try using virtio for network interface.
-
David Corsalini almost 10 yearswell, Debian is notorious for weird behaviour where CentOS just works, especially for the virtualization stack. Might be some kind of bug
-
htfree almost 10 yearsyea you might be right, I'm close to giving up. I have two CentOS acting as virtualization servers just fine. This is my first time trying with debian as server and Debian "Jessie" version at that.
-
htfree almost 10 yearsiptables has nothing to do with my issue with bridged networking for guests, iptables is not required, I do not even have it installed. You only need it for host based networking etc not for bridged.
-
htfree about 5 yearsapologies, think i resolved this long ago on the guest linux systems, can't recall if i rebuilt virtio drivers from source or downloaded from redhat prebuilt etc.