|
|
|
 |
 |
 |
 |
 |
 |
|
|
|
|
|

Internetworking Basics |
|
|
|
|
|
 |
 |
|
 |
| |
Chapter 9
IP Addressing
These notes guide you through understanding IP classes, addresses and subnet masks.
Introduction
IP Address Classes
Class A
Class B
Class C
Class D
Class E
Reserved IP Addresses
Network Address
Broadcast Address
Private IP Address Ranges
CIDR Notation
IPv6 Addresing
Summary
| |
| |
Introduction
IP addresses are 32 bit numbers assigned to computers, used for communication over the Internet. IP stands for "Internet Protocol." An
IP address is, arranged in 4 groups of 8 each. Each group is separated by a dot. This is called the dotted-decimal notation. Here is an example.
11000000.10100110.01110001.00001100
This can be rewritten in decimal by converting each separate group to its decimal equivalent.
192.168.113.12
Every device that connects to the Internet must use a public IP address. It is possible to use private IP addresses on an isolated LAN but a private IP address cannot be used on the Internet. The Internet Assigned Numbers Authority (IANA) is an organization that serves as a bookkeeper in recording and granting IP address assignments all over the world. They work with various regional bodies to ensure that each IP address in use on the Internet is unique. The current IP address space in use is called IPv4 and contains five classes of IP address. The class of address an organization chooses for it's network depends upon the size of network and other design consideration. To understand IP address assignment and subnetting, you must understand the IP address class system first.
|
| |
IP Address Classes
With 32 bits available for IP addresses, this gives 4,294,967,296 possible IP addresses. It would be impractical for routers had to store this many addresses in their routing tables. So the designers of the Internet addressing scheme, decided that networks came in different sizes, so they decided to divide IP addresses into classes for different size networks. As you will see later, this meant routing tables could be smaller and much more manageable.
They created five different classes from A to E, with A, B and C meant for different sized networks, D for multicast addresses and E reserved for research purposes. So, a large network would use a Class A address, a medium sized network would use a Class B address and a smaller sized network would use a Class C address.
Class |
First Octet Address Range |
Network Address Bits |
Number of Hosts |
A |
0 - 127 |
8 |
16,772,214 |
B |
128 - 191
|
16 |
65,534 |
C |
192 - 223 |
24 |
254 |
D |
224 - 239 |
28 |
- |
E |
240 - 255 |
- |
- |
Note: the 127 Class A address is reserved for the loopback address |
Using this addressing scheme the Internet can support the following:
- 126 Class A networks that can include up to 16,777,214 hosts each
- 65,000 Class B networks that can include up to 65,534 hosts each
- over 2 million Class C networks that can include up to 254 hosts each
~Now try the activity~
| Activity A |
1. Identify the IP address class for each of the following...
- 199.28.154.33
- 64.65.211.8
- 144.155.26.114
You can check your answers here |
If you examine the first few bits of the first octet in any IP address, you will see a pattern emerge. For example, Class A addresses all range from 0 to 127. The lowest number is 0000000. The highest number is 01111111. So all IP addresses in this class start with a zero for the first bit.
~Now try the activity~
| Activity B |
- Class B addresses always start with the first two bits the same, what are they?
- Class C addresses always start with the first three bits the same, what are they?
- Class D addresses always start with the first four bits the same, what are they?
- Class E addresses always start with the first four bits the same, what are they?
You can check your answers here |
Using the old Class A, B, and C addressing scheme the Internet could support the following:
- 126 Class A networks that could include up to 16,777,214 hosts each
- Plus 65,000 Class B networks that could include up to 65,534 hosts each
- Plus over 2 million Class C networks that could include up to 254 hosts each
~~ Class A Addresses ~~
The Class A range of addresses are for large networks, containing up to 16,777,214 hosts each.
The first octet is the network address. The three remaining octets are used for host addresses.
| Class A: |
Network |
Host |
Host |
Host |
| Subnet Mask |
255 |
0
|
0 |
0 |
The first bit of a Class A address always starts with a 0.
| Bit Values |
0 |
x |
x |
x |
x |
x |
x |
x |
x
|
x |
x |
For example:-
112.134.195.213 --> first octet in binary is 01110000
If the first bit of the first octet must start with a 0 to be a Class A address, this means that only numbers from 00000000 to 01111111 (0 to 127 in decimal) are valid. So addresses such as 65.x.x.x and 124.x.x.x are valid Class A addresses but 129.x.x.x is not. The two numbers 0 and 127 are not allowed as network addresses. You should recall that 127.0.0.1 is used as a loopback address so hosts can address packets to themselves.
~~ Class B Addresses ~~
The Class B range of addresses are for medium sized networks, containing up to 65,534 hosts each.
The first two octets are the network address. The two remaining octets are used for host addresses.
| Class B: |
Network |
Network |
Host |
Host |
| Subnet Mask |
255 |
255
|
0 |
0 |
The first two bits of a Class B address always starts with a 10.
| Bit Values |
1 |
0 |
x |
x |
x |
x |
x |
x |
x
|
x |
x |
For example:-
128.4.4.6 --> first octet in binary is 10111111
191.4.4.6 --> first octet in binary is 10111111
If the first two bits of the first octet must start with 10 to be a Class B address, this means that only numbers from 10000000 to 10111111 (128 to 191 in decimal) are valid. So addresses such as 130.x.x.x and 189.x.x.x are valid Class B addresses but 192.x.x.x is not.
~~ Class C Addresses ~~
The Class C range of addresses are for small networks, containing up to 254 hosts each.
The first three octets are the network address. The three remaining octets are used for host addresses.
| Class C: |
Network |
Network |
Network |
Host |
| Subnet Mask |
255 |
255
|
255 |
0 |
The first three bits of a Class C address always starts with a 110.
| Bit Values |
1 |
1 |
0 |
x |
x |
x |
x |
x |
x
|
x |
x |
For example:-
192.3.4.5 --> first octet in binary is 11000000
223.3.4.5 --> first octet in binary is 11011111
If the first three bits of the first octet must start with 110 to be a Class C address, this means that only numbers from 11000000 to 11011111 (192 to 223 in decimal) are valid. So addresses such as 199.x.x.x and 220.x.x.x are valid Class C addresses but 224.x.x.x is not.
~~ Class D Addresses ~~
The Class D range of addresses are used as multicast addresses. These are special group addresses, where devices that are interested in this group register to receive packets addressed to the group.
| Class D: |
Network |
Host |
Host
|
Host |
Host |
| Values |
1 |
1 |
1 |
0 |
x |
x |
x |
x |
x
|
x |
x |
The first four bits of a Class D address always starts with a 1110. For example:-
224.3.4.5 --> first octet in binary is 11100000
239.3.4.5 --> first octet in binary is 11101111
If the first four bits of the first octet must start with 1110 to be a Class D address, this means that only numbers from 11100000 to 11101111 (224 to 239 in decimal) are valid. So addresses such as 225.x.x.x and 230.x.x.x are valid Class D addresses but 240.x.x.x is not.
~~ Class E Addresses ~~
The Class E range of addresses are reserved by the Internet Engineering Task Force (IETF) for research purposes. Addresses in this class cannot be used on the Internet.
| Class E: |
Network |
Host |
Host
|
Host |
Host |
| Values |
1 |
1 |
1 |
1 |
x |
x |
x |
x |
x
|
x |
x |
The first four bits of a Class E address always starts with a 1111. For example:-
240.3.4.5 --> first octet in binary is 11110000
255.4.4.6 --> first octet in binary is 11111111
If the first bit of the first octet must start with a 110 to be a Class E address, this means that only numbers from 11110000 to 11111111 (240 to 223 in decimal) are valid. So addresses such as 241.x.x.x and 250.x.x.x are valid Class E addresses but 112.x.x.x is not.
~Now try the activity~
| Activity C |
- Can you identify which of the the following IP addresses have been incorrectly matched with a class.
- Class B --> 192.28.2.3
- Class E --> 241.6.200.3
- Class C --> 126.30.115.5
- State the class for each subnet mask given below
- 255.255.0.0
- 255.0.0.0
- 255.255.255.0
You can check your answers here |
|
| |
Reserved IP Addresses
Some IP addresses are reserved and cannot be used as host addresses on a network. Reserved addresses include the network address and broadcast address.
Network Address
Every network has a network address used to identify itself. When packets intended for a specific LAN are being routed across the Internet, the network address is used and not the more specific host address. For example, suppose a packet on the Internet is intended for host 200.200.3.4, this is a Class C address and so the network address is 200.200.3.0 while the host is .4. Routers will use the network address 200.200.3.0 to route traffic to and from the LAN. Only when the packets on the LAN itself will the host address 200.200.3.4 be used. Thus, a network address is reserved for identifying the network itself and cannot be used as a host address.
Suppose a host on a different LAN has a Class C IP address 200.200.4.4. Can you work out the network address?
Broadcast Address
Another reserved address is the broadcast address. You are not allowed to assign the broadcast address to a specific host on a network. Packets containing a broadcast address are forwarded to all hosts on a LAN segment.
Broadcast addresses are comprised of the usual network address but the host part is replaced with binary 1's. As an example, for network 200.200.3.0, a Class C network, the host part is the last octet and is replaced by binary 1's, which in decimal comes to 255. So, the broadcast address for network 200.200.3.0 is 200.200.3.255.
Can you work out the broadcast address for a host on a different LAN with a Class C IP address of 200.200.4.4?

~Now try the activity~
| Activity D |
- Specify the network and broadcast address for each IP address given below
196.64.3.18
144.128.16.56
102.200.100.6
You can check your answers here |
|
| |
Private IP Address Ranges
To connect to the Internet a public IP address is needed. However, public IP addresses are unique. No two networks connected to the Internet can use the same public IP address. If this were allowed to happen, then there would be confusion about which network was which. Also, public IP addresses are not free; every public IP address or address range must be paid for.
If you have a dial-up or similar connection to the Internet, you are automatically assigned a public IP address by your ISP. This number can be different each time you connect, so the process is called "dynamically allocating" an IP address. Less commonly, some ISP's offer accounts where a home users can obtain a static IP address.

If it is necessary for you to have the same IP address every time you connect to the internet, you may be assigned a static IP address. This is the opposite of a dynamic IP address. With a static address, the address will always be yours. Static IP addresses are commonly used for servers where it is important the IP address does not change. As an example, web servers are assigned static IP addresses.
On a company LAN, it is the responsibility of the network administrators to assign IP addresses to devices on their network. Some organizations purchase a block of public IP addresses which are then reserved for use on their network only. For example, if an organization reserved the block 194.112.40.0 to 194.112.40.255, then their network address would be 194.112.40.0, their broadcast address would be 194.112.40.255 and 254 hosts on the network could be allocated a public IP address from within the range.
However, there are only a limited number of public IP addresses available; there just aren't enough for every computer on the planet to have it's own unique public IP address. Consider a small home LAN comprising say three to four computers; it would be expensive indeed if you wanted each computer to be able to connect to the Internet and a public IP address had to be bought for each one. To solve this problem, private IP address ranges were developed.
Private IP addresses are addresses that can be used internally on private networks. They cannot be used on the Internet. An Internet router will not pass along any packet containing a private IP address; it will just drop it. There are three blocks of private IP address; one block is within the Class A range, one is within the Class B range and the third is within the Class C range.
| Class |
IP Address Range |
Class A |
10.0.0.0 to 10.255.255.255 |
Class B |
172.16.0.0 to 172.31.255.255 |
Class C |
192.168.0.0 to 192.168.255.255 |
Two examples of private IP addresses within the Class A range are shown below:-
10.0.0.5
10.100.40.3
Two examples of private IP addresses within the Class B range are shown below:-
172.16.55.3
172.24.55.3
Two examples of private IP addresses within the Class C range are shown below:-
192.168.0.1
192.168.200.15
Private IP addresses can be used on any private network. Many home users and organizations use private IP addresses for the hosts on their network. Since these hosts cannot gain access to the Internet directly, then a device such as a router is given the job of interfacing with the Internet and is assigned a public IP address. All Internet traffic is routed through this interface to and from the internal network. The device that interfaces with the Internet uses it's public IP address to connect to the Internet on behalf of an internal host. A method called Network Address Translation (NAT) is commonly used to keep track of each connecting host's private IP address and the incoming and outgoing traffic that belongs to it.

Thus, one benefit of using private IP addresses on a LAN is that you can have unlimited devices connected to the Internet but only have to pay for one public IP address. Also, it lessens the demand for public IP addresses.
~Now try the activity~
|
| |
CIDR Notation
CIDR is another method that was developed to try and ease the ever increasing demand for public IP addresses. The CIDR addressing scheme allows for more efficient allocation of IP addresses than the Class A, B, and C address scheme. A CIDR address uses the standard 32-bit IP address but additionally included information on how many bits are used for the network prefix. A CIDR address is represented as A.B.C.D/n, where "/n" is called the network prefix.
Class |
Network Address Bits |
CIDR Prefix |
A |
8 |
/8 |
B |
16 |
/16 |
C |
24 |
/24 |
Two examples of Class A IP addresses using the CIDR notation are shown below:-
10.0.0.5/8 --> /8 means the first 8 bits are the network address
140.2.3.4/16 --> /16 means the first 16 bits are the network address
200.2.3.4/24 --> /24 means the first 24 bits are the network address
You may wonder - what is the benefit of this notation? Well CIDR can uses prefixes anywhere from 13 to 27 bits. This means we are not limited to using Class A, B and C network addresses where 8, 16 or 24 bits are used for defining network addresses. For example, 200.2.3.4/25 means the first 25 bits are the network part with the remaining 7 bits used for identifying hosts.
Let's say a network has 500 hosts. Using classful IP addressing, this network needs a Class B address where the maximum number of hosts is up to 65,534 hosts. If a Class B public IP network address is purchased (e.g. 194.1.0.0), this means 65,034 IP addresses are being wasted. Moreover, these redundant IP addresses cannot be used by another network elsewhere.
On the other hand, if CIDR addressing was used, a /23 network prefix could be used, leaving 9 bits for the host part allowing for up to 510 IP addresses.
~Now try the activity~
| Activity E |
- Specify the number of bits allowed for the host part of each CIDR network address below and the number of hosts the network can address.
-
116.54.30.6/27
221.13.45.77/18
You can check your answers here |
|
| |
IPv6 Addressing
TCP/IP version 4 (IPv4) was developed in the 1980's at a time when the Internet was relatively small. Over the past few decades, the Internet has grown considerably and two major problems hinder further growth; these are:-
- Exhaustion of the current four byte IP addressing scheme ( IPv4)
- As the number of networks increase, routing tables increase and routers operate less effectively
Simply put, although 4,294,967,296 IP addresses are possible using IPv4, this is still not enough to cope with the ever increasing demand. Although extensions to IPv4, such as private address spaces, CIDR and subnetting were developed to help with this problem, a more scaleable solution has been developed, called IPv6.
IPv6 uses 16 octets rather than four octets used by IPv4. That represents more than 300,000,000,000,000,000,000,000,000,000,000,000,000 addresses.
IPv6 addresses are generally written in the following form:
hhhh : hhhh : hhhh : hhhh : hhhh : hhhh : hhhh : hhhh
Where each group of hhhh is a 16 bit (2 byte) hexadecimal number. For example:-
E3FF : 1860 : 0000 : 0000 : 55E2 : 7EBA : C0A1 : 6416
As well as the increase in IP address space, IPv6 offers other advantages over IPv4, such as integrated security with built-in authentication and encryption capabilities and so-called classes of service. It is likely that IPv6 will become the dominant IP addressing scheme on the Internet. Who knows, perhaps one day your mobile phone, car, TV, and even your refrigerator will have an IP address.
|
| |
Summary
On completing these notes you should understand:-
- the difference between static and dynamic IP address.
- the basics of IP addresses and IP address classes
- how to calculate the number of subnets and subnet address, given an IP address and subnet mask.
- that network and broadcast addresses are reserved
- that private address spaces, CIDR and subnetting were developed to help ease the increasing demand on public IP addresses
- the basics of CIDR notation
- that IPv6 was developed to supercede IPv4 since IPv4 does not contain sufficient IP addresses to keep up with increasing demand, as the Internet expands.
|
 |
|
 |
|
 |
|
 |
|
| |
|
|

|