No internet on kvm guests.

By | April 20, 2018

After setting up bridge network on network interface enp9s0 , kvm guests had issues with accessing ssh,internet.

Current bridge configuration

bridge name	bridge id		STP enabled	interfaces
br0		8000.001c2301fbdc	no		enp9s0

to allow kvm guests network connectivity with host net.ipv4.ip_forward should be enabled,
add net.ipv4.ip_forward = 1 to /etc/sysctl.conf

kernel.sysrq = 1
net.ipv4.ip_forward = 1

To make changes take effect without reboot execute sysctl -p

 sysctl -p
kernel.sysrq = 1
vm.swappiness = 10
vm.vfs_cache_pressure = 50
net.ipv4.ip_forward = 1

Depending on the whether you are using firewalld or iptables they need to be adjusted.


iptables -I FORWARD -i br0 -j ACCEPT
iptables -I FORWARD -o br0 -j ACCEPT


firewall-cmd --permanent --direct --passthrough ipv4 -I FORWARD -i br0 -j ACCEPT
firewall-cmd --permanent --direct --passthrough ipv4 -I FORWARD -o br0 -j ACCEPT
firewall-cmd --reload