IPTables Firewall Configuration in RHEL5

  • Share
  • CevherShare
  • Share

Firewall are two types hardware firewall and software firewall. The important work of firewall is to monitor and control the incoming and outgoing packets.

IPtables is an important firewall in linux. TCP wrapper and SELinux is also a firewall.

Package: iptables

Service: iptables

Operations

There are 3 operations iptables can do

  • Accept

Allow the packet

  • Drop

Drop the packet and don’t send error message to sender.

  • Reject

Drop the packet and send error message to sender.

 

Options
  • i  - incoming interface
  • O  - outgoing interface
  • A  – append (edit the previous input)
  • D  - Delete
  • F  – Flush
  • L  - list
  • I  - Input (insert)
  • j  - target
  • P  - packets
  • d  - destination IP
  • S  - source IP
  • –sport   -source port address
  • –dport   - destination port address
Configuration file
#vim /etc/sysconfig/iptables-config

To drop all incoming packets

By this  any incoming packets will not come, but packets will be sent to others. This entry is considered as a first entry in iptables.

#iptables -I INPUT -j REJECT

 

#service iptables save

#service iptables restart

#chkconfig iptables ON

Stop the iptables firewall

#service iptables stop

 

To delete First entry

This delets the first entry in iptables.

#iptables -D INPUT 2

 

To view all iptables entries

#iptables -L


prasad

About prasad

Prasad K has written 111 post in this blog.