16

How are IP addresses assigned? What if someone from USA and someone from Australia connected to the internet at the same time - how would they not have the same IP address?

1
  • 1
    Why is this computer software/hardware related? because, if you mess up with your IP address, you cannot reach Superuser in the first place -- even, to attempt the other questions you might have to post/answer there ;-)
    – nik
    Jun 12, 2010 at 10:58

3 Answers 3

21

Because public IP addresses are not picked at random, they are allocated by your Internet Service Provider; who in-turn gets a block assigned to them from the next level, and so on to IANA/ICANN.
Think of this as, only ICANN give IP addresses YOU cannot :-)
In your home or college network usually you would use private IP addresses, and might have statically assigned IPs or let your home router do a private IP allocation. These are not visible (or routed) on the Internet. You will find many people use the IP address 192.168.1.1 at their homes, for example, and yet there is apparently no conflict. This is because their home router 'translates' (very crude use of that word here) to the ISP allocated address -- which is what others on the Internet will see.

You might think of this private IP address as a local reference (like, take that left on the next block to reach the cake shop?) for your home router to find your machine in the home network.

If you tried to use a 'public' IP address at random, the ISP will not accept it and you will see no network connectivity.


Update:
If you want to dig deeper on why an ISP might want to check what source IP you are using, read through the interaction in comments here... Or, head straight to Wikipedia Smurf Attack.

In the late 1990s, many IP networks would participate in Smurf attacks (that is, they would respond to pings to broadcast addresses). Today, thanks largely to the ease with which administrators can make a network immune to this abuse, very few networks remain vulnerable to Smurf attacks.

The fix is two-fold:

  • Configure individual hosts and routers not to respond to ping requests or broadcasts.
  • Configure routers not to forward packets directed to broadcast addresses. Until 1999, standards required routers to forward such packets by default, but in that year, the standard was changed to require the default to be not to forward.3

Another proposed solution, to fix this as well as other problems, is network ingress filtering which rejects the attacking packets on the basis of the forged source address.

Thanks to Andy for making me recall this.
You might also be interested in in this ServerFault question by Jeff: Are IP addresses “trivial to forge”?

20
  • If you try to use a public IP address at random, regardless of anything else, any return packets will end up on the wrong network at the wrong host, so you won't be able to have two-way comms.
    – Andy
    Jun 12, 2010 at 11:11
  • @Andy, actually the transmitted packets are likely to get dropped themselves. The point is, you cannot convince the ISP network devices to use your choice of IP address. They will not accept it.
    – nik
    Jun 12, 2010 at 11:47
  • @nik Totally! I focus on the return path because for me, whether or not your outgoing packet is dropped is a detail (maybe it will, maybe it won't); the fundamental reason you can't use an arbitrary IP address is that you break the routing system, which shows up on the return journey.
    – Andy
    Jun 12, 2010 at 12:07
  • @Andy, Umm, the packet with this 'spoofed' source IP will be dropped -- So, analysis of return path is really just theoretical musing. Look at the ifconfig (or ipconfig on Windows) output of your Internet connected machine. You will see two more things associated with your IP address: a subnet mask and a default gateway ip address. Think about what you will setup as the default gateway if you were to change your IP address say from 'a.x.y.z' to 'b.x.y.z'. Changing it won't work. Now, think further on what that gateway machine will do to your changed-source-IP packet...
    – nik
    Jun 12, 2010 at 12:45
  • @Nik Don't see the problem. Sure if you spoof as a.b.c.d/24 and access a.b.c.d+1/24 you'll have problems. But as long as the dest appears to be in a different subnet, the default gateway'll be used, and once we're at routers, only the dest addr is used no? (I don't get your problem with the gateway machine.) We can modify our subnet mask to make (nearly) all addresses appear to be on a different subnet. Or just configure our host to send all packets to the default gateway. That's why I feel it's details - it's absolutely impossible for the return packets to find you. Have I missed something?
    – Andy
    Jun 12, 2010 at 14:19
12

The assignment of addresses is managed in a hierarchal fashion. At the top of the chain is

Internet Assigned Numbers Authority

They are responsible for the global pool from which they allocate blocks to the

Regional Internet Registries

who are responsible for specific regions of the world. They in turn, allocate from their blocks, to the

Local Internet Registries

or if you prefer Internet Service providers.

Because of the way the address blocks are allocated every global Internet address is unique.

1

IP addresses are assigned by ICANN, so that won't happen. But there's also a more fundamental reason. IP addresses are used for routing. When a packet comes into a router, it compares the IP address against entries in its routing table, and sends the packet on through the appropriate outgoing line. So IP addresses aren't just arbitrary numbers that are assigned - they are meaningful addresses.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .