For personal VPs, simple firewall settings are also necessary. The specific method is as follows:
1. Check whether the firewall function is Enabled:
#/Etc/init. d/iptables status
2. Set the preset policies for the input, output, and forwarding links:
# Iptables-P input accept
# Iptables-P output accept
# Iptables-P forward accept
3. Clear all default firewalls:
# Iptables-F
# Iptables-x
# Iptables-z
4. Set the loopback interface to be unrestricted:
# Iptables-A input-I lo-J accept
5. set to open all response packages for requests sent by the Local Machine
# Iptables-A input-M State-State related, established-J accept
6. Enable the WWW Service provided by the local machine:
# Iptables-A input-p tcp-dport 80-J accept
7. set to release the SSH service provided by the local machine:
# Iptables-A input-p tcp-dport 22-J accept
8. Set the preset input chain policy to drop:
# Iptables-P input drop
9. Save the route information:
#/Etc/init. d/iptables save
Note:
You need to set the Default policy of the input chain to accept and leave a path for yourself to avoid the SSH connection being blocked by the firewall. In this case, you can only try to restart the server, or you can log on to the server using TTY. Therefore, set the input policy to accept, perform firewall operations, and then run "iptables-P input drop ".