25 May 2017, 00:00

Fedora 25: Fix iptables rules after replacing the firewalld service with iptables.service

If the internet is not working in your Gnome Boxes/qemu virtual machine guest after replacing the firewalld service with the iptables.service in the host OS, it might be because the iptables rules relating to the virbr0 interface and the network are missing.

Edit /etc/sysconfig/iptables

:~$ sudo vim /etc/sysconfig/iptables

Add the following lines before the line : -A INPUT -j REJECT –reject-with icmp-host-prohibited

-A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
-A FORWARD -d -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s -i virbr0 -j ACCEPT
-A FORWARD -i virbr0 -o virbr0 -j ACCEPT
-A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -o virbr0 -p udp -m udp --dport 68 -j ACCEPT
-A POSTROUTING -o virbr0 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
-A POSTROUTING -s ! -d -p tcp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s ! -d -p udp -j MASQUERADE --to-ports 1024-65535

Restart the iptables service

 :~$ sudo /bin/systemctl restart  iptables.service