I would like to load the settings below for iptables on CentOS 7 at OS startup using a bash script.
How can I do this?
#!/bin/bash
iptables -I OUTPUT -d 0.0.0.0/0 -j ACCEPT
iptables -I FORWARD -d 0.0.0.0/0 -j ACCEPT
iptables -I INPUT -d 0.0.0.0/0 -j ACCEPT
iptables -t nat -I PREROUTING -d 0.0.0.0/0 -p tcp --dport 222 -j DNAT --to-destination 10.1.0.9:22
NOTE: I know the default CentOS 7 firewall service is firewall-cmd and I don't want to remove it (use the iptables service instead). I am trying this approach because apparently the firewall-cmd does not work for the above settings (see thread firewall-cmd - add-forward-port don't work para mais informações).
Thanks! =D