June 2003
Intermediate to advanced
336 pages
8h 54m
English
You want to block all network traffic by firewall.
For iptables:
# iptables -F # iptables -A INPUT -j REJECT # iptables -A OUTPUT -j REJECT # iptables -A FORWARD -j REJECT
For ipchains:
# ipchains -F # ipchains -A input -j REJECT # ipchains -A output -j REJECT # ipchains -A forward -j REJECT
You could also stop your network device altogether with ifconfig [Recipe 3.2] or even unplug your network cable. It all depends on what level of control you need.
The target REJECT sends an error packet in response to the incoming packet. You can tailor iptables ’s error packet using the option —reject-with. Alternatively, you can specify the targets DROP (iptables) and DENY (ipchains) that simply absorb the packet and produce no response. See Drop Versus Reject.
iptables(8), ipchains(8).
Rules in a chain are evaluated in sequential order.