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 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."


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 - external IP.

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

Assuming the router which produced 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...

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
F-J-KAuthor Commented:
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
and i did port forwarding on port 4532 to private IP
Assume the calling client wants to connect to, 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?!
Fred MarshallPrincipalCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Network Security

From novice to tech pro — start learning today.