Routing and Switching

IPv4 ADDRESS

We are almost at the end of an era, IPv4 which has served us for many decades will soon be history, and it’s all for the best. Actually it hasn’t completely gone the way of the dinosaurs, there are still few corporate organizations out there still running on IP version 4 while planning their move to IPv6. Besides, most homes and small business owners are still having fun with it. And if you’re like some of us, you will need it to pass some of your Cisco certification exams. I may likely be one of the few who still care to write about it.

An IP address is a numeric identifier given to a machine on an IP network. It’s a software address and it indicate the specific location of a network device. It was designed in such a way that it allows hosts on one network to communicate with another host on another network.

Terms associated with IP addressing includes;

  1. Bit – A bit is one digit. Either a 1 or a 0.
  2. Bytes – A byte is made up of 8 bits.
  3. Octet – It’s an 8-bit binary number. Interchangeable with byte.
  4. Broadcast address – This is the address used by all applications and host to send information to all devices on a network. For example, 10.255.255.255 sends a broadcast information to all subnets and hosts on network 10.0.0.0

An IPv4 address is made up of 32 bits of information divided along 8-bit boundaries into four sections, each section is called an octet. Each set of 8 bits is converted to its decimal equivalent and separated by periods. It can be represented in one of three format;

  1. Dotted decimal – Example:16.30.56
  2. Binary – Example: 10101100 . 00010000 . 00011110 . 00111000
  3. Hexadecimal – Example: AC . 10 . 1E . 38

The most widely used format is the dotted decimal. This addressing version is composed of two distinct part; the network address and the host address.

A network address, also known as network number, uniquely identifies each network, all hosts that belong to the same network shares the same network number. In the IP address 172.16.72.88, for example, 172.16 is the network address.

The host address is the one that is assigned to a machine on a network, and it uniquely identifies it. No two machines on the same network shares the same host address. In the sample address 172.16.72.88, 72.88 is the host address.

IPv4 addressing is structurally divided into classes based on the size of the network. It ranges from very large networks to large networks to small networks, there are five classes in all. Classes A, B, C, D and E.

The first three classes are the main ones, well known and publicly available, class D is reserved for multicasting (224.0.0.5 sound familiar?) and class E is reserved for scientific purposes.

NETWORK ADDRESS RANGES

CLASS A

IP address scheme designers said that the first bit of the first byte in a class A network address must always be off (0). What this means is that class A address must be between 0 and 127.

The first bit of the first byte turned off is 0xxxxxxx.

Recall that 8 bits make 1 byte, bits are counted from the left. The decimal representation of the bits are

128        64           32           16           8             4             2             1

With the first bit turned off, if the other 7 bits are all turned off then turned on, we will find the range of class A network address.

128        64           32           16           8             4             2             1

0             0             0             0             0             0             0           0 = 0      all 7 bits turned off

0              1             1              1             1             1                1            1 = 127 all 7 bits turned on

 

The value 127 is obtained by adding all 1’s,

64 + 32 + 16 + 8 + 4 + 2 + 1 = 127

So now we can say a class A network address is defined in the first octet between 0 and 127.

CLASS B

Here, the IP address scheme designers said that the first bit of the first byte in a class B network must always be turned on (1) but the second bit must always be turned off (0). With this, we have

10xxxxxx

If the other 6 bits are all turned off then turned on we will have class B network address range.

128        64           32           16           8             4             2             1

1          0             0             0             0             0             0             0 = 128 all 6 bits turned off

1          0             1             1             1             1                 1             1 = 191 all 6 bits turned on

 

So now we can see that a class B network address is defined in the first octet from 128 to 191

 

CLASS C.

Once again, the IP address designers state that for a class C address, the first 2 bits of the first octet must always be on (1) but the third bit must always be off (0). Armed with this information, we have

110xxxxx

So if the other 5 bits are all turned off and then turned on we will have our class C network address range

128        64           32           16           8             4             2             1

1             1             0             0             0             0             0            0 = 192 all 5 bits turned off

1            1             0              1              1             1             1               1 = 223 all 5 bits turned on

 

Anywhere you encounter an address range starting from 192 to 223, you know it’s a class C network address.

 

CLASS D AND CLASS E

Both of these classes are reserved IP addresses and are never used for general network addressing except for the purposes for which they are intended. Class D network address ranges from 224 – 239, and it is used for multicast addresses (think 224.0.0.5 for OSPF, 224.0.0.10 for EIGRP, 224.0.0.9 for RIP!). Class E network address ranges from 240 – 255 and are used for scientific purposes only.

There are other IP addresses that are reserved for special purposes and can never be assigned to hosts in our network.

Address Function
Network address of all 0’s Means “this network or segment.
Network address of all 1’s Means “all networks.
Network 127.0.0.0 Reserved for loopback test.
Host address of all 0’s Means network address or any address on specified network. E.g. 150.23.0.0
Host address of all 1’s Means all address on the specified network. e.g. 150.23.255.255 means “all hosts” on network 150.23
Entire IP addresses set to all 0’s (0.0.0.0) Used by Cisco routers to designate the default route.
Entire IP addresses set to all 1’s (255.255.255.255) Broadcast to all host on the current network.

Class A Addresses

Recall that IPv4 addresses are 32 bits or 4 bytes long divided into four sections, with each section containing 8 bits of information. The first byte of a class A address is assigned to the network address while the remaining 3 bytes are used for host addresses. The class A address format is shown below;

Network .host .host .host

The length of a class A network address is 1 byte or 8 bits, with the first bit reserved by IP address designers. This leaves us with just 7 bits to manipulate for our use. Each bit can either be turned on (1) or off (0), therefore, 7 bits gives 27 or 128 maximum number of networks that can be created in class A. However, network addresses 0 and 127 are reserved and therefore not usable, leaving us with 1 – 126 usable class A network addresses.

Looking back at the table of reserved IP addresses, network of all 0’s (0.0.0.0) can’t be used because they are used to designate default route and the address 127 is reserved for diagnostic purpose, thus can’t be used too.

Each class A network has 3 bytes or 24 bits for host addressing. This gives 224 or 16,777,216 unique host for each class A network address. However, the 2 patterns of all 0’s and all 1’s are reserved making the maximum usable number of host for a class A network 224 – 2, which equals 16, 777,214.

Class A valid hosts

The valid host are the numbers between the network address and the broadcast address. All host bits turned off is network address (i.e. host bits all 0’s) and all host bits turned on is broadcast address (i.e. host bits all 1’s).

Network address: 10.0.0.0

Broadcast address: 10.255.255.255

The valid hosts therefore are 10.0.0.1 through 10.255.255.254

Class B Addresses

Here, the first 2 bytes are assigned to the network address and the last 2 bytes for host addresses. Class B address format is

Network .Network .Host .Host

The 2 bytes used for network address gives 216 or 65,536 unique class B addresses. But recall that the IP address designers have reserved 2 bits of the first byte leaving us with 6 bits in the first byte and 8 bits in the second byte, making a total of 14 bits for network address manipulation. Now we have 214 or 16,384 unique class B network addresses.

The last two bytes available for host addressing gives 216 or 65,536 hosts for each class B IP address. However, address of all 0’s and 1’s are reserved and are therefore not available for use. So now we have 216 – 2 or 65,534 possible host address for each class B network.

Class B valid hosts

The valid hosts of class B IP address lies between the network address and broadcast address. All host bits turned off is network address (i.e. host bits all 0’s) and all host bits turned on is broadcast address (i.e. host bits all 1’s).

Network address – 172.16.0.0

Broadcast address – 172.16.255.255

Class B valid hosts therefore are 172.16.0.1 through 172.16.255.254

Class C Addresses

This address class uses the first 3 bytes for network addressing leaving only 1 byte or 8 bits for host addressing. Class C address format thus is

Network .Network .Network .Host

From the 3 bytes or 24 bits available for network addressing 3 have been reserved leaving 21 bits available for use. We therefore have 221 or 2,097,152 possible class C networks.

1 byte or 8 bits available for host addressing gives 28 minus two reserved patterns of all 0’s and all 1’s, giving a total of 254 hosts for each class C network address.

Class C valid hosts

Like for class A and class B, class C valid hosts lies between the network address and the broadcast address.

Network address – 192.168.10.0

Broadcast address – 192.168.10.255

Valid host therefore are 192.168.10.1 through 192.168.10.254.

PRIVATE IP ADDRESSES

These are addresses used on a private network, like home or office network, but they are not routable on the internet. Initially, addresses that were handed out are public routable addresses, then the pool was running dry faster than was anticipated. To fix this, IP addresses that are not globally allocated by the regional internet registry (RIR) are released for use by private individuals and are thus called “private IP address”. This means that these addresses can be used by anyone without the need to register them with IANA.

Private IP addresses are not routable on the public internet, and are unable to access the internet without some intervention like Network Address Translation (NAT).

The reserved private IP addresses are;

 

Address class Reserved Address Space
Class A 10.0.0.0 through 10.255.255.255
Class B 172.16.0.0 through 172.31.255.255
Class C 192.168.0.0 through 192.168.255.255
Advertisements

One thought on “IPv4 ADDRESS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s