SSH are not logged up, go up very difficult to check the log, found that several IP access anomaly, should be a plug-in crawler, before the figure simple iptables disabled, can only open again, the main orders are as follows:
| The code is as follows |
Copy Code |
|
# View Status
Service Iptables Status
# View Rules
Iptables-l-N
# clear Default Rule
Iptables-f
Iptables-x
Iptables-z
# # # # #建立新的规则 ######
# Allow local loopback 127.0.0.1
Iptables-a input-i lo-p all-j ACCEPT
# Allow all connections that have been established
Iptables-a input-p all-m State--state established,related-j ACCEPT
# Allow all outward-initiated connections
Iptables-a output-j ACCEPT
# Refuse to Ping
Iptables-a input-p icmp-m ICMP--icmp-type 8-j REJECT
# Allow SSH service port (must be open, otherwise it will not 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 connections that are not allowed
Iptables-a input-j REJECT
Iptables-a forward-j REJECT
# Disable IP
Iptables-i input-s 124.115.0.199-j DROP
# The command for the IP segment is
Iptables-i input-s 124.115.0.0/16-j DROP
# The command to seal the whole paragraph is
Iptables-i input-s 194.42.0.0/8-j DROP
# The order to seal a few paragraphs is
Iptables-i input-s 61.37.80.0/24-j DROP
Iptables-i input-s 61.37.81.0/24-j Dropdport for the purpose, sport indicate the source, output represents the machine out, INPUT means access to the local |
And then there's the Save and boot CentOS
| code is as follows |
copy code |
|
Service Iptables Save # Saves the
service iptables restart # reboot
Chkconfig iptables on # Confirmation service will start automatically with the power-on |