I will explain in brief what you need to know about Iptables in a language that anyone managing servers can understand.
Iptables is a rule-based application that provides access control for traffic passing through Linux, Unix, or BSD-based servers. Iptables can be described as a rule-based access controller that is currently used as an integration of many firewall software. Many operations beyond access control can be performed with Iptables, which we will cover in later documents.
Iptables performs rule-based process control. These operations generally proceed in the order: operation, procedure, protocol, target, source, and control. Operation parameters:
A : Add a new rule
I : Add rules to intervals
L : List rules
N : Add operation
X : Delete operation
D : Delete rule
F : Delete all rules
Z : Reset counters
R : Change ruleThree procedures exist: INPUT, OUTPUT, FORWARD:
INPUT : Packets coming from outside.
OUTPUT : Packets going outside.
FORWARD: Packets coming from outside and passing through us to go out.Protocols used: TCP, UDP, ICMP, IGMP with “-p” parameter. Target is specified with “-d”, destination port with “–dport”. Source is specified with “-s”, source port with “–sport”.
Control actions:
DROP : Block
ACCEPT : Allow
REJECT : Block and send rejection response
LOG : Keep a record of operationsExamples:
iptables -L # List all rules
iptables -F # Reset all rules
Close port 80
iptables -A INPUT -p tcp -s 0/0 –dport 80 -j DROP
Block ICMP (ping)
iptables -A INPUT -p ICMP -j DROP
Block a specific IP
iptables -A INPUT -s 10.0.0.2 -j DROP
Block an IP range
iptables -A INPUT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -s 192.168.1.0/24 -j DROP
Remove block from an IP
iptables -D INPUT -s 10.0.0.2 -j DROP
Leave a Comment
* Your comment will be published after approval.
Comments
0No comments yet. Be the first to comment!