[ About | Licence | Contacts ]
Written by Oleksandr Gavenko (AKA gavenkoa), compiled on 2024-04-01 from rev 052223c22317.

iptables

View iptables rules

In command format with -S:

iptables -S

In table format with -L:

/sbin/iptables -L
iptables -L
iptables -L INPUT
iptables -L OUTPUT

Show rule stats (#packets/#bytes) with -v:

iptables -L -v

To clear stats counters:

sudo iptables -Z
sudo iptables -Z INPUT

Blocking incoming connections

For given protocol, device and port:

sudo iptables -A INPUT -i eth0 -p tcp --dport 9200 -j DROP

To delete rule:

sudo iptables -D INPUT -i eth0 -p tcp --dport 9200 -j DROP