Page 1 of 1

Iptables to firewalld rules

Posted: 2018/10/03 06:27:01
by dhJaffa
I have the following iptables rules and are working fine:

Code: Select all

iptables -I FORWARD -s 0.0.0.0/0 -d xxx.xxx.xxx.184/29 -j ACCEPT    
iptables -I FORWARD -s xxx.xxx.xxx.184/29 -d 0.0.0.0/0 -j ACCEPT    
iptables -t nat -I PREROUTING -s 0.0.0.0/0 -d xxx.xxx.xxx.186 -j DNAT --to-destination xxx.xxx.xxx.186    
iptables -t nat -I POSTROUTING -s xxx.xxx.xxx.186 -d 0.0.0.0/0 -j SNAT --to-source xxx.xxx.xxx.186
Trying to switch to firewalld but somewhere I fail:

Code: Select all

firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -s 0.0.0.0/0 -d xxx.xxx.xxx.184/29 -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 1 -s xxx.xxx.xxx.184/29 -d 0.0.0.0/0 -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 nat PREROUTING 0 -s 0.0.0.0/0 -d xxx.xxx.xxx.186 -j DNAT --to-destination xxx.xxx.xxx.186
firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 1 -s xxx.xxx.xxx.186 -d 0.0.0.0/0 -j SNAT --to-source xxx.xxx.xxx.186
Any help is appreciated.