Every interface on an internet must have a unique Internet address (also called an IP address). These addresses are 32-bit numbers. Instead of using a flat address space such as 1, 2, 3, and so on, there is a structure to Internet addresses. Each of which is partitioned into two parts - a constituent network prefix and a host number on that network.
IP-address ::= { <Network-prefix>, <Host-number> }
These 32-bit addresses are normally written as four decimal numbers, one for each byte of the address. This is called dotted-decimal notation.
Class | Range | |
A | 0.0.0.0 to 127.255.255.255 | general purpose unicast addresses with standard 8 bit prefix |
B | 128.0.0.0 to 191.255.255.255 | general purpose unicast addresses with standard 16 bit prefix |
C | 192.0.0.0 to 223.255.255.255 | general purpose unicast addresses with standard 24 bit prefix |
D | 224.0.0.0 to 239.255.255.255 | IP Multicast Addresses - 28 bit prefix, nonaggregatable |
E | 240.0.0.0 to 247.255.255.255 | reserved for experimental use |
There are three types of IP addresses: unicast (destined for a single host), broadcast (destined for all hosts on a given network), and multicast (destined for a set of hosts that belong to a multicast group).
Subnet Addressing
Instead of considering an IP address as just a network ID and host ID, the host ID portion is divided into a subnet ID and a host ID.
This makes sense because class A and class B addresses have too many bits allocated for the host ID: 2^24-2 and 2^16-2, respectively. People don't attach that many hosts to a single network. We subtract 2 in these expressions because host IDs of all zero bits or all one bits are invalid.
After obtaining an IP network ID of a certain class from the InterNIC, it is up to the local system administrator whether to subnet or not, and if so, how many bits to allocate to the subnet ID and host ID. For example, a class B network address (140.252) remains 16 bits, 8 are for the subnet ID and 8 for the host ID.
16 bits | 8 bits | 8 bits |
netid = 140.252 | subnetid | hostid |
Subnetting hides the details of internal network organization (within a company or campus) to external routers. Subnetting, therefore, reduces the size of routing tables.
Subnet Mask
Part of the configuration of any host that takes place at bootstrap time is the specification of the host's IP address. Most systems have this stored in a disk file that's read at bootstrap time.
In addition to the IP address, a host also needs to know how many bits are to be used for the subnet ID and how many bits are for the host ID. This is also specified at bootstrap time using a subnet mask. This mask is a 32-bit value containing one bits for the network ID and subnet ID, and zero bits for the host ID.
Given its own IP address and its subnet mask, a host can determine if an IP datagram is destined for
- a host on its own subnet,
- a host on a different subnet on its own network, or
- a host on a different network.
Knowing your own IP address tells you whether you have a class A, B, or C address (from the high-order bits), which tells you where the boundary is between the network ID and the subnet ID. The subnet mask then tells you where the boundary is between the subnet ID and the host ID.
Special Case IP Addresses
( 0 means a field of all zero bits, -1 means a field of all one bits, and netid, subnetid, and hostid mean the corresponding field that is neither all zero bits nor all one bits. A blank subnet ID column means the address is not subnetted.)
We have divided this table into three sections. The first two entries are special case source addresses, the next one is the special loopback address, and the final four are the broadcast addresses.
"The first two entries in the table, with a network ID of 0, can only appear as the source address as part of an initialization procedure when a host is determining its own IP address, for example, when the BOOTP protocol is being used.
Broadcasting and Multicasting
Broadcasting and multicasting only apply to UDP, where it makes sense for an application to send a single message to multiple recipients.
Limited Broadcast
The limited broadcast address is 255.255.255.255. This can be used as the destination address of an IP datagram during the host configuration process, when the host might not know its subnet mask or even its IP address.
A datagram destined for the limited broadcast address is never forwarded by a router under any circumstance. It only appears on the local cable.
Net-directed Broadcast
The net-directed broadcast address has a host ID of all one bits. A class A net-directed broadcast address is netid.255.255.255, where netid is the class A network ID.
A router must forward a net-directed broadcast, but it must also have an option to disable this forwarding.
Subnet-directed Broadcast
The subnet-directed broadcast address has a host ID of all one bits but a specific subnet ID. Classification of an IP address as a subnet-directed broadcast address requires knowledge of the subnet mask. For example, if a router receives a datagram destined for 128.1.2.255, this is a subnet-directed broadcast if the class B network 128.1 has a subnet mask of 255.255.255.0, but it is not a broadcast if the subnet mask is 255.255.254.0 (0xfffffe00).
All-subnets-directed Broadcast
An all-subnets-directed broadcast address also requires knowledge of the destination network's subnet mask, to differentiate this broadcast address from a net-directed broadcast address. Both the subnet ID and the host ID are all one bits. For example, if the destination's subnet mask is 255.255.255.0, then the IP address 128.1.255.255 is an allsubnets-directed broadcast. But if the network is not subnetted, then this is a net-directed broadcast.
Multicasting
IP multicasting provides two services for an application.
- Delivery to multiple destinations. There are many applications that deliver information to multiple recipients: interactive conferencing and dissemination of mail or news to multiple recipients, for example.
- Solicitation of servers by clients. A diskless workstation, for example, needs to locate a bootstrap server. Today this is provided using a broadcast, but a multicast solution would impose less overhead on the hosts that don't provide the service.
A multicast group address is the combination of the high-order 4 bits of 1110 and the multicast group ID. These are normally written as dotted-decimal numbers and are in the range 224.0.0.0 through 239.255.255.255.(class D)
The set of hosts listening to a particular IP multicast address is called a host group.
Converting Multicast Group Addresses to Ethernet Addresses
The IANA(Internet Assigned Numbers Authority). owns an Ethernet address block, which in hexadecimal is 00:00:5e. This is the high-order 24 bits of the Ethernet address, meaning that this block includes addresses in the range 00:00:5e:00:00:00 through 00:00:5e:ff:ff:ff. The IANA allocates half of this block for multicast addresses. Given that the first byte of any Ethernet address must be 01 to specify a multicast address, this means the Ethernet addresses corresponding to IP multicasting are in the range 01:00:5e:00:00:00 through 01:00:5e:7f:ff:ff.
This allocation allows for 23 bits in the Ethernet address to correspond to the IP multicast group ID. The mapping places the low-order 23 bits of the multicast group ID into these 23 bits of the Ethernet address.
Since the upper 5 bits of the multicast group ID are ignored in this mapping, it is not unique. Thirty-two different multicast group IDs map to each Ethernet address. For example, the multicast addresses 224.128.64.32 (hex e0.80.40.20) and 224.0.64.32 (hex e0.00 40.20) both map into the Ethernet address 01:00:5e:00:40:20.
Since the mapping is not unique, it implies that the device driver or the IP module must perform filtering, since the interface card may receive multicast frames in which the host is really not interested. Also, if the interface card doesn't provide adequate filtering of multicast frames, the device driver may have to receive all multicast frames, and perform the filtering itself.
Even if the interface performs perfect multicast filtering (based on the 48-bit hardware address), since the mapping from a class D IP address to a 48-bit hardware address is not one-to-one, filtering is still required.
Despite this imperfect address mapping and hardware filtering, multicasting is still better than broadcasting.
Complications arise when we extend multicasting beyond a single physical network and pass multicast packets through routers. A protocol is needed for multicast routers to know if any hosts on a given physical network belong to a given multicast group. This protocol is called the Internet Group Management Protocol (IGMP).