SlideShare a Scribd company logo
BY :
SYED FAWAD UL HASSAN GILLANI
IP-TABLES
Outline
 Firewall
 What is the iptables
 Why need the iptables
 What you can do with iptables
 Basic Structure of iptable
 Graphical View of iptables, Chains and Rules
 Types of iptables use in Filtering
 Rules in Chains
 Targets
 Few Examples
 Implementation
Firewall
You can implement a firewall in either hardware or
software form, or a combination of both. Firewalls
prevent unauthorized Internet or intranet traffic .
What is the iptables
 The basic firewall software used in Linux is called iptables.
 iptables is a user-space utility program that allows a system
administrator to configure the tables provided by the Linux
kernel firewall (implemented as different Netfilter modules) and
the chains and rules it stores.
The Linux kernel’s network packet processing subsystem is
called Netfilter
Why need the iptables
With the help iptables secure the system (PC) from
unauthorized access.
The Linux kernel firewall has the built-in ability to filter
packets and allow outgoing and incoming network traffic into
system (PC).
Power full software firewall.
What you can do with IP-tables
Control network traffic with iptables.
You can use iptables to block all traffic and only allow traffic from
certain IP addresses.
iptables is an application that allows users to configure specific
rules. It acts as a packet filter that examines and directs traffic
based on port, protocol and other criteria.
Basic Structure of iptable
The default structure of iptables is like:
“Tables which has Chains and the Chains which contains Rules”
Tables —> Chains —> Rules.
Tables are bunch of chains, and chains are bunch of firewall rules.
The rules are defined to control the packets for Input/output
Graphical View of IP tables
1-Packet Filtering(Filter)
Packet filtering is the most basic type of network packet
processing. Packet filtering involves examining packets at
various points as they move through the kernel’s networking
code and making decisions about how the packets should be
handled (accepted into the next stage or drop).
2-Network address translation (NAT)
NAT is a type of packet mangling that involves overwriting the source
and/or destination addresses and/or port numbers. Connection tracking
information is used to mangle related packets in specific ways.
3-Packet mangling(Mangle)
Packet mangling involves making changes to packet header fields
(such as network addresses and port numbers) or payloads.
Rules in Chains
 There are five types of rules implemented in all types of
iptable chains:
1. Input: The input chain is used for any packet coming into
the system. Used by mangle and filter tables.
2. Output: The output chain is for any packet leaving the
system. Used by Mangle, NAT
and Filter tables.
Rules in Chains
3. Forward: The forward chain is for packets that are
forwarded (routed) through the system. Used by
Mangle and Filter tables.
4. Prerouting: Prerouting allows altering of packets
before they reach the input chain.Used by Mangle
and NAT tables.
5. Postrouting: Postrouting allows altering packets
after they exit the output chain. Used
by Mangle and NAT tables.
Targets
Every iptables rules have some "target" which is executed. If
a packet matches the rule, the target specifies what should be
done with it. For example, a packet can be accepted, dropped,
logged, or sent to another chain to be compared against more
rules.
ACCEPT: Packet is accepted and goes to the application for
processing.
Targets
DROP: Packet is dropped. No information regarding
the drop is sent to the sender.
REJECT: Packet is dropped and information (error)
message is sent to the sender.
LOG: Packet details are sent to for logging.
DNAT: Rewrites the destination IP of the packet
SNAT: Rewrites the source IP of the packet
Examples-1 (DROP)
 iptables -A INPUT -p icmp -j DROP
Examples-1 (DROP)
iptables -A INPUT -p icmp -j DROP
Service
Append
Input Chain
Protocol
Protocol Name
jump
Target
Examples-2 (ACCEPT)
 iptables -A INPUT -p icmp –j ACCEPT
Examples-2 (ACCEPT)
iptables -A INPUT -p icmp -j ACCEPT
Service
Append
Input Chain
Protocol
Protocol Name
jump
Target
Flowchart
THANK YOU

More Related Content

What's hot

Wireshark Basic Presentation
Wireshark Basic PresentationWireshark Basic Presentation
Wireshark Basic Presentation
MD. SHORIFUL ISLAM
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
ContainerDay Security 2023
 
Subnetting
SubnettingSubnetting
Subnetting
Gichelle Amon
 
LDAP
LDAPLDAP
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
Server configuration
Server configurationServer configuration
Server configuration
Aisha Talat
 
Tcp IP Model
Tcp IP ModelTcp IP Model
Tcp IP Model
Ankur Kumar
 
Basics of IP Addressing
Basics of IP AddressingBasics of IP Addressing
Basics of IP Addressing
Kushal Sheth
 
6 pan-os software update & downgrade instruction
6 pan-os software update & downgrade instruction6 pan-os software update & downgrade instruction
6 pan-os software update & downgrade instruction
Mostafa El Lathy
 
NMap
NMapNMap
Understanding NMAP
Understanding NMAPUnderstanding NMAP
Understanding NMAP
Phannarith Ou, G-CISO
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
shravan saini
 
Basics of firewall, ebtables, arptables and iptables
Basics of firewall, ebtables, arptables and iptablesBasics of firewall, ebtables, arptables and iptables
Basics of firewall, ebtables, arptables and iptables
Przemysław Piotrowski
 
IPV4 vs IPV6
IPV4 vs IPV6IPV4 vs IPV6
IPV4 vs IPV6
Devang Doshi
 
Metasploit
MetasploitMetasploit
Metasploit
henelpj
 
Acl
AclAcl
Introduction to linux ppt
Introduction to linux pptIntroduction to linux ppt
Introduction to linux ppt
Omi Vichare
 
Linux networking
Linux networkingLinux networking
Linux networking
Arie Bregman
 
File permissions
File permissionsFile permissions
File permissions
Varnnit Jain
 

What's hot (20)

Wireshark Basic Presentation
Wireshark Basic PresentationWireshark Basic Presentation
Wireshark Basic Presentation
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
Enhancing Network and Runtime Security with Cilium and Tetragon by Raymond De...
 
Subnetting
SubnettingSubnetting
Subnetting
 
LDAP
LDAPLDAP
LDAP
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Server configuration
Server configurationServer configuration
Server configuration
 
Tcp IP Model
Tcp IP ModelTcp IP Model
Tcp IP Model
 
Basics of IP Addressing
Basics of IP AddressingBasics of IP Addressing
Basics of IP Addressing
 
6 pan-os software update & downgrade instruction
6 pan-os software update & downgrade instruction6 pan-os software update & downgrade instruction
6 pan-os software update & downgrade instruction
 
NMap
NMapNMap
NMap
 
Understanding NMAP
Understanding NMAPUnderstanding NMAP
Understanding NMAP
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Basics of firewall, ebtables, arptables and iptables
Basics of firewall, ebtables, arptables and iptablesBasics of firewall, ebtables, arptables and iptables
Basics of firewall, ebtables, arptables and iptables
 
IPV4 vs IPV6
IPV4 vs IPV6IPV4 vs IPV6
IPV4 vs IPV6
 
Metasploit
MetasploitMetasploit
Metasploit
 
Acl
AclAcl
Acl
 
Introduction to linux ppt
Introduction to linux pptIntroduction to linux ppt
Introduction to linux ppt
 
Linux networking
Linux networkingLinux networking
Linux networking
 
File permissions
File permissionsFile permissions
File permissions
 

Similar to Iptables the Linux Firewall

IP Tables And Filtering
IP Tables And FilteringIP Tables And Filtering
IP Tables And Filtering
SuperstarRr
 
IPTABLES_linux_Firewall_Administration (1).pdf
IPTABLES_linux_Firewall_Administration (1).pdfIPTABLES_linux_Firewall_Administration (1).pdf
IPTABLES_linux_Firewall_Administration (1).pdf
mpassword
 
Firewall
FirewallFirewall
Iptables
IptablesIptables
Iptables
leminhvuong
 
IPTABLES
IPTABLESIPTABLES
IPTABLES
Tan Huynh Cong
 
I ptable
I ptableI ptable
I ptable
Sandeep Gupta
 
Firewalls rules using iptables in linux
Firewalls rules using iptables in linuxFirewalls rules using iptables in linux
Firewalls rules using iptables in linux
aamir lucky
 
Iptables fundamentals
Iptables fundamentalsIptables fundamentals
Iptables fundamentals
ram_b17
 
Basic Introduction to Technology (networking).pdf
Basic Introduction to Technology (networking).pdfBasic Introduction to Technology (networking).pdf
Basic Introduction to Technology (networking).pdf
tthind
 
03 linuxfirewall1
03 linuxfirewall103 linuxfirewall1
03 linuxfirewall1
Iwan Threads
 
iptable casestudy by sans.pdf
iptable casestudy by sans.pdfiptable casestudy by sans.pdf
iptable casestudy by sans.pdf
Admin621695
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linux
gamer007
 
IPV6 Under the Hood
IPV6 Under the HoodIPV6 Under the Hood
IPV6 Under the Hood
amiable_indian
 
Creating a firewall in UBUNTU
Creating a firewall in UBUNTUCreating a firewall in UBUNTU
Creating a firewall in UBUNTU
Mumbai University
 
Network management
Network managementNetwork management
Network management
Nitesh Saitwal
 
Chapter 6 firewall
Chapter 6 firewallChapter 6 firewall
Chapter 6 firewall
newbie2019
 
1164 Routers
1164 Routers1164 Routers
1164 Routers
techbed
 
FIREWALL
FIREWALLFIREWALL
FIREWALL
swati463221
 
Mod5
Mod5Mod5
Nad710 Network Address Translation
Nad710   Network Address TranslationNad710   Network Address Translation
Nad710 Network Address Translation
tmavroidis
 

Similar to Iptables the Linux Firewall (20)

IP Tables And Filtering
IP Tables And FilteringIP Tables And Filtering
IP Tables And Filtering
 
IPTABLES_linux_Firewall_Administration (1).pdf
IPTABLES_linux_Firewall_Administration (1).pdfIPTABLES_linux_Firewall_Administration (1).pdf
IPTABLES_linux_Firewall_Administration (1).pdf
 
Firewall
FirewallFirewall
Firewall
 
Iptables
IptablesIptables
Iptables
 
IPTABLES
IPTABLESIPTABLES
IPTABLES
 
I ptable
I ptableI ptable
I ptable
 
Firewalls rules using iptables in linux
Firewalls rules using iptables in linuxFirewalls rules using iptables in linux
Firewalls rules using iptables in linux
 
Iptables fundamentals
Iptables fundamentalsIptables fundamentals
Iptables fundamentals
 
Basic Introduction to Technology (networking).pdf
Basic Introduction to Technology (networking).pdfBasic Introduction to Technology (networking).pdf
Basic Introduction to Technology (networking).pdf
 
03 linuxfirewall1
03 linuxfirewall103 linuxfirewall1
03 linuxfirewall1
 
iptable casestudy by sans.pdf
iptable casestudy by sans.pdfiptable casestudy by sans.pdf
iptable casestudy by sans.pdf
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linux
 
IPV6 Under the Hood
IPV6 Under the HoodIPV6 Under the Hood
IPV6 Under the Hood
 
Creating a firewall in UBUNTU
Creating a firewall in UBUNTUCreating a firewall in UBUNTU
Creating a firewall in UBUNTU
 
Network management
Network managementNetwork management
Network management
 
Chapter 6 firewall
Chapter 6 firewallChapter 6 firewall
Chapter 6 firewall
 
1164 Routers
1164 Routers1164 Routers
1164 Routers
 
FIREWALL
FIREWALLFIREWALL
FIREWALL
 
Mod5
Mod5Mod5
Mod5
 
Nad710 Network Address Translation
Nad710   Network Address TranslationNad710   Network Address Translation
Nad710 Network Address Translation
 

Recently uploaded

SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
Rakesh Kumar R
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 

Recently uploaded (20)

SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 

Iptables the Linux Firewall

  • 1. BY : SYED FAWAD UL HASSAN GILLANI IP-TABLES
  • 2. Outline  Firewall  What is the iptables  Why need the iptables  What you can do with iptables  Basic Structure of iptable  Graphical View of iptables, Chains and Rules  Types of iptables use in Filtering  Rules in Chains  Targets  Few Examples  Implementation
  • 3. Firewall You can implement a firewall in either hardware or software form, or a combination of both. Firewalls prevent unauthorized Internet or intranet traffic .
  • 4. What is the iptables  The basic firewall software used in Linux is called iptables.  iptables is a user-space utility program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores. The Linux kernel’s network packet processing subsystem is called Netfilter
  • 5. Why need the iptables With the help iptables secure the system (PC) from unauthorized access. The Linux kernel firewall has the built-in ability to filter packets and allow outgoing and incoming network traffic into system (PC). Power full software firewall.
  • 6. What you can do with IP-tables Control network traffic with iptables. You can use iptables to block all traffic and only allow traffic from certain IP addresses. iptables is an application that allows users to configure specific rules. It acts as a packet filter that examines and directs traffic based on port, protocol and other criteria.
  • 7. Basic Structure of iptable The default structure of iptables is like: “Tables which has Chains and the Chains which contains Rules” Tables —> Chains —> Rules. Tables are bunch of chains, and chains are bunch of firewall rules. The rules are defined to control the packets for Input/output
  • 8. Graphical View of IP tables
  • 9. 1-Packet Filtering(Filter) Packet filtering is the most basic type of network packet processing. Packet filtering involves examining packets at various points as they move through the kernel’s networking code and making decisions about how the packets should be handled (accepted into the next stage or drop).
  • 10. 2-Network address translation (NAT) NAT is a type of packet mangling that involves overwriting the source and/or destination addresses and/or port numbers. Connection tracking information is used to mangle related packets in specific ways.
  • 11. 3-Packet mangling(Mangle) Packet mangling involves making changes to packet header fields (such as network addresses and port numbers) or payloads.
  • 12. Rules in Chains  There are five types of rules implemented in all types of iptable chains: 1. Input: The input chain is used for any packet coming into the system. Used by mangle and filter tables. 2. Output: The output chain is for any packet leaving the system. Used by Mangle, NAT and Filter tables.
  • 13. Rules in Chains 3. Forward: The forward chain is for packets that are forwarded (routed) through the system. Used by Mangle and Filter tables. 4. Prerouting: Prerouting allows altering of packets before they reach the input chain.Used by Mangle and NAT tables. 5. Postrouting: Postrouting allows altering packets after they exit the output chain. Used by Mangle and NAT tables.
  • 14. Targets Every iptables rules have some "target" which is executed. If a packet matches the rule, the target specifies what should be done with it. For example, a packet can be accepted, dropped, logged, or sent to another chain to be compared against more rules. ACCEPT: Packet is accepted and goes to the application for processing.
  • 15. Targets DROP: Packet is dropped. No information regarding the drop is sent to the sender. REJECT: Packet is dropped and information (error) message is sent to the sender. LOG: Packet details are sent to for logging. DNAT: Rewrites the destination IP of the packet SNAT: Rewrites the source IP of the packet
  • 16. Examples-1 (DROP)  iptables -A INPUT -p icmp -j DROP
  • 17. Examples-1 (DROP) iptables -A INPUT -p icmp -j DROP Service Append Input Chain Protocol Protocol Name jump Target
  • 18. Examples-2 (ACCEPT)  iptables -A INPUT -p icmp –j ACCEPT
  • 19. Examples-2 (ACCEPT) iptables -A INPUT -p icmp -j ACCEPT Service Append Input Chain Protocol Protocol Name jump Target