Loading...
Advance Linux

Firewall Concepts

To  Block All  Incoming  Traffic

# vi firewall
iptables -F
iptables -A INPUT  -j  REJECT
:wq!

check from client

 To  Allow  a  Ip    

#vi firewall
iptables -F
iptables  -A  INPUT -s  192.168.1.20  -j   ACCEPT
iptables -A INPUT  -j  REJECT
:wq!

and check from client

TO  BLOCK A PORT

#vi firewall
iptables -F

iptables -A INPUT -p  tcp   --dport  22  -j  REJECT
:wq!

check from client

 TO  BLOCK A PORT
# vi firewall
iptables -F
iptables -A INPUT  -s  192.168.1.10 -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -p  tcp   --dport  22  -j  REJECT
:wq!

check from client

To  Block The Multiple  Port 
#vi firewall
iptables -F
iptables -A  INPUT -m   multiport  -p  tcp –dport  22,80  -j REJECT
:wq!

and check from client

To  Block The Multiple  Port
#vi firewall
iptables -F
iptables -A  INPUT -m   multiport  -s 192.168.1.20 -p  tcp –dport  22,80  -j ACCEPT
iptables -A  INPUT -m   multiport  -p  tcp –dport  22,80  -j REJECT
:wq!
and check from client

Leave a Reply

Your email address will not be published. Required fields are marked *