Open jrdeng opened 3 years ago
# connections from outside sudo iptables -I FORWARD -o virbr0 -d 192.168.122.226 -j ACCEPT sudo iptables -t nat -A PREROUTING -p tcp --dport 8006 -j DNAT --to 192.168.122.226:8006 sudo iptables -t nat -A POSTROUTING -s 192.168.122.0/24 -j MASQUERADE # local subnet sudo iptables -A FORWARD -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i virbr0 -o enp0s31f6 -j ACCEPT sudo iptables -A FORWARD -i virbr0 -o lo -j ACCEPT # save to persistent rules sudo service netfilter-persistent save sudo service netfilter-persistent reload
refer to: https://aboullaite.me/kvm-qemo-forward-ports-with-iptables/
第一条 FORWARD 要用 -I,用-A不行。
-I
-A
refer to: https://aboullaite.me/kvm-qemo-forward-ports-with-iptables/