Title: iptables
1IP Tables In Ubunto
- Prepared by Ghaidaa Ahmed
- Amira Ahmed
Reham Hassan
Menna Sakr Enjy essam el
deen
2Presentation Index
- Introduction
- What Is Firewall
- What Is IP Tables
- IP Tables structure
- How IPTables works
- IP Tables Configurations
3Introduction
- A firewall is basically the first line of defense
for your network. The basic purpose of a firewall
is to keep uninvited guests from browsing your
network. A firewall can be a hardware device or a
software application and generally is placed at
the perimeter of the network to act as the
gatekeeper for all incoming and outgoing traffic. - A firewall allows you to establish certain rules
to determine what traffic should be allowed in or
out of your private network..
4Cont.
- Depending on the type of firewall implemented
you could restrict access to only certain IP
addresses or domain names, or you can block
certain types of traffic by blocking
the TCP/IP ports they use
5So What Is Firewall?
6Cont.
- Firewall is a part of computer network which is
designed to block unauthorized packets and allow
authorized ones. It handles traffic over ports
and depending upon certain rule-sets, it allows
or blocks the packet flow. We can easily find
these firewalls in many institutes and
organizations, where access to social networking
sites is not permitted for the users. - We can say that is? Network barrier
? Packet
filtering
? Packet Mangling (NAT)
7Firewall Usage
- Personal Firewall
- Multi-homed (DMZ) Firewall
- Router Firewall
- Internet connection sharing (NAT)
- Transparent Proxying
- Content filtering
- Poor-mans load balancer
- Internet Hotspots
8What is iptables?
9Cont.
- The most popular firewall / NAT package running
on Linux was ipchains . It had a number of
limitations, the primary one being that it ran as
a separate program and not as part of the kernel.
The Netfilter organization decided to create a
new product called iptables in order to rectify
this shortcoming. As a result of this, iptables
is considered a faster and more secure
alternative. iptables has now become the default
firewall package installed under RedHat and
Fedora Linux.
10Cont.
- The Linux kernel has the built-in ability to
filter packets, allowing some of them into the
system while stopping others. The 2.4 kernel's
netfilter has three built-in tables or rules
lists . They are as follows - Filter The default table for handling network
packets. - NAT Used to alter packets that create a new
connection. - Mangle Used for specific types of packet
alteration.
11IPTables Structure
Filter Tables
Nat Tables
Mangle Table
INPUT CHAIN
OUTPUT CHAIN
INPUT CHAIN
OUTPUT CHAIN
OUTPUT CHAIN
PREROUTING CHAIN
FORWARD CHAIN
FORWARD CAHIN
POSTROUTING CHAIN
PREROUTING CHAIN
POSTROUTING CHAIN
12Filter table
- It is the default table and includes three
chains - INPUT Chain For packets coming into the system
or destined for the system. - FORWARD Chain For packets travelling (being
routed) through the system. - OUTPUT Chain For packets leaving the system or
originating from the system.
13NAT table
- It has three chains
- PREROUTING Chain For altering the packets just
after they enter the system - OUTPUT Chain For packets which are leaving the
system. - POSTROUTING Chain For altering the packets
which are about to leave the system.
14MANGLE Table
- This table contains five chains
- PREROUTING
- OUTPUT
- INPUT
- FORWARD
- POSTROUTING
15How Iptables works
- The iptables firewall operates by comparing
network traffic against a set of rules. The rules
define the characteristics that a packet must
have to match the rule, and the action that
should be taken for matching packets. - When the defined pattern matches, the action that
takes place is called a target. A target can be a
final policy decision for the packet, such as
accept, or drop.
16Cont.
- ACCEPT means to let the packet through.
- DROP means to drop the packet on the floor.
- QUEUE means to pass the packet to userspace.
(How the packet can be received by a userspace
process differs by the particular queue handler.
17Cont.
- These rules are organized into groups
called chains - A user can create chains as needed. There are
three chains defined by default. They are - INPUT This chain handles all packets that are
addressed to your server. - OUTPUT This chain contains rules for traffic
created by your server.
18Cont.
- FORWARD This chain is used to deal with traffic
destined for other servers that are not created
on your server. This chain is basically a way to
configure your server to route requests to other
machines. - Each chain can contain zero or more rules, and
has a default policy. The policy determines what
happens when a packet drops through all of the
rules in the chain and does not match any rule.
19IPTables Configration
- Functionally , IP tables discards network "
packets " according to CHAINS of rulesstored in
the PC 's memory . These chains organize the
rules and determine the order in which they are
binding
20IP Address for Vm 1
21IP Address fo Vm2 Firewall
22IP Address of windows mashine if config
23Ping the firewall VM
24Cont.
25Check Defult IPTables.No Rules yet
26Allow established session to receive traffice
27Rule added to the inpuy chain
28Allow SSh(port 22) traffic
29Rule add to chain
30Telnet from vm1 to firewall vm
31SSH from vm1 to firewall vm
32Telnet from Windows to firewall vm
Telnet connection established
33SHH to firewall from windows
34Enter firewall credentials .SHH connection
Established
35Reject icmp and rule added
36Ping requsted are blocked by firewall
37Cont.
38Block port 23 and rule add
39Firewall refuse telnet connections
40Delete rule 4 for example from chain
41Block particular IP rule
42Packets now dropped from vm
43Final IPTABLE configration
44Now we have
- IP Blocking
- DROP all -- 192.168.248.135 anywhere
- SHH Port Enabled
ACCEPT tcp anywhere
anywhere - ICMP Blocking
- REJECT icmp - -anywhere anywhere
- Telnet Port Blocking
- REJECT tcp - - anywhere anywhere
-
-