When this happens, try using iptables-n-l-t filter and add a-n command-line option.
A few days ago, when maintaining a seemingly inaccessible Linux server, the Iptables-l-T filter command output was found to be very slow. One of the processes in the system takes up a lot of CPU resources, but when viewed with the top command, the CPU usage is found to be low.
After careful observation, it is found that every time you output a rule with an IP address, it will stop there. is related to the IP address. Suddenly remembered iptables command the default output is the host name, which requires communication with the DNS server (if a DNS server is configured). With the nameserver annotation in the/etc/resolve.conf, the Iptables-l-T filter command is called, and the output is immediately expected. Indeed, with DNS, ping two DNS servers, it seems that the network operators there is a problem ...
Restore/etc/resolve.conf file, use Iptables-n-l-t filter, immediately returned ...
-N option, the host and port are digitally printed and will not query host names (DNS PTR queries are slow). , as well as the corresponding service name of the port number (if it is their own program, occupy the port in/etc/service, is common, direct output port number is more intuitive).