Real Software Forums
http://forums.realsoftware.com/

Basic Networking Question: Public vs. Local IP Addresses
http://forums.realsoftware.com/viewtopic.php?f=2&t=30168
Page 1 of 2

Author:  FlyingPenguin [ Thu Sep 24, 2009 1:30 pm ]
Post subject:  Basic Networking Question: Public vs. Local IP Addresses

Even after perusing various old threads in this form that seem to bear on my question, I still can't figure out if it's a simple question or a complex one, and I'm just confused--though I just can't see how what I want to do could possibly be too difficult. Bear in mind that I (alas) know next to nothing about networking and the internet and have, for whatever reason, always found the subject hard to wrap my brain around.

I'm just trying to figure out how to set up an app that can connect to other instances of itself on other computers via the internet. I get the basics of how to use a socket, but I'm stumped by the complexities of IP addresses. If I have multiple computers connecting to the internet via a wireless router (which is in turn connected to a cable modem), what IP address can a computer somewhere else use to connect to one of mine? It's my understanding that I have a "public IP address" from my ISP, and then each of my computers has a local IP address that's assigned by my router and meaningful only within the context of my own little network...right? So a computer somewhere else can't send to one particular computer's "local" IP address...but the "public" one isn't specific to any *one* of my computers, so that doesn't seem right either. Can someone please educate me a bit on this?


Thanks!

Author:  DaveS [ Thu Sep 24, 2009 2:12 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Basically each of the computers on your LAN [local network, ie those computer on THIS side of your router] all have an IP address, which normally startes with 10. or 193.

However, on the OTHER side [the Internet] of your router, your LAN appears as a single IP addreess [this address may be static or dynamic, depending on your ISP, and the services you rent from them]. The only way an external web server knows which of your LAN computers to send a webpage to, is by information coded by your router into the request packet, which is sent back along with the web content.

So the only way for you to write an app that can communicate peer-to-peer via the internet is to employ port-forwarding on your router.... which basiclly pokes a great big hole in your fire wall

Author:  applesource [ Thu Sep 24, 2009 2:16 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

You'll have to get your true IP address. ipchicken.com is good for that.

Then you'll have to connect up to your apps using that IP address, but you'll also need to set up port forwarding on your router.

Forward the port(s) that your app uses to the router IP of the computer you want to connect to. For example, if your machine has an IP of 192.168.1.100 and it uses port 8980 you'd forward port 8980 to 102.168.1.100 - then just connect to your machine via the true IP you got from ipchicken.com and make sure you're connecting up to the correct port you forwarded, and everything should work just fine.

Author:  timhare [ Thu Sep 24, 2009 2:49 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Port forwarding limits you to a single local machine. You couldn't have an outside computer talk to more than one of your local machines, or have one outside computer talk to one local machine while another outside computer talks to a different local machine. That may not be an issue for you, but be aware of the limitation.

Most peer-to-peer networking uses a public machine as a go-between, either as a relay or to at least initiate the conversation. You can poke a hole in your firewall for your own enjoyment, but it isn't recommended for more than just you and your friends.

Tim

Author:  FlyingPenguin [ Thu Sep 24, 2009 3:17 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Thanks for the responses.

Tim, your info addressed what was the most puzzling aspect of this, to me. I had read elsewhere about all of this port forwarding business, but I was baffled, because obviously there are plenty of apps floating around that let you connect across the internet without having to muck with this kind of thing...so I assumed I had to be missing something. If I understand you correctly, what you're saying is that such apps accomplish this by having both machines connect to some third party (like a website) to initiate things? That makes sense (even if it also isn't what I want to hear...). Bafflement un-baffled!

Dave

Author:  timhare [ Thu Sep 24, 2009 3:39 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Quote:
what you're saying is that such apps accomplish this by having both machines connect to some third party (like a website) to initiate things?

Exactly.

Author:  applesource [ Thu Sep 24, 2009 3:49 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Yes, the most user-friendly and common method floating around these days is a public server/website connecting between the two (or more) communicating machines.

Author:  pony [ Fri Sep 25, 2009 1:09 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

timhare wrote:
Port forwarding limits you to a single local machine. You couldn't have an outside computer talk to more than one of your local machines, or have one outside computer talk to one local machine while another outside computer talks to a different local machine. That may not be an issue for you, but be aware of the limitation.


May not be relevant in your instance, but FYI:
You can port forward to more than one machine.
It is perfectly acceptable to have inbound traffic on port 8001 (for example) forward to machine 1 on the LAN on port 22, then inbound traffic on port 8002 forward to machine 2 on the LAN on port 22 etc.


This opens up possibilities if the client application is HTTP aware, and understands redirects.
using an example of having two web servers on your LAN, but only one real IP address:
It is perfectly acceptable to have inbound traffic on port 8001 (for example) forward to machine 1 on the LAN on port 80, then inbound traffic on port 8002 forward to machine 2 on the LAN on port 80 etc.

Using a redirection service you could forward traffic to http://www.My1stGreatSite.com to your real IP address on port 8001 (machine 1), and traffic to http://www.My2ndGreatSite.com to your real IP address on port 8002 (machine 2)

Using a service like http://www.dyndns.com (their redirect is called WebHop Redirect) you could give every one of your machines on your LAN a DNS entry with the ability to accept inbound traffic to port 80 on each local machine. You'd add the records at http://www.dyndns.com and the corresponding port forwarding in your router.

Author:  Thom McGrath [ Fri Sep 25, 2009 1:17 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Has anybody written a UPnP and or NAT traversal framework for REALbasic yet? More and more apps are utilizing the technology, and it's quite effective for peer-to-peer communication.

Author:  Nux [ Sat Sep 26, 2009 3:00 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Unfortunately UPnP is not widely supported in an enterprise environment. Although I'm only speaking from the aspect of the 800 lb Gorilla Cisco,.. Upnp is more widely supported in the Home market,

anybody who is new to Networking I would recommend looking at this site, http://www.tcpipguide.com/free/index.htm

it has a lot of information.

Author:  Thom McGrath [ Sat Sep 26, 2009 5:04 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

Correct, but I would imagine the average deployment of UPnP would be to home market, since the enterprise users know how to handle port forwarding and all that jazz. The average home user doesn't know how, and generally doesn't care to know how, they just want it to work.

Author:  JustSomeGuy [ Fri Oct 02, 2009 2:11 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

thommcgrath wrote:
Has anybody written a UPnP and or NAT traversal framework for REALbasic yet? More and more apps are utilizing the technology, and it's quite effective for peer-to-peer communication.


Yes I did a UPnP module in RB.
I will get your external IP address and also it will open ports. (For UPnP enabled routers)
Is it well tested? Nope. but it works for my linksys.

Author:  pony [ Fri Oct 02, 2009 6:13 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

JustSomeGuy wrote:
Yes I did a UPnP module in RB.
I will get your external IP address and also it will open ports. (For UPnP enabled routers)
Is it well tested? Nope. but it works for my linksys.


Want to share?

Author:  JustSomeGuy [ Sun Oct 04, 2009 2:23 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

pony wrote:
JustSomeGuy wrote:
Yes I did a UPnP module in RB.
I will get your external IP address and also it will open ports. (For UPnP enabled routers)
Is it well tested? Nope. but it works for my linksys.


Want to share?


Sure, I'd love to. Where can I post the project?

Author:  pony [ Sun Oct 04, 2009 2:35 pm ]
Post subject:  Re: Basic Networking Question: Public vs. Local IP Addresses

JustSomeGuy wrote:
Sure, I'd love to. Where can I post the project?


The ARBP has a source code repository.
Whilst key areas of the site are not free, the source code section is available for free

http://www.arbpmembers.org/

You'll probably have to email them to ask them to put it on there. I tried to upload some source and just got "You have no permitted upload categories - please refer to the webmaster."

contact:
http://www.arbpmembers.org/index.php?op ... 1&Itemid=3

Page 1 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/