The Internet Protocol (IP) refers the set of protocols that define the modern Internet’s network layer. It is split into two protocol versions that are widely used today: the older IPv4 and newer IPv6, both of which have different specifications. IP packets are called datagrams.

Addresses

An IP address is a string that uniquely identifies a host machine or router interface (basically a port). An interface is the connection between the host/router and the physical link. Routers typically have multiple interfaces. A host typically has one or two interfaces (like a wired Ethernet or wireless link). It is paired with a port number that uniquely identifies a given process.

An addressing scheme is defined as a standardised method for identifying and locating devices on a network.

Address allocation

A host gets an IP address by 2 mechanisms:

  • It’s hardcoded by the sysadmin in a config file.
  • Or determined dynamically by DHCP.

IP address assignment reflects the physical topology of the network. This follows continental/national boundaries, and as such IP addresses are assigned on this basis.

The network gets allocated a subnet of the ISP’s address space, which is then allocated in blocks. A mechanism called hierarchical addressing scheme called route aggregation. This essentially allows the ISPs to advertise that all traffic should come to them if the address matches a CIDR mask. If there are conflicting advertisements (for multiple ISPs), the more precise advertisement is taken (similar to longest prefix matching).

ICANN allocates IP addresses to 5 regional registries, who then allocate to more local ISPs.