To restrict ssh access using Iptables, you can follow these steps:
Connect to your Linux server via ssh as a user with root privileges.
Check if Iptables is installed by running the following command:
iptables --version
If Iptables is not installed, you can install it using your system's package manager. For example, on CentOS, you can use the following command:
yum install iptables-services
On Ubuntu, you can use the following command:
apt-get install iptables
iptables -A INPUT -s IP_ADDRESS -p tcp --dport 22 -j ACCEPT
Replace "IP_ADDRESS" with the IP address that you want to allow ssh access from.
iptables -A INPUT -p tcp --dport 22 -j DROP
service iptables save
service iptables restart
Now, ssh access to your server will be allowed only from the IP address specified in step 3. All other IP addresses will be blocked.
Note: If you want to allow ssh access from multiple IP addresses, you can repeat step 3 for each IP address.