Iptables related: (After changing the configuration, you need to run /etc/rc.d/init.d/iptables save and service iptables restart to make the configuration take effect)
iptables-save (Save the currently changed firewall rules, remember to run the last rule after changing the rules, otherwise the configuration will be lost after restart)
iptables -L (list current firewall rules)
iptables -F (clears the rules of all rule chains in the preset table filter)
iptables -X (clears the rules in the user-defined chain in the default table filter)
iptables -P [INPUT/OUTPUT/FORWARD] [DROP/ACCEPT]
iptables -A [INPUT/OUTPUT/FORWARD] -p tcp –dport [0-n] -j [DROP/ACCEPT]
Allow icmp packets to pass to allow ping
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
Only allow the specified ip to access a port (for example: specify 172.31.18.47 to access port 6379)