How are IP addresses assigned?

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?


Solution 1:

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”?

Solution 2:

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.

Solution 3:

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.