Experiment 9 IPTables
Experiment 9 IPTables
Experiment 9: IP Tables
Learning Outcomes:
After completion of this experiment, student should be able to
Theory:
Iptables is an extremely flexible firewall utility built for Linux operating systems. iptables is a
command-line firewall utility that uses policy chains to allow or block traffic. When a connection
tries to establish itself on your system, iptables looks for a rule in its list to match it to. If it
doesn’t find one, it resorts to the default action. iptables almost always comes pre-installed on
any Linux distribution. To update/install it, just retrieve the iptables package.
Types of Chains iptables uses three different chains: input, forward, and output.
Input – This chain is used to control the behavior for incoming connections. For example, if a
user attempts to SSH into your PC/server, iptables will attempt to match the IP address and port
to a rule in the input chain.
Forward – This chain is used for incoming connections that aren’t actually being delivered
locally. Think of a router – data is always being sent to it but rarely actually destined for the
router itself; the data is just forwarded to its target. Unless you’re doing some kind of routing,
NATing, or something else on your system that requires forwarding, you won’t even use this
chain.
Procedure:
Do the following task and upload your document along with review questions on
student portal
Task 6: Allowing services from outside which use two way communication
sudo iptables –A INPUT –i eth0 –p tcp - - dport ssh –j ACCEPT
sudo iptables –A OUTPUT –o eth0 -p tcp - - sport ssh –j ACCEPT
Review questions:
1. Explain need for packet filtering firewall.
2. Explain the working of iptables in detail.
3. What is the difference between DROP and REJECT in iptables?
Page 22