It effects incoming connections, not outgoing

  • /etc/hosts.allow

  • /etc/hosts.deny

In short, the /etc/hosts.allow file specifies which services and hosts are allowed access to the system, whereas the /etc/hosts.deny file specifies which services and hosts are not allowed access. These files can be configured by adding specific rules to the files.

/etc/hosts.allow

  /etc/hosts.allow

ataker@htb[/htb]$ cat /etc/hosts.allow
 
# Allow access to SSH from the local network
sshd : 10.129.14.0/24
 
# Allow access to FTP from a specific host
ftpd : 10.129.14.10
 
# Allow access to Telnet from any host in the inlanefreight.local domain
telnetd : .inlanefreight.local

/etc/hosts.deny

  /etc/hosts.deny

ataker@htb[/htb]$ cat /etc/hosts.deny
 
# Deny access to all services from any host in the inlanefreight.com domain
ALL : .inlanefreight.com
 
# Deny access to SSH from a specific host
sshd : 10.129.22.22
 
# Deny access to FTP from hosts with IP addresses in the range of 10.129.22.0 to 10.129.22.255
ftpd : 10.129.22.0/24