The Internet Protocol: Introduction to IPV4
We're finally at the very core of the Internet. This lesson contains an introduction to the Internet protocol!
The Internet Protocol (IP) is the network layer protocol of the TCP/IP protocol suite. The flexibility of IP and its ability to use various types of underlying data link layer technologies is one of its key advantages. The current version of IP is version 4 and is specified in RFC 791. We first describe this version and later touch upon IP version 6, which is expected to replace IP version 4 in the not so distant future.
IP Version 4
The design of IP version 4 was based on the following assumptions:
- IP should provide an unreliable connectionless service.
- IP operates with the datagram transmission mode
- IP hosts must have fixed size 32-bit addresses
- IP must be compatible with a variety of data link layers
- IP hosts should be able to exchange variable-length packets
IP Addresses
The addresses are an important part of any network layer protocol. IPv4 addresses are written as 32 bit numbers in dotted-decimal format, such as a sequence of four integers separated by dots. Dotted decimal is a format imposed upon the 32-bit numbers for relatively easier human readability. For example:
- 1.2.3.4 corresponds to 00000001000000100000001100000100
- 127.0.0.1 corresponds to 01111111000000000000000000000001
- 255.255.255.255 corresponds to 11111111111111111111111111111111
Multihoming
An IPv4 address is used to identify an interface on a router or an interface on a host. Recall network interfaces from the physical communication media chapter.
A router has thus as many IPv4 addresses as the number of interfaces that it has in the data link layer. Most hosts have a single data link layer interface and thus have a single IPv4 address. However, with the growth of wireless more and more hosts have several data link layer interfaces (for example, an Ethernet interface and a WiFi interface). These hosts are said to be multihomed. A multihomed host with two interfaces has thus two IPv4 addresses.
Address Assignment
Appropriate network layer address allocation is key to the efficiency and scalability of the Internet.
A naive allocation scheme would be to provide an IPv4 address to each host when the host is attached to the Internet on a first come, first served basis. With this solution, a host in Belgium could have address 2.3.4.5 while another host located in Africa would use address 2.3.4.6. Unfortunately, this would force all routers to maintain a specific route towards all Billion hosts on the Internet, which is not scalable. Hence, it’s important to minimize the number of routes that are stored on each router.
Subnetting
One solution is that routers should only maintain routes towards blocks of addresses and not towards individual hosts. For this, blocks of IP addresses are assigned to ISPs. The ISPs assign sub blocks of the assigned address space in a hierarchical manner. These sub blocks of IP addresses are called subnets.
A typical subnet groups all the hosts that are part of the same enterprise. An enterprise network is usually composed of several LANs interconnected by routers. A small block of addresses from the Enterprise’s block is usually assigned to each LAN. An IPv4 address is composed of two parts:
- A subnetwork identifier composed of the high order bits of the address.
- And a host identifier encoded in the lower order bits of the address.
This is illustrated in the figure below:
Address Classes
When a router needs to forward a packet, it must know the subnet of the destination address to be able to consult its routing table to forward the packet. RFC 791 proposed to use the high-order bits of the address to encode the length of the subnet identifier. This led to the definition of three classes of addresses.
Class | High-order bits | Length of subnet id | Number of networks | Addresses per network |
---|---|---|---|---|
Class A | 0 | 8 bits | 128 () | 16,777,216 () |
Class B | 10 | 16 bits | 16,384 () | 65,536 () |
Class C | 110 | 24 bits | 2,097,152 () | 256 () |
In this classful address scheme, the range range of the IP addresses in each class are as follows:
- Class A:
0.0.0.0
to127.255.255.255
- Class B:
128.0.0.0
to191.255.255.255
- Class C:
192.0.0.0
to223.255.255.255
- Class D
224.0.0.0
to239.255.255.255
- Class E
240.0.0.0
255.255.255.255
.
Class D IP addresses are used for multicast, whereas class E IP addresses are reserved and can’t be used on the Internet. So classes A, B, and C are the ones used for regular purposes.
Subnet Masks
Every network that falls into one of these classes has a fixed number of bits in the network part to identify the network itself. The subnet mask ‘masks’ the network part of the IP address and leaves the host part open. So a subnet mask of a class C address could be , where the first 3 octets represent the subnet mask and the last octet can be used to identify hosts within this network. For instance, can be one machine on this network.
Network Address
The network address is just the address with all the host bits set to . So is actually a network address. It is technically not a ‘functional’ address, it’s just used for forwarding table entries.
Broadcast Address
The broadcast address of any network is the one where the host bits are all set to . So the broadcast address in our example subnet mask is . It can be used to broadcast a packet to all devices on a network.
Default Subnet Masks
Each class has a default mask as follows where the network ID portion has all s and the host ID portion has all s.
Class | Default Subnet Mask |
---|---|
Class A | 255.0.0.0 |
Class B | 255.255.0.0 |
Class C | 255.255.255.0 |
However, these three classes of addresses were not flexible enough. A class A subnet was too large for most organizations and a class C subnet was too small.
Variable-Length Subnets
Flexibility was added by the introduction of variable-length subnets in RFC 1519. With variable-length subnets, the subnet identifier can be any size, from 1 to 31 bits. Variable-length subnets allow the network operators to use a subnet that better matches the number of expected hosts that will use the subnet. A subnet identifier or IPv4 prefix is usually represented as A.B.C.D/p, where A.B.C.D is the network address. It’s obtained by concatenating the subnet identifier with a host identifier containing only 0, and p is the length of the subnet identifier in bits.
The table below provides examples of variable-length IP subnets.
Subnet | Number of addresses | Lowest address | Highest address |
---|---|---|---|
Please attempt the question in the widget below. Our AI will evaluate your answer.
Quick Quiz!
Suppose a new address class has a 4-bit subnet ID with one higher order bit out of the 4. How many addresses per network would that entail?
= 16
That’s it for this lesson! We’ll continue with our discussion of IP address allocation.
Get hands-on with 1400+ tech skills courses.