• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 883
  • Last Modified:

Internal IP & External IP. How Client Knows to Which Server to Connect to Since External IP is the Same for All PC's in LAN

"your external ip address in given by your internet provider...one internet connection = one external ip address. Your internal ip's are different because each computer is assigned an address by your router/modem dhcp. Your router/modem knows what computer sent request for info and when received back it knows what internal ip to send it to. All packets are tagged so they are routed correctly in the internal lan."

Question:

Lets say i have a simple echo server in a pc behind a router. I made this server listens on port 4532. Assume server resides in 32.223.133.88 - external IP.

Now, i run a client in a completely different LAN. This client connects to 32.223.133.88/4532 ....

Assuming the router which produced 32.223.133.88 external IP has 50 PC's. All these 50 PC's carries same external IP Address.

How come my client knows on which pc to connect since there are 50 PC's and there maybe 20 PC's which listens on port 4532. Every PC of these 20, listens on 4532 for its own purpose in doing different functionality.

Note: lets say my client wants to connect to PC no. 9 to receive some data from the server.exe in PC no. 9 .....

I find it confusing as i do not find away to connect to the PC i'm aiming for since all external IP are same...

I hope you get my question...

Thanks
0
F-J-K
Asked:
F-J-K
  • 2
1 Solution
 
Darius GhassemCommented:
In your router setup you need to setup port forwarding to forward all requests for the port to the local PC no 9. This is a setup that you must configure for the router to know where to forward the request too. If you don't the router doesn't no where to route the request to.
0
 
F-J-KAuthor Commented:
thanks
0
 
F-J-KAuthor Commented:
Ops, i got a question!

What if more than one PC uses port 4532?

Assume i forwarded port 4532 to private IP 192.168.0.101
and i did port forwarding on port 4532 to private IP 192.168.0.105
Assume the calling client wants to connect to 192.168.0.101, but as you know client relies on my external IP only...

How come my router will know which PC the calling client wants to connect to?!
0
 
Fred MarshallCommented:
You could also ask the same question regarding how different applications on a particular computer get their packets from the outside world.  What if you have Internet Explorer and Firefox running at the same time?  Somehow it all gets worked out.

"ports numbers" are an extension to the IP address - that's a handy way to think about it.  They aren't physical ports.  
An analogy is the Post Office and the Post Office Boxes.  The Post Office is a "physical port" and the Post Office Box numbers are extensions that allow internal stuff to happen.  Not a great analogy perhaps but I hope you get the idea.

When a packet leaves a computer on the LAN, it has a port number for the specific application that sends the packet and expects a response.  Then, when the packet arrives at the router, the router adds a port address that identifies the particular computer.  Then, when packets return, they can be routed to the particular computer and to the particular application.

When you set up a specific port manually on a computer then that's the port for the application.  The port for the computer still has to get appended.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now