OK the routers are presumably doing NAT (Network Address Translation), i.e. the router is connected to 2 networks and as packets pass through it it translates the addresses in the packet from 1 network to the other. The router itself has 2 addresses, 1 on each network.
If you connect to a web-server on the internet what happens is
- Your computer sends the request to your router (which is in your computers network configuration as its gateway address)
- Your router sees the request, assigns a port for the connection, stores a record in an internal table matching the port it assign and its external IP address with your computers IP address and the port your computer used. Replaces your computers address and port in the packet being sent with its own and forwards the packet onto the destination.
- The packet may traverse several more NAT routers doing the same thing with-in you ISPs network before reaching the internet but we'll ignore that it just adds more layers of the same thing.
- The packet arrives at the web-server which sends reply to the senders address in the packet, that is the address and port provided by the router.
- The packet arrives at your router, it checks in its internal tables for a record matching its external IP address and port number it received on, which it finds so it substitutes the ip address and port in finds in that record (the ip and port of your computer) back into the packet as the destination and forwards it onto your computer on the internal network which receives it and displays the data in your browser.
This is all very well the problem is that if you connect to someone else's router you will connect to its external address (assuming it is visible to the internet/network) but the router will have no entry in its internal tables telling it where to forward the packet to, it will be unable to do anything.
There is a way round this that most routers support, you program the router with a permanent port redirection, for example you program it for forward everything received on port 42321 to a specific ip address and port on the internal network. Obviously this has to be the ip address and port for the receiving computer. Then when the router receives an external connection and packets on that port it can forward the packets to the correct destination.
Of course that is rather dependent on the router being visible on the internet either using DNS (having an assigned URL) or having a static IP address (unlikely) or you can use something called dynamic DNS which accounts for the changing ip address of the router and keeps a url pointing at it.