iptables - Disable DNS resolution (-n --numeric)

By default, iptables will display protocols, not ports. For example, let's say a rule has been added to allow connections on HTTP port 80. iptables will list HTTP, not port 80.

~]# iptables --list
Chain INPUT (policy ACCEPT 110 packets, 9880 bytes)
 target     prot opt     source              destination
ACCEPT     all  --      anywhere             172.17.0.3  tcp dpt:http

 

The -n or --numeric option can be used to disable DNS resolutions, so that the ports are listed, not the protocol. Likewise, notice the source now lists 0.0.0.0/0 instead of "anywhere".

~]# iptables --list --numeric
Chain INPUT (policy ACCEPT 110 packets, 9880 bytes)
 target     prot opt     source              destination
ACCEPT     all  --       0.0.0.0./0          172.17.0.3  tcp dpt:80



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 414cc in the box below so that we can be sure you are a human.