Iptables In Case of

Iptables In Case of

2013-07-14. Category & Tags: Soft&Skills Soft&Skills

Flush: #

iptables --flush
ref

Accept HTTP Request #

iptables -I INPUT 1  -m state --state NEW -p tcp --dport 80 -j ACCEPT  
iptables -I INPUT 2  -m state --state NEW -p tcp --dport 443 -j ACCEPT

 

Allow Port Range #

iptables -I INPUT -p tcp --dport 1234:2345 -j ACCEPT

 

Save Rules to Be Used During Boot #

/sbin/service iptables save

or

iptables-save

ref:

Red Hat Enterprise Linux 4: Security Guide > Chapter 7. Firewalls http://www.centos.org/docs/4/html/rhel-sg-en-4/s1-fireall-ipt-act.html

 

Block an IP #

iptables -I INPUT -s 1.1.1.1 -j DROP

 

Delete a Rule #

iptables -D INPUT -s 1.1.1.1 -j DROP

or

iptables -D INPUT <rule-number>

 

List / Show / Display Rule-numbers & Others #

iptables -L -v --line-numbers

 line-numbers