I did setup openwrt on a tp-link router. There is a simple configuration now, WAN link I simulate connecting ethernet RJ45 port with my laptop's RJ45 network adapter port (IP on WAN interface is set DHCP from range 192.168.137.0/24, where my laptop's inteface has 192.168.137.1)
In openwrt firewall settings I configured access to drobbear/ssh server by forwarded port 22001:
config redirect option src wan option src_dport 22001 option dest lan option dest_port 22 option proto tcp
I can login from my laptop to openwrt via "network cable" (WAN interface on router), however one thing is strange - I can use any IP from range 192.168.137.2-254 to access my router's 22001 port. Why?
cygwin$ ./Fping.exe -n 1 -w 2 -A -g 192.168.137.1/192.168.137.254|grep -E '^Reply' Reply from 192.168.137.1: bytes=32 time=0.2 ms TTL=128 Reply from 192.168.137.42: bytes=32 time=0.5 ms TTL=64
Nmap finds only one IP with 22001 port opened (openwrt's):
cygwin$ ./drives/c/Program\ Files\ \(x86\)/Nmap/nmap.exe -Pn -p22001 192.168.137.0/24 Starting Nmap 7.80 ( https://nmap.org ) at 2019-12-23 21:22 CET. Nmap scan report for 192.168.137.42 Host is up (0.00s latency). PORT STATE SERVICE 22001/tcp open optocontrol MAC Address: 68:FF:7C:B3:C1:14 (Tp-link Technologies) Nmap scan report for 192.168.137.1 Host is up (0.00s latency). PORT STATE SERVICE 22001/tcp closed optocontrol Nmap done: 256 IP addresses (2 hosts up) scanned in 6.26 seconds
But telnet on port 22001 (and ssh) works on any IP from range 192.168.137.2-254, example:
cygwin$ telnet 192.168.137.123 22001 Trying 192.168.137.123... Connected to 192.168.137.123. Escape character is '^]'. SSH-2.0-dropbear [...] telnet> q Connection closed. cygwin$ telnet 192.168.137.222 22001 Trying 192.168.137.222... Connected to 192.168.137.222. Escape character is '^]'. SSH-2.0-dropbear [...] telnet> q Connection closed.
And indeed, I can 'ssh -p 22001' any such IP to login my router... Could somebody explain it, please?