CentOS System IP Access Control

         Scenario: You have a bunch of machines. The server being accessed has the IP address 192.168.1.1, and the allowed client IP is 192.168.1.2. The rest are irrelevant, so I won’t bother listing them.

centos

On Linux systems, connections are essentially all done via SSH, and you can control access through configuration files.

     Basically, you just use the hosts.allow and hosts.deny files in the /etc directory to get this done.

      The hosts.allow file is used to add IP addresses that are permitted access:

      ## Execute the following steps on the 192.168.1.1 server

      #vi /etc/hosts.allow

       Add the following line in this file:

       sshd:192.168.1.2

       Save and exit;

      #vi /etc/hosts.deny

        Add the following line in this file:

         sshd:all

         Save and exit.

After this, only 192.168.1.2 can access the 192.168.1.1 machine via SSH. Other servers can still ping it, but they will not be able to log in.

Leave a Comment

Your email address will not be published.