IPTABLES -FIREWALL
IPTABLES IPTABLE BASIC IMPORTANT FILES SIMPLE SECURITY IMPLEMENTATION (GRAPHICAL WAY) IMPLEMENTING FIREWALL RULE WITH EXAMPLE (COMMAND LINE) ACCESSING REMOTE SERVER USING PUBLIC/PRIVATE KEY
IPTABLES BASIC Package Installation Confirmation #rpm -qa iptables (iptables RHEL4) Startup/Autostartup/Stopping #/etc/init.d/iptable start #/etc/init.d/iptables stop #chkconfig –level 35 iptables on
IPTABLES BASIC Viewing Any Existing Rule #iptables -L Flushing Defined Existing Rule Temporarily #iptables -F (Condition Apply) Saving Existing Rule To A New File #iptables-save >
IPTABLES BASIC Restoring Rule From A Saved File #iptables-restore Appending New Rule To Existing Rule #/etc/init.d/iptables save
File Location /etc/sysconfig/iptables-config This file contains defined rule and is editable Manually Rules can be written here.
IMPLEMENT FIREWALL RULE ( Graphical Way ) System-config-securitylevel This setting will override any existing rule. Rules will be written to iptables file Explanation with an example
IMPLEMENTING FIREWALL RULE WITH EXAMPLE (COMMAND LINE) Example: 1.Allowing defined IP to telnet/ssh and rest deny #iptables -A INPUT -s -p tcp –dport 22 -j ACCEPT #iptables -A INPUT -p tcp –dport 22 -j DROP
IMPLEMENTTING FIREWALL RULE WITH EXAMPLE Mac Address Based Rule Allow defined mac – address to access #iptables -A INPUT -p tcp –dport 22 -m mac – mac-source -j ACCEPT #iptables -A INPUT -p tcp –dport-port 22 -j DROP
IMPLEMENTING FIREWALL RULE WITH EXAMPLE Port Redirection Redirecting incoming http request to 8080 port, where an application server is Listening. #iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT –to-ports 8080
IMPLEMENTING FIREWALL RULE WITH EXAMPLE PING ALLOWED FROM DEFINED IP AND REST DENY #iptables -A INPUT -s -p icmp – icmp-type any -j ACCEPT #iptables -A INPUT -p icmp –icmp-type any -j DROP
IMPLEMENTING FIREWALL RULE WITH EXAMPLE TRICKS: Implement The Firewall Rule Using Graphical Method. Apply Some Rule From Command Line Observe The File iptables Carefully Manually Apply Firewall Rule First Accept Then Rest Deny