CentOS System IP Access Control

         Scenario: Suppose you have a bunch of machines, where the server being accessed has the IP address 192.168.1.1, and the IP address allowed to access it is 192.168.1.2. The rest are irrelevant, so we won’t bother listing them.

centos

On Linux systems, SSH is essentially the standard connection method, and you can control access simply through configuration files.

     It’s basically done by managing the hosts.allow and hosts.deny files under the /etc directory.

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

      ## Perform the following steps on the server at 192.168.1.1

      # vi /etc/hosts.allow

       Add the following line to this file

       sshd:192.168.1.2

       Save and exit;

      # vi /etc/hosts.deny

        Add the following line to this file

         sshd:all

         Save and exit.

This way, only 192.168.1.2 can access 192.168.1.1 via SSH. Other servers, while still able to ping it, will be unable to log in.

Leave a Comment

Your email address will not be published.