How Do I Block a Specific Ip Address in Linux?

How Do I Block a Specific Ip Address in Linux?
To block an IP address you need to type the iptables command as follows:
  1. # iptables -A INPUT -s IP-ADDRESS -j DROP. Replace IP-ADDRESS with your actual IP address.
  2. # iptables -A INPUT -s 209.175.453.23 -j DROP.
  3. # iptables -A INPUT -s 209.175.453.23 -p tcp --destination-port 22 -j DROP.

.

Simply so, how do I block an IP address in Linux iptables?

How to block IP address on Linux server

  1. Step 1: Login as root user. Login to your server as root user ssh [email protected]
  2. Step 2: Add new Iptables rule. Enter the following rule to block an IP address from accessing your server iptables -A INPUT -s IP-ADDRESS -j DROP.
  3. Aternate option – Block access to a specific port.
  4. To revoke the drop rule:

Additionally, how do I block an IP from my server? Here's how to block an IP or an IP range on Windows server

  1. Press Win+R to start the Run dialog box.
  2. Type MMC -> press Enter.
  3. Inside the console -> click File -> Add/Remove Snap in.
  4. Select the Standalone tab -> click the Add button.

Also, how do I block a specific port in Linux?

Block Incoming Port To block the port only on a specific interface use the -i option. To block port only for given IP or Subnet use the -s option to specify the subnet or IP addess. Save the iptables for rules to be persistent across reboots. Save the iptables for rules to be persistent across reboots.

How do I whitelist an IP in Linux?

To Whitelist IP address:

  1. Click on "Firewall allow IP" to Whitelist the IP address.
  2. Enter the IP address which needs to be whitelisted.
  3. Click on change button and restart the firewall.
Related Question Answers

How do I flush iptables?

To flush a specific chain, which will delete all of the rules in the chain, you may use the -F , or the equivalent --flush , option and the name of the chain to flush. For example, to delete all of the rules in the INPUT chain, run this command: sudo iptables -F INPUT.

How do I check firewall rules in Linux?

How to list all iptables rules on Linux
  1. Open the terminal app or login using ssh: ssh [email protected]
  2. To list all IPv4 rules : sudo iptables -S.
  3. To list all IPv6 rules : sudo ip6tables -S.
  4. To list all tables rules : sudo iptables -L -v -n | more.
  5. To list all rules for INPUT tables : sudo iptables -L INPUT -v -n.
Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.