How to stop and unseal IP addresses in centos 7
I. Stopping an ip address
I haven't logged on to my VPS for a long time. I logged in with Xshell today and saw the Last Failed Login. I carefully checked that some unknown ip addresses tried to crack my VPS, after confirming with the partner that it is not his ip address, he decided to block the ip address.
(Figure 1: An unknown ip address attempted to log on to my VPS)
Command for stopping ip addresses in centos 7: iptables
Usage (case sensitive ):
Iptables-IINPUT-s ***. ***-jDROP
(Figure 2: iptables blocking ip addresses)
Parameter-I indicates Insert (ADD), followed by rules, INPUT indicates inbound ,***. ***. ***. * ** indicates the IP address to be blocked, and DROP indicates that the connection is abandoned. After the command is successfully executed, no prompt is displayed. To view the list of blocked ip addresses, run the following command:
Iptables -- list
(Figure 3: Use the list parameter to view the IP addresses blocked by the DROP command. The IP addresses under the source command are blocked)
Ii. unblocking ip addresses
1. Replace-I with-D for unblocking, provided that iptables already has this record:
Iptables-DINPUT-s ***. ***-jDROP
2. If you want to clear the blocked IP address, enter:
Iptables -- flush