I have three virtualboxs.
1) Virtual machine VM-A that works as a router with two interfaces:
eth0 - 10.160.10.254
eth1 - 172.10.0.254
2) Virtual machine VM-B that works as an internal network with one interface:
eth0 - 10.160.10.1 (and with gw to 10.160.10.254)
3) Virtual machine VM-C that works as an external network with one interface:
eth0 172.10.0.1 (and with gw to 172.10.0.254)
I want to allow ssh connections to the router(VM-1) when originated for a server in the internal network with iptables.
So in the router vbox Im using this two commands below:
iptables -A INPUT -s 10.160.10.4 -d 10.160.10.254 -p udp --dport 22 -j ACCEPT
iptables -A INPUT -s 10.160.10.4 -d 10.160.10.254 -p tcp--dport 22 -j ACCEPT
To test if this is working Im trying to use netcat.
In the internal network machine Im using nc -lu 22
command and in the external network machine Im using nc -u 193.160.10.4 22
command, but nothing is appearing.
Do you know what needs to appear and how to use netcat corretcly to test the iptables rules?