In linux, the iptables firewall is configured on VPS. Only apache in linux can use this function. This function is not specific in windows.
Ssh Login fails. It is difficult to check the logs and find that access from several ip addresses is abnormal. It should be a crawler of a plug-in. Previously, the simple iptables graph was disabled and can only be enabled again, the main Commands are as follows:
| The Code is as follows: |
Copy code |
# Viewing Status Service iptables status # View rules Iptables-L-n # Clearing default rules Iptables-F Iptables-X Iptables-Z ##### Create a new rule ###### # Allow local loopback 127.0.0.1 Iptables-a input-I lo-p all-j ACCEPT # Allow all established connections Iptables-a input-p all-m state -- state ESTABLISHED, RELATED-j ACCEPT # Allow all external connections Iptables-a output-j ACCEPT # Reject ping Iptables-a input-p icmp-m icmp -- icmp-type 8-j REJECT # Allow the SSH service port (you must open it, or you will not be able to use ssh) Iptables-a input-p tcp -- dport 22-j ACCEPT # Allow Web Service ports Iptables-a input-p tcp -- dport 80-j ACCEPT # Deny all other unpermitted connections Iptables-a input-j REJECT Iptables-a forward-j REJECT # Disabling ip addresses Iptables-I INPUT-s 124.115.0.199-j DROP # The command for sealing IP segments is Iptables-I INPUT-s 124.115.0.0/16-j DROP # The command for sealing the entire segment is Iptables-I INPUT-s 194.42.0.0/8-j DROP # The command for sealing several segments is Iptables-I INPUT-s 61.37.80.0/24-j DROP Iptables-I INPUT-s 61.37.81.0/24-j DROPdport indicates the target, sport indicates the source, output indicates the local output, and input indicates accessing the Local Machine |
Then, save and start centos.
| The Code is as follows: |
Copy code |
Service iptables save # save Service iptables restart # restart Chkconfig iptables on # confirm that the service will be automatically started upon startup |