Quick how to for my personal records. iptables is an open source firewall (and it does a lot more) included with most linux distributions.
Steps to add new rule to existing configuration
- Check the list of rules and their corresponding sequence
[code]sudo iptables -vL –line-numbers [/code]
- Add the new rule at the required location/sequence
[code] sudo iptables -I INPUT LINE_NUMBER RULE [/code]
Example :
[code]iptables -I INPUT 8 -s X.X.X.X/24 -p tcp -m state –state NEW -m tcp –dport 3128 -j ACCEPT[/code]
- Save the configuration
[code] sudo serivce iptables save [/code]
Thx to Sijis for helping with the commands.