In Linux, we use the iptabes to manage different firewall rules.
1. List all the rules.
- iptables -L
2. Allow incoming tcp port 8888 only from 22.214.171.124.
- iptables -A INPUT -i eth0 -p tcp –dport 8888 -s 126.96.36.199 -j ACCEPT -m comment –comment “001 Testing rule comment”
4. To delete the rule you can use the following command.
- iptables -D INPUT -i eth0 -p tcp –dport 8888 -s 188.8.131.52 -j ACCEPT -m comment –comment “001 Testing rule comment”
5. Alternatively, you can first list the firewall rules in line numbers.
- iptables -L INPUT –line-numbers
6. And then delete a specific rule by providing the line number, in my case which is 11.
- iptables -D INPUT 11
7. Finally, make sure you have save the changes to the server iptables confif file. (Thanks Philip =D)
For Ubuntu Lucid:
- iptables-save > /etc/iptables.firewall.rules
- iptables-save > /etc/sysconfig/iptables