LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I got a fundamental question about ip addresses (https://www.linuxquestions.org/questions/linux-newbie-8/i-got-a-fundamental-question-about-ip-addresses-645727/)

trist007 05-29-2008 09:18 PM

I got a fundamental question about ip addresses
 
I have some computers behind a router at my apartment. I understand some fundamentals about ip addresses. I setup a web server on one of those computers. I unfiltered port 80 on that computer and on the router, I port forwarded http requests on port 80 to the internal ip address of that computer that's running the web server.

My question is.

I noticed that in order to view that web page outside of the network, I'd put in the external ip address of the router, which would forward the http request to port 80 on that computer running a web server. So are the external ip addresses for the router and the computers behind the router the same? I mean, I went to www.whatismyip.com on each of those computers behind the router at my apartment and they all had the same external ip address as the router.

For instance, let's say the internal ip address of one computer is 192.168.1.103

How would I get to that computer from outside the network without having the router port forward the request?

Would the external ip address of that computer with the internal ip address of 192.168.1.103 be something like 34.83.42.11 (external ip address of router, fake btw) plus something appended to it. Maybe like
34.83.42.11 3321 ?

How do I find out the distinct external ip address of that computer? Does it depend on the netmask or something?

Could somebody explain this?

Emerson 05-29-2008 09:27 PM

Quote:

How would I get to that computer from outside the network without having the router port forward the request?
You cannot.

http://en.wikipedia.org/wiki/Network...ss_translation

centralb 05-29-2008 09:57 PM

In your situation, your ISP is effectively giving 1 public IP address to your router.

That is the only public IP address involved here.


All the computers INSIDE your network (behind the router) have *private* IP addresses used for local networking. Those addresses only work inside the router.


Forwarding allows outside systems to start communications with only the inside computers that have router ports forwarded to them.

gzunk 05-30-2008 08:52 AM

Also, if packets addressed to private IP addresses are encountered by routers on the internet, they are supposed to drop them. See http://www.faqs.org/rfcs/rfc1918.html, Section 3 for more details.

sundialsvcs 05-30-2008 07:11 PM

Consider for a moment what a router actually does, and how it does it.

You've got three or four computers on one side of the router, all talking to the Internet through one cable that hooks into your cable-modem or DSL line. You have one IP-address as seen by the Internet: all three or four computers are all using the same (Internet-facing) IP.

How does this work? In exactly the same way that a gigantic company can have just one external phone number. When you want to talk to Joe Schmedly, you call that number and ask for extension 12345, Joe answers.

In TCP/IP parlance, that "extension" is called a port number. The various outbound packets that are sent by the various computers inside your shop are seen as coming from (and being directed to) specific port-numbers. All of this magic is handled invisibly by the Router.

On the inward-facing side, the Router can route packets directly from one computer to another, if those addresses are "inside." Various addresses, like "192.168.x.x," are by-convention defined to be "inside only." It also defines one internal IP-address for the so-called "gateway." That's how outward-bound traffic gets delivered to the Internet.

culaterout 05-31-2008 04:06 AM

Quote:

Originally Posted by sundialsvcs (Post 3169874)
Consider for a moment what a router actually does, and how it does it.

You've got three or four computers on one side of the router, all talking to the Internet through one cable that hooks into your cable-modem or DSL line. You have one IP-address as seen by the Internet: all three or four computers are all using the same (Internet-facing) IP.

How does this work? In exactly the same way that a gigantic company can have just one external phone number. When you want to talk to Joe Schmedly, you call that number and ask for extension 12345, Joe answers.

In TCP/IP parlance, that "extension" is called a port number. The various outbound packets that are sent by the various computers inside your shop are seen as coming from (and being directed to) specific port-numbers. All of this magic is handled invisibly by the Router.

On the inward-facing side, the Router can route packets directly from one computer to another, if those addresses are "inside." Various addresses, like "192.168.x.x," are by-convention defined to be "inside only." It also defines one internal IP-address for the so-called "gateway." That's how outward-bound traffic gets delivered to the Internet.


Like that simple explanation


I still like to use Airport explanation

meaning The tower controls the airplanes from landing so u wouldn't want two airplanes to land on same run way or you have crash.... same idea two packets addressed to two different computers cant land on the same computer or a crash session...


But I like that........ great idea ;)

seraphim172 05-31-2008 04:42 AM

IP addresses starting with 192.168 are always private. There is also a range below 172 that is private (can't remember now). 127.0.0.1 is also private, it's the current machine.

You need port forwarding because everything from the outside is addressed to your public address, and you have to direct it to the proper PC on your private network. In your case a public web server, due to port 80.

Linux Archive

Nylex 05-31-2008 04:50 AM

Quote:

Originally Posted by seraphim172 (Post 3170148)
There is also a range below 172 that is private (can't remember now)

10.x.y.z :).

trist007 05-31-2008 07:59 AM

What would happen if you're on a computer that is outside my network and you receive packets from one of the computers in my internal network?

Let's say the computer from outside the network receives packets from computer A in my internal network trying to view a web server on the computer outside the network on it's port 80. In the packet logs, it'll show that the packet came from the router's public address.

However, what if the computer from outside the network receives another packet from computer B in my internal network trying to view a web server on the computer outside the network on it's port 80. In the packet logs, it'll show the packet came from the router's public address right? Would the source ip look any different at all?

Cause I think I remember seeing some number appended to the end of the source ip address specifying that private computer.

I'd test it out, but I don't have an external computer to use atm.

Emerson 05-31-2008 08:17 AM

I see you didn't bother to read the Wiki article I linked to. :(

trist007 05-31-2008 09:15 PM

Had only scanned, but I just read it right now. Might get rid of my router and replace it with a firewall with ips.

culaterout 06-02-2008 12:38 AM

lol keep the router


later....


All times are GMT -5. The time now is 02:38 PM.