Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My computer has 2 IP Addresses, one is 192.168.1.100 and the other is 78.x.x.x.

If connecting to a socket, what IP address would a program outside of my network use, and how would it differentiate between two computers on my network?

Isn't the "real" IP address, that of my router, and since two computers on my network share the same router, how can a socket program beyond my router properly form an IP Address to reference say my desktop computer, vs my laptop computer, in the same intranet?

share|improve this question

migrated from stackoverflow.com Feb 12 '10 at 19:07

This question came from our site for professional and enthusiast programmers.

3  
this is a question about home networking and how NAT works. it may be a duplicate but it should not be migrated to ServerFault. –  quack quixote Feb 12 '10 at 20:46
    
I think this question needs to stay on Super User because it deals within home networking as it is currently written. –  Troggy Feb 14 '10 at 4:42
add comment

2 Answers

Port forwarding is the answer.

Network Address Translation (NAT) is what allows you to have one public (WAN) IP address and many private (LAN) ip addresses. As your computers initiate network connections to the internet, something like port forwarding is done on the fly. Ports are opened and closed, redirected and reused. Some applications like bittorrent clients, will use Universal Plug and Play (UPnP) to set up a semi-permanent port forwarding that allows external hosts to connect directly to your computer inside your LAN.

Specific services that need permanent open ports need to be manually specified in your router.

The 78... address is public. The idea is that in your router's configuration, you set up port forwarding. There will be a section where you enter the external port, the internal IP address and internal port.

Here is a fuller description of what port forwarding is.

So assuming the socket you want to use opperates on port 3389 (which is microsoft RDP), you set up in the router so that all connections to 78.12.114.82:3389 get directed internally to 192.168.1.100:3389.

share|improve this answer
add comment

You need to setup port forwarding on your router.

  1. Login to your router's web interface (it would be http://192.168.1.1 on your router)
  2. Go to 'Advanced Routing' or 'Port forwarding'
  3. Set the range of ports you want to use forwarding on (ie. 10,000 to 10,100)
  4. Set the target address to forward the traffic to (it would be your internal ip addr, 192.168.1.100).
  5. Save & thats it.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.