Linux- How to‎ > ‎


File for  configuration.

# vi /etc/sysctle.conf

 To read the kernel for changes in sysctle.conf.

 # sysctle-p

 (to get the list of rules been created)

  #iptables –L

(its means firewall will accept all the incoming connections)

 #iptables –P input ACCEPT

(its means firewall will DROP all the incoming connections)

 # iptables –P input DROP

 (its means firewall will drop only the connection which comes for port no 21)

 # iptables –A INPUT –p TCP –dport 21 –j DROP 

 IPTABLES common usage:

  A  = Add rules

  P  = protocols

  d  = Destination

  j  = jumps

(Flues all the rules)

# iptables –F

Add exception to firewall below rule will accept the connection from only from for port no 21.

# iptables –A INPUT –p tcp –-dport  21 –s! –j DROP