I am trying to allow SSH access to a certain range of IPs (from 192.168.1.1
to 192.168.1.24
) and block all the rest, but since I am new to iptables I can't seem to figure it out. I have :
iptables -A INPUT -s 192.168.1.0/24 -p udp --dport ssh -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport ssh -j REJECT
iptables -A INPUT -p udp --dport ssh -j REJECT
Tut this does not work, with a VM set with 192.168.1.89
I can still access through SSH. Can someone help?