Iptables Flashcards
iptables -I INPUT -s 198.51.100.0 -j DROP
Command adds a rule to the beginning of the chain that will drop all packets from the address 198.51.100.0
-I option
sing a rule with the insertion option will add it to the beginning of a chain and will be applied first. To indicate a specific placement in the chain
-s parameter
indicates the source.
he -j parameter
stands for jump. It specifies the target of the rule and what action will be performed if the packet is a match.
-p, –protocol
The protocol, such as TCP, UDP, etc.
-s, –source
Can be an address, network name, hostname, etc.
-d, –destination
An address, hostname, network name, etc.
-g, –goto chain
Specifies that the processing will continue in a user-specified chain.
-i, –in-interface
Names the interface from where packets are received.
-o, –out-interface
Name of the interface by which a packet is being sent.
-f, –fragment
The rule will only be applied to the second and subsequent fragments of fragmented packets.
-c, –set-counters
Enables the admin to initialize the packet and byte counters of a rule.
Filter table
This is the default table. Its built-in chains are:
- Input: packets going to local sockets
- Forward: packets routed through the server
- Output: locally generated packets
Nat table
When a packet creates a new connection, this table is used. Its built-in chains are:
- Prerouting: designating packets when they come in
- Output: locally generated packets before routing takes place.
- Postrouting: altering packets on the way out
Mangle table
Used for special altering of packets. Its chains are:
- Prerouting: incoming packets
- Postrouting: outgoing packets
- Output: locally generated packets that are being altered
- Input: packets coming directly into the server
- Forward: packets being routed through the server