Networking questions

Started by
1 comment, last by BeerNutts 12 years, 4 months ago
1. How would a public computer access a server on a private network? I know that the router would use NAT to create sub addresses for each computer on the private network, but in the example where the ISP has only provided a single unique IP address for that router, this means that from outside the private network, each computer is seen as having the same IP address, so how would a computer on a public network, say the internet, address a particular computer on the private network (the server)?

Lets say I wanted to have a MySQL server run on a computer behind a router, and I wanted to access that with a SQL client on some other computer around the world. How would I know what address to use with the client?

2. In the same example of a private network behind a router using a single IP address provided by the ISP. When a computer on the private network sends data to some server on a public network, NAT is used to create a packet as if produced from the Unique IP address assigned by the ISP, but how does data from the server get sent back to the correct computer on the private network when recieved by the router? ie, what data is stored in the packet that is sent and received? I assume its the ISP IP address, the port, and something else to distinguish the address of the correct private networked computer, but what?
Advertisement
I use a VPN to do such things (Hamachi, specifically). Not sure if there are other options; it'd be cool to learn about them if there are though.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
You say you understand NAT, but the 2nd question imply you don't know the full story.

Anyway, for #1, On your private network router, you'd set specific ports for data to be forwarded to a specific PC on the private Network. Then, when a computer out on the internet wants to connect to it, it would have enter the Router's external IP address (assigned by the ISP) and one of the specific port's that is being forwarded. You can use dynamic DNS to handle the possible changing IP address of your router (dyndns.org).

#2, NAT handles all of this. When a PC sends data to another IP address on the internet, the router stores which which home network IP address is communicating to which external IP address computer. When datat comes back to the router, it matches the IP address and port, and sends the data on to the original PC that initiated the send.

You should do more research on NAT to get a better explanation than the one I gave you for #2.

Good Luck!

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

This topic is closed to new replies.

Advertisement