Qwertyu Wertyu
Qwertyu Wertyu

Reputation: 33

UDP packets readdressing

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?

UPDATE

I have no access to the router.

Upvotes: 1

Views: 202

Answers (3)

SKi
SKi

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

OkieOth
OkieOth

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

Santosh
Santosh

Reputation: 17913

I assume you are either behind a firewall or proxy. What you are trying to achieving is not possible unless you change setting on proxy/fireall and put your machine in DMZ.

Upvotes: 0

Related Questions