Advertisement

2 pcs on same router with same IP, server cannot be accessed

Started by December 23, 2009 01:49 AM
4 comments, last by ApochPiQ 14 years, 10 months ago
Hi, I have a server application that is accessed by having its dynamic IP updated with a service like dynalias so that it can be accessed at anytime, even if the IP changes. That works fine but when I have a second computer on the same router, then both machines have the same IP and the server cannot be accessed anymore. I contacted my internet provider who told me they cannot do anything (like splitting?), but that there might be a software solution to my problem. They talked about IP tunnel. I searched that term up but it seems it is not applicable to my problem. So my question: does anyone know a solution to my problem? Is there maybe a piece of software that I can install that will help me? I mean even if both machines have the same IP, the packets are somehow reaching the right pc when web surfing for instance. Forgive my ignorance in that field and thanks EDIT: well, both PCs are given a separate IP by the router, but after the router, it looks like the same IP
Heya!

Like you noticed, both computers on your router have unique internal IPs (a 10. or 192. address) but share the same IP to the rest of the internet.

Because of that, when someone says "connect to this IP" the router has no clue which computer to connect to and you hit the problem you are seeing.

The solution is to set up "port forwarding" on your router.

for instance, if your server program runs on port 31337, you go into your router setup and tell it to forward port 31337 to the computer which has the server running on it.

if you set up port forwarding, it will know which computer to use and people will be able to connect to your server still.

You'll want to make sure the computers use static IP's on the LAN so that they don't change. If they did change, youd have to update the port forwarding settings each time.

hope this helps!
Advertisement
Thanks a lot for the quick reply Atrix256,

It is good to hear there is a solution to my problem. Before I can proceed, there are still a few points that I don't understand:

On my server PC, I have two server applications listening on port 21048 and port 80 respectively.

Are you talking about thoses ports? This means all I have to do is forward those two ports to my server PC on the router. But will web browsers still work on the other PC (I vaguely remember that webbrowsers are using port 80)?

Then I will also have to configure my router to assign static IPs to my two PCs, is that right?

Thanks a lot
Yep you got it.

And it's fine you are port forwarding port 80 to one computer, you will still be able to use your web browser on the other computer.

the reason is because port forwarding only worries about incoming ports not outgoing, so it will work just fine (:
Quote: Original post by floatingwoods
But will web browsers still work on the other PC (I vaguely remember that webbrowsers are using port 80)?

Port forwarding is for incoming connections on port 80; other nodes on the Internet that connects to you on port 80. Web browsers do use port 80 (normally), but that is an outgoing connections; you connect to another node on the Internet on port 80. So there is no problem, as the port forwarding will not interfere with outgoing connection on a port used for forwarding.
Quote: Original post by floatingwoods
Then I will also have to configure my router to assign static IPs to my two PCs, is that right?

You need to know the address of the computer on the internal network to forward to, so a static IP for that is probably the easiest way (you can use DHCP still, but with a static mapping from MAC to IP, for example). The other computers can use dynamic addresses.
This really has nothing to do with programming, so I'm kicking it over to the lounge.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement