IP Sub-Networking Mini-Howto: The Anatomy of IP numbers

prev-8693644 next-4817533 toc-2985444

Before diving into the delight of sub-networking, we need to establish some IP number basics.

3.1 IP numbers belong to Interfaces – NOT hosts!

First of all, let’s clear up a basic cause of misunderstanding – IP numbers are not assigned to hosts. IP numbers are assigned to network interfaces on hosts.

Eh – what’s that?

Whilst many (if not most) computers on an IP network will possess a single network interface (and have a single IP number as a consequence), this is not the only way things happen. Computers and other devices can have several (if not many) network interfaces – and each interface has its own IP number.

So a device with 6 active interfaces (such as a router) will have 6 IP numbers – one for each interface to each network to which it is connected. The reason for this becomes clear when we look at an IP network!

Despite this, most people refer to host addresses when referring to an IP number. Just remember, this is simply shorthand for the IP number of this particular interface on this host. Many (if not the majority) of devices on the Internet have only a single interface and thus a single IP number.

3.2 IP Numbers as « Dotted Quads »

In the current (IPv4) implementation of IP numbers, IP numbers consist of 4 (8 bit) bytes – giving a total of 32 bits of available information. This results in numbers that are rather large (even when written in decimal notation). So for readability (and organisational reasons) IP numbers are usually written in the ‘dotted quad’ format. The IP number


        192.168.1.24

is an example of this – 4 (decimal) numbers separated by (.) dots.

As each one of the four numbers is the decimal representation of an 8 bit byte, each of the 4 numbers can range from 0 to 255 (that is take on 256 unique values – remember, zero is a value too).

In addition, part of the IP number of a host identifies the network on which the host resides, the remaining ‘bits’ of the IP number identify the host (oops – network interface) itself. Exactly how many bits are used by the network ID and how many are available to identify hosts (interfaces) on that network is determined by the network ‘class’.

READ  Linux Meta-FAQ

3.3 Classes of IP Networks

There are three classes of IP numbers

  • Class A IP network numbers use the leftmost 8 bits (the leftmost of the dotted quads) to identify the network, leaving 24 bits (the remaining three dotted quads) to identify host interfaces on that network.
    Class A addresses always have the leftmost bit of the leftmost byte a zero – that is a decimal value of 0 to 127 for the first dotted quad. So there are a maximum of 128 class A network numbers available, with each one containing up to 33,554,430 possible interfaces.

    However, the networks 0.0.0.0 (known as the default route) and 127.0.0.0 (the loop back network) have special meanings and are not available for use to identify networks. So there are only 126 available A class network numbers.

  • Class B IP network numbers use the leftmost 16 bits (the leftmost two dotted quads) to identify the network, leaving 16 bits (the last two dotted quads) to identify host interfaces. Class B addresses always have the leftmost 2 bits of the leftmost byte set to 1 0. This leaves 14 bits left to specify the network address giving 32767 available B class networks. B Class networks thus have a range of 128 to 191 for the first of the dotted quads, with each network containing up to 32,766 possible interfaces.
  • Class C IP network numbers use the leftmost 24 bits (the leftmost three bytes) to identify the network, leaving 8 bits (the rightmost byte) to identify host interfaces. Class C addresses always start with the leftmost 3 bits set to 1 1 0 or a range of 192 to 255 for the leftmost dotted quad. There are thus 4,194,303 available C class network numbers, each containing 254 interfaces. (C Class networks with the first byte greater than 223 are however reserved and unavailable for use).
READ  The RCS MINI-HOWTO: Creating and maintaining archives.

In summary:


        Network class   Usable range of first byte values (decimal)
                A                 1 to 126
                B               128 to 191
                C               192 to 254

There are also special addresses that are reserved for ‘unconnected’ networks – that is networks that use IP but are not connected to the Internet, These addresses are:-

  • One A Class Network
    10.0.0.0
  • 16 B Class Networks
    172.16.0.0 – 172.31.0.0
  • 256 C Class Networks 192.168.0.0 – 192.168.255.0

You will note that this document uses these sequences throughout to avoid confusion with ‘real’ networks and hosts.

3.4 Network numbers, interface addresses and broadcast addresses

IP numbers can have three possible meanings:-

  • the address of an IP network (a group of IP devices sharing common access to a transmission medium – such as all being on the same Ethernet segment). A network number will always have the interface (host) bits of the address space set to 0 (unless the network is sub-networked – as we shall see);
  • the broadcast address of an IP network (the address used to ‘talk’, simultaneously, to all devices in an IP network). Broadcast addresses for a network always have the interface (host) bits of the the address space set to 1 (unless the network is sub-networked – again, as we shall see).
  • the address of an interface (such as an Ethernet card or PPP interface on a host, router, print server etc). These addresses can have any value in the host bits except all zero or all 1 – because with the host bits all 0, the address is a network address and with the host bits all 1 the address is the broadcast address.

In summary and to clarify things


For an A class network...
(one byte of network address space followed by three bytes of host
address space)

        10.0.0.0 is an A Class  network number  because all the host
                bits of the address space are 0
        10.0.1.0 is a host address on this network
        10.255.255.255.255 is the broadcast address of this network
                because all the host bits of the address space are 1

For a B class network...
(two bytes of network address space followed by two bytes of host
address space)

        172.17.0.0 is a B Class network number
        172.17.0.1 is a host address on this network
        172.17.255.255 is the network broadcast address

For a C Class network...
(three bytes of network address space followed by one byte of host
address space)

        192.168.3.0 is a C Class network number
        192.168.3.42 is a host address on this network
        192.168.3.255 is the network broadcast address

Almost all IP network numbers remaining available for allocation at present are C Class addresses.

READ  RPM HOWTO

3.5 The network mask

The network mask is more properly called the subnetwork mask. However, it is generally referred to as the network mask.

It is the network mask and its implications on how IP addresses are interpreted locally on an IP network segment that concerns us most here, as this determines what (if any) sub-networking occurs.

The standard (sub-) network mask is all the network bits in an address set to ‘1’ and all the host bits set to ‘0’. This means that the standard network masks for the three classes of networks are:-

  • A Class network mask: 255.0.0.0
  • B Class network mask: 255.255.0.0
  • C Class network mask: 255.255.255.0

There are two important things to remember about the network mask:-

  • The network mask affects only the local interpretation of local IP numbers (where local means on this particular network segment);
  • The network mask is not an IP number – it is used to modify how local IP numbers are interpreted locally.

prev-8693644 next-4817533 toc-2985444