A set of specifiers that correspond to ip4/ip6 packets
1 specifier that tells the kernel what to do with a matching packet.
lists details for a packet and target. If the packet does match the target, the target can refer what to do via a user defined chain, a target described in iptables-extensions, or it can be ACCEPT, DROP, or RETURN.
let the packet through
drop the packet. Don't let it come through
stop looking for what to do in this chain, go back to the previous chain and figure out what to do there.
There are many different tables, but this is the default. It contains INPUT for packets that are going to local sockets. FORWARD packets that are going through the box, and OUTPUT for locally generated packets.
su
iptables -N TCP
iptables -N UDP
su
iptables -P INPUT DROP
su
iptables -P OUTPUT ACCEPT
su
su
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
su
iptables -A INPUT -p icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
su
iptables -A INPUT -p udp -m conntrack --ctstate NEW -j UDP
iptables -A INPUT -p tcp --syn -m conntrack --ctstate NEW -j TCP
su
iptables -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
su
iptables -A INPUT -j REJECT --reject-with icmp-proto-unreachable
su
iptables -A TCP -p tcp --dport 80 -j ACCEPT
iptables -A TCP -p tcp --dport 443 -j ACCEPT