Search This Blog

Sunday, July 31, 2011

Configure firewall settings using system-config-firewall or iptables

#system-config-firewall
Then either enable or disable firewall

Using iptables:
Flushing the default filter table
#iptables -F

List the default filter table
#iptables -L

Block ALL inbound traffic
#iptables -A INPUT -j REJECT

Block ALL outbound traffic
#iptables -A OUTPUT -j REJECT

Saving firewalls
#service iptables save

Drop all pkts coming to eth0
#iptables -A INPUT -i eth0 -j DROP

Deleting a Rule
# iptables -D INPUT -i eth0 -j DROP

Match protocol
# iptables -A INPUT -p tcp -j DROP

Setting the default Policy
# iptables -P INPUT DROP

Match destination port
# iptables -A INPUT -p tcp --dport 21 -j REJECT