Iptables
Iptables
Number of Slides: 20
1-20
Index
• What is a firewall?
• How Firewalls Protect Your PC?
• Uses of firewall
• Types of firewall
• What is Linux?
• Why use Linux?
• What is Iptable?
• What is Ipchain? 2-20
What is a firewall?
• A firewall usually places at the input unit of a system and protects us from
Any threats coming from internet.
4-20
Zone of Risk for an Unprotected Private Network
5-20
Business use of firewall
• Firewalls can be used in a number of ways to add security to your
home or business. Large corporations often have very complex
firewalls in place to protect their extensive networks. On the
outbound side, firewalls can be configured to prevent employees
from sending certain types of emails or transmitting sensitive data
outside of the network. On the inbound side, firewalls can be
programmed to prevent access to certain websites (like social
networking sites). Additionally, firewalls can prevent outside
computers from accessing computers inside the network
6-20
Home use of firewall
• For home use, firewalls work much more simply. The main goal of
a personal firewall is to protect your personal computer and private
network from malicious mischief. Malware, malicious software, is the
primary threat to your home computer. Viruses are often the first
type of malware that comes to mind. A virus can be transmitted to
your computer through email or over the Internet and can quickly
cause a lot of damage to your files. Other malware includes Trojan
horse programs and spyware. These programs are usually designed to
acquire your personal information for the purposes of identity theft
of some kind.
7-20
Types of firewall
• Packet filtering: Data travels on the internet in small pieces; these are
called Packets. Each packet has certain metadata attached, like where it is coming
from, and where it should be sent to.
• Stateful packet inspection: In addition to the simple packet filtering (above) this
kind of firewall also keeps track of connections. A packet can be the start of a new
connection, or it can be part of an existing connection. If it is neither of the two, it
is probably useless and can be dropped.
8-20
What is Linux?
9-20
Linux Distributions
• A Linux distribution consists of the Linux kernel (actual OS) and a collection
of applications.
1. Linux kernel
2. X Windows System
3. Graphical Desktop (GNOME, KDE…)
4. Applications
• GNU Software is at the heart of every Linux. Besides the Linux kernel, GNU
software/utilities come next.
• The most common desktops are GNOME and KDE (just cosmetic
deifferences and default programs).
• Popular GNOME distros are Ubuntu & Fedora.
• Popular KDE distros are Kubuntu & Open SUSE. 10-20
Why use Linux?
Some of the reasons to use Linux are:
• Low cost and very stable (some Linux servers are not rebooted for
over a year, try that with Windows server!)
• Best computing power and inbuilt network support.
• Fastest developing OS, with the most number of developers.
• Most secure OS.
• Configurability
• Convenience
• freedom
11-20
What is iptables?
• iptables tool is used to manage the Linux firewall rules. At a first look,
iptables might look complex (or even confusing). But, once you
understand the basics of how iptables work and how it is structured,
reading and writing iptables firewall rules will be easy.
13-20
What is Ipchains?
• A chain is a set of rules
• Three default chains:
1. Input
2. Forward
3. Output
• Chains allow coherent sets of rules to be grouped and shared. For example
the rules for an FTP service could be grouped into a chain and then used on
several different firewalls to apply the same policy to each (Rules can be
added, inserted, deleted,…. In a chain).
• Every packet has to pass through each chain before let in (if default policy
for each chain is ACCEPT)
14-20
Ipchains Structure
15-20
Iptables Structure
16-20
Iptable’s chain and tables (1)
1. Filter Table
• Filter is default table for iptables. So, if you don’t define you own table,
you’ll be using filter table. Iptables’s filter table has the following built-in
chains.
I. INPUT chain – Incoming to firewall. For packets coming to the local
server.
II. OUTPUT chain – Outgoing from firewall. For packets generated locally
and going out of the local server.
III. FORWARD chain – Packet for another NIC on the local server. For packets
routed through the local server.
17-20
Iptable’s chain and tables (2)
2. NAT table
18-20
Iptable’s chain and tables (3)
3. Mangle table
• Iptables’s Mangle table is for specialized packet alteration. This alters QOS bits in the TCP header. Mangle
table has the following built-in chains.
I. PREROUTING chain
II. OUTPUT chain
III. FORWARD chain
IV. INPUT chain
V. POSTROUTING chain
4. Raw table
• Iptable’s Raw table is for configuration excemptions. Raw table has the following built-in chains.
I. PREROUTING chain
II. OUTPUT chain
19-20
The following diagram shows the three
important tables in iptables
20-20
Thank You