as a practise of iptables, is the following useful?
1) list out current iptables config
iptables -L
2) clear all outstanding rules and reset all INPUT and FORWARD default chain to DROP
iptables -t filter -F
iptables -t filter -P INPUT DROP
iptables -t filter -P FORWARD DROP
3) Block invalid packages and allow the passage of established/related stage package
iptables -t filter -A INPUT -p tcp -m state --state INVALID -j DROP
iptables -t filter -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
4) Now adding the new access port for SSH.
iptables -A FORWARD -i ethx -o ethx -m state --state INVALID -j DROP
iptables -A FORWARD -i ethx -o ethx -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ethx -o ethx -p tcp --dport 22 -j ACCEPT
5) Verify if the rule has been added and save it
iptables -L
service iptables save
Remember to change the ethx to eth0, eth1, eth2 depends on your configuration in step4. |