Thursday, 19 February 2015

Add software firewall rule for port in Linux command line

sudo iptables-save

to see the list of allowed ports

sudo iptables -I INPUT 8 -p tcp -m state --state NEW -m tcp --dport 8182:8185 -j ACCEPT

to add the new rule to the table at the position 8 (can be any line number specified) port range is used here from 8182 to 8185

sudo /etc/init.d/iptables save

to save the changes permanently (works after reboot!).

No comments:

Post a Comment