Firewall - Iptables
Firewall - Iptables
Lab 1
Purpose: perform basic tasks on systems firewall.
Procedure:
To list the current content of filter table:
[root@alexrh ~]# iptables --list
It is possible to liste rule line number also:
[root@alexrh ~]# iptables --list --line-numbers
Try -v(vv) options also.
Note: connections can be tested with nc (netcat tool)
To add a rule for new http connections:
[root@alexrh ~]# iptables -A INPUT -p tcp -m state --state NEW --dport
80 -j ACCEPT
To delete the newly added rule:
[root@alexrh ~]# iptables -D INPUT -p tcp -m state --state NEW --dport
80 -j ACCEPT
To insert the rule in a specific position:
[root@alexrh ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -dport 80 -j ACCEPT
Lab 2
Iptables example:
iptables -P FORWARD DROP
iptables -P INPUT DROP