In my linux machine, I have 10 network interfaces available like eth0, eth0.67, eth0.70, eth0.97 etc,.
When i run the command nc 160.48.249.170 22
to check, i get like below:
root@icon:~# nc 160.48.249.170 22
SSH-2.0-OpenSSH_8.2
In my system, eth0.97 is having inet as 160.48.249.170
. So here SSH is listening on interface eth0.97.
Similar to above, SSH is listening on all available 10 interfaces. How to disable or enable one particular interface to listen on SSH?
In /etc/ssh/sshd_config
, below was the configuration
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
But i changed as below to listen only one interface and restarted ssh.
#Port 22
#AddressFamily any
ListenAddress 160.48.199.186
#ListenAddress ::
But after above change also, ssh is listening on all interfaces