I have set up port forwarding for my network to be able to ssh into my server from outside the network (let's say external port 10122 maps to internal port 22 for 192.168.1.101).
Let's say my computer has the IP 192.168.1.102, the server has 192.168.1.101
I can do ssh root@192.168.1.101 and it will work.
I can do ssh -p 10122 root@<public IP> and it will work ONLY if I'm not connected to the local network
Why is it that I can't invoke ssh -p 10122 root@<public IP> from within the network?
I googled around and only getting information on how to do port forwarding or use iptables to open ports (but this is all already working).
EDIT: I don't need to use the external IP to access an internal machine, I've hit this problem more than once and would like to know more and be able to explain why if someone were to ask me.