I am new to iptables and networking in general, so I am experimenting with it.
I am learning how to close ports; in particular I am trying to close a specific port on the host machine, so another machine on the network won't receive packets.
I would like to drop outgoing traffic on port 22, so it is not possible to ssh to a machine (192.168.100.10) from a specific machine (192.168.100.3).
I wrote this rule on the machine from which I want to drop traffic (192.168.100.3):
iptables -I OUTPUT -s 192.168.100.10 -p tcp --dport 22 -j DROP
So far I get no errors, but when I try to ssh into this machine, I can do so without problems.
I thought that my rule says "drop all packets in output, directed to that IP, on that port"; which would make impossible to start a ssh connection, since it runs on port 22.
What am I missing? How do I check that the rule is in fact working?
EDIT: Thanks for the comment, I see that I used s instead of d; which is probably why it won't work.