LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-28-2016, 07:32 PM   #1
snowmagician
Member
 
Registered: Sep 2016
Distribution: Kubuntu
Posts: 62

Rep: Reputation: Disabled
Talking I was always afraid to ask this question


There are many millions of websites and also many millions of users, but each user gets his own unique IP address

How is it possible to let everyone have a different IP address?

256 x 256 x 256 x 256 = I think the result here is not enough to let everyone have a different unique IP address and websites to have a different ip address.
 
Old 10-28-2016, 07:41 PM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Not everyone has a unique IP address thanks to NAT, and things like CIDR are used to attempt to make the best of the addresses that there are.
However, we are on the cusp of IP version 4 exhaustion which is why IP version 6 is slowly creeping upon us.
 
2 members found this post helpful.
Old 10-28-2016, 07:41 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,310
Blog Entries: 28

Rep: Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136
That's why ipv6 is a thing.

Also, there's this: say you have a little home network or even a larger business network. The network is behind a router. The router has one public ip address, say, 68.xxx.xxx.xxx.

Inside the network, each computer has its own ip address in the subnet. For a home network, that's usually something like 192.168.xxx.xxx. Each computer does not have a public ip address because it's communicating via the router, not directly to the Big Wide World.

The computers in my home network no doubt have the same ip addresses as computers in many other home networks, but, as they are behind a router with a unique public ip address, that's okay. It's called "subnetting."

Here is the best tutorial I've ever seen about subnetting. Don't be put off by the web 1.0 appearance: it's solid, well-presented, and clearly explained: http://www.ralphb.net/IPSubnet/index.html

Last edited by frankbell; 10-28-2016 at 07:44 PM.
 
2 members found this post helpful.
Old 10-28-2016, 07:42 PM   #4
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
According to this post
http://stackoverflow.com/questions/2...ipv4-addresses

There are 3,706,452,992 public addresses. I also understand that is running out though.

Otherwise, using NAT allows for several computers from one ip address
 
2 members found this post helpful.
Old 10-28-2016, 08:21 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,675

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
Most users have a dynamic IP address. An ISP assigns an address from a block using DHCP when you connect. Even though there are millions of internet capable devices many are not connected on line so DHCP provides a way to release those addresses and assign them to someone else. Although with broadband MODEMS that are always on this does not happen as much.

A home router works in a similar fashion but assigns private addresses.

Last edited by michaelk; 10-28-2016 at 08:48 PM.
 
2 members found this post helpful.
Old 10-28-2016, 09:32 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,973

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Many sites use Host headers to direct web pages.

https://russlescai.wordpress.com/201...ers-in-apache/


Depending on the server the method to allow many FQDN's to access a single IP is usually in documents. Some very old servers and web browsers need a special directional web page.

Last edited by jefro; 10-28-2016 at 09:37 PM.
 
2 members found this post helpful.
Old 10-29-2016, 01:47 PM   #7
snowmagician
Member
 
Registered: Sep 2016
Distribution: Kubuntu
Posts: 62

Original Poster
Rep: Reputation: Disabled
Thanks a lot for your awesome and intelligent responses. I have looked up for more information and definitely gained some awesome information.

Two things I am wondering

I learned that gateway is used when a host ( a device on a network ) must send date to another host on another network. Is the gateway address still used when a host needs to send data to another host within the same address?

And I also learned that broadcast address is network address followed by all 1s for example this is a network address 192.168.255.255

The broadcast address is used when a host needs to send a message to ALL devices within network ( hence the name "Broadcast" ) Could you give me a real-world practical example of broadcast address being used? Thanks a lot.
 
Old 10-29-2016, 01:51 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
The gateway IP is only used to communicate with devices outside of the same subnet -- within the same subnet devices communicate using their own IP addresses.
Broadcast messages are sent, for example, when giving a DHCP reply -- that is, an IP address assignment and other details from a server.

Last edited by 273; 10-29-2016 at 01:53 PM. Reason: Realised I'd over simplified.
 
2 members found this post helpful.
Old 10-29-2016, 03:52 PM   #9
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Just to explain my edit, I originally typed that broadcasts are sent when sending a DHCP request (that's what it says in the books) then I realised that before a DHCP request is fulfilled the sending device doesn't know the subnet mask so doesn't know what the address is to send a broadcast to the subnet. I'd never thought of that before as I'd assumed that the request was sent at a lower layer of the stack but I assume now that it's sent to 255.255.255.255 in the expectation that the network is set up in such a way that that packet will reach the nearest DHCP server (logically)?
 
1 members found this post helpful.
Old 11-02-2016, 09:33 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,636
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
Let's consider how you, and all your kids (brothers, sisters) are able to use your home network to communicate with the Internet ... all at the same time, through one outgoing wire.

The network within your home uses one of the private network-address ranges that have been set-aside for this very purpose. (Most likely, it is 192.168.x.x.) There will never be a computer "on the Internet at large" which uses any of these addresses: they are set aside for internal networks.

Your home's internet router probably has the internal address of 192.168.1.1, and, if you issue the route command (or its equivalent for your OS ...) on your computer, you will find this address listed as the default gateway.

What this means is that, in order to communicate with "LinuxQuestions.Org" at its public address of (say) 75.126.162.205, your computer sends the traffic, as it were, through the gateway to get there.

Your router is sitting on two networks at the same time: internal, and The Internet. On the Internet, it has whatever IP-address was assigned by your provider. It routes your LQ traffic to LQ. And, when LQ responds with a beautiful web-page, your router returns the traffic to you. (Not to your sister.)

It does this through a simple trick called NAT = Network Address Translation. The message that is sent to LQ comes from the (public) IP-address assigned by your provider, with a random "port number" chosen on-the-fly by your router. When LQ replies, your router invisibly uses that port-number (which it remembers) to send the traffic to you ... and not to your sister. (It strips-off the port number before sending the data to you.)

The concept of a "port number" is very much like an "extension" in a company telephone exchange that is reached through a single phone-number, but that analogy is a loose one. The port-number in this case simply "is part of the return-address portion of the message," which LQ('s router ...) will send back to your router verbatim.

IP-addresses are not necessarily fixed. Every now and then, your Internet provider might change the IP-address that's used by your router. (It can do this through good ol' DHCP.) Addresses are generally grouped by geographic area but this is only approximate.

"IPv6" replaces the 32-bit IP address with a much, much larger number. Some routers know how to use IPv6, and some internet providers are actively using those addresses right now. Therefore, when you design an Internet server-application, you should not presume that the address that you'll receive has the format w.x.y.z.

Last edited by sundialsvcs; 11-02-2016 at 09:38 AM.
 
Old 11-02-2016, 11:01 AM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by snowmagician View Post
I learned that gateway is used when a host ( a device on a network ) must send date to another host on another network. Is the gateway address still used when a host needs to send data to another host within the same address?
The netmask setting on your computer tells it which IP addresses are part of the subnet and can be accessed directly, versus which are not part of the subnet and must be accessed using the gateway. A typical netmask is 255.255.255.0, for this explanation it's a bit easier to write it in binary:
11111111.11111111.11111111.00000000

A '1' means "if my local IP has this bit set, then the IP I'm trying to access must also have this bit set in order to be considered local". A '0' means it does not need to match. So a netmask setting of 255.255.255.0 means that if the first three sets of numbers in the IP you're trying to access exactly match the machine's local IP, then it's an address on the local subnet and can be accessed directly. If any of those first three sets of numbers is different, it's not on the local subnet and the machine needs to pass the connection through the gateway.

Note that netmasks can also be set using shorthand like /24, eg: 192.168.1.1/24. The /24 means that the first 24 bits in the netmask are set, this is the same as 11111111.11111111.11111111.00000000, or 255.255.255.0.

Last edited by suicidaleggroll; 11-02-2016 at 11:03 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] I want to try Slackware, but I'm afraid. MrEvilBreakfast Slackware - Installation 3 05-23-2015 03:39 PM
LXer: Are You Afraid...? You Will Be... LXer Syndicated Linux News 0 07-17-2009 04:00 AM
Why I am afraid to use Linux (some help please) old6598 General 1 04-07-2007 05:45 AM
about KDE i'm afraid ;) yoron Slackware 2 01-18-2006 01:04 PM
Afraid I Have Been Compromised robpom Linux - Security 12 03-31-2005 12:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration