Reputation: 33
I'm connected to the Internet through a local network. I have no public IP address, and, for example, when I go to http://www.whatismyip.com/ it gives me IP address of my router. I'm writing a Java program that uses UDP for sending and receiving packets. So, when I use this program to send packets to my PC within my local network (specifying my PC's local IP as a destination one for the packets) everything works fine. But if I try to use it out of my network it, of course, does not work (the packets are delivered to the router, not my PC).
So, if X is my local IP and Y is my router's IP, can I specify "X in Y's network" as a destination IP address for my packets?
I have no access to the router.
Upvotes: 1
Views: 202
Reputation: 8466
Your router (often DSL-modem) propably uses a NAT. So addresses and port numbers are translated in the router. If you want to send packets to your PC (in local network) from internet, then you should add a port forwarding rule to your router.
If you don't have access to the router, then it is not possible to allow the traffic.
Upvotes: 1
Reputation: 3714
It is not possible because the external server only knows the external address of your router. To the intern address is from the outside no way defined. To solve the problem you can use the port forwarding option of your router.
Packages from server A can't find the way to the private part of your net because:
1. normally the addresses of private nets are not routed (per definition)
2. router 'Internet' don't knows to where the packages should be sent
--------------- ---------------------------- --------------------------------- --------------------
| SERVER A | | Router Internet | | Your router | | Your machine |
| addr net 1 |---------| addr net 1 addr net 2 |-----| addr net 2 addr priv. net |-----| priv. addr |
--------------- ---------------------------- ---------------------------------- -------------------
Upvotes: 2