Junior — Middle
What rules and tables did you configure in iptables to manage network traffic?
sobes.tech AI
Answer from AI
In iptables, there are several tables, each responsible for a specific type of packet processing:
- filter — the main table for traffic filtering (INPUT, OUTPUT, FORWARD).
- nat — for address translation (PREROUTING, POSTROUTING, OUTPUT).
- mangle — for modifying packets (e.g., changing TOS).
- raw — for excluding packets from connection tracking.
Rules are usually configured in chains within these tables. For example, to block incoming traffic on a specific port:
iptables -A INPUT -p tcp --dport 22 -j DROP
Or to allow traffic only from a specific IP:
iptables -A INPUT -s 192.168.1.100 -j ACCEPT
Rules for NAT, such as port forwarding, are also commonly set up:
iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination 192.168.1.10:80
Overall, I have configured rules for filtering incoming and outgoing traffic, port forwarding, IP access restrictions, and logging suspicious packets.