LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Iptables - Group Of Hosts (https://www.linuxquestions.org/questions/linux-security-4/iptables-group-of-hosts-308623/)

xathras 04-01-2005 09:54 AM

Iptables - Group Of Hosts
 
Is there any way in Iptables of being able to include a group of hosts to be able to access a service.

For example I have 3 machines on my network that I want to accept ssh connections to my machine but no others

Rather than doing this:

iptables -A FORWARD -s 192.168.1.5 -d 192.168.1.2 -p tcp --dport ssh -j ACCEPT

iptables -A FORWARD -s 192.168.1.6 -d 192.168.1.2 -p tcp --dport ssh -j ACCEPT

iptables -A FORWARD -s 192.168.1.7 -d 192.168.1.2 -p tcp --dport ssh -j ACCEPT

Technoslave 04-01-2005 01:56 PM

You could figure out how masks work and try it that way ( although at most you'll be stuck with 4 hosts in the range, not the 3 you want ), or you could also do your /etc/hosts.allow and /etc/hosts.deny


All times are GMT -5. The time now is 08:06 PM.