Every computer on a network and the internet needs an address. This address is known as an IP address. Two computers can never have the same address. An IP Address is a group of 4 eight bit binary numbers represented in decimal. Each number is separated by a period, e.g. 10.1.0.1. Any machines that are connected to a network will each need a unique address. Two machines cannot use the same address.
Use the buttons below to navigate through the lesson
The IP address is divided into the network ID and the host ID. The network ID represents what network the machine is on. For two machines to communicate they have to be using the same network ID. The host ID represents a unique number assigned to the machine attached to the end of the network ID. For two machines to communicate they need to Have the same network address. They must, however have different host numbers.
A machine can identify which part of its IP address is the host ID and which part is the network ID by using a set of numbers called a subnet mask.
As well as an IP address every machine using TCP/IP needs a subnet mask. The subnet mask splits the IP address into two parts, allowing the computer to identify which part is the network ID and which part is the host ID.
The subnet mask divides the IP address into two parts by using on (1) and off (0) switches. 1 represents a network ID and 0 represents a host ID.
A computer with an IP address of 10.1.0.1 and a subnet mask of 255.255.0.0 would have a network ID of 10.1 and a host ID of 0.1. This is worked out by converting both numbers into binary.
10 .1 .0. 1
255 .255. 0. 0
Using the subnet mask, divide the IP address up by using the 1’s to represent the network ID and the 0’s to represent the host ID.
Using this, we can assume that the network ID is 00001010.00000001 (10.1) and the host ID is 00000000.00000001 (0.1).
A subnet mask doesn’t have to be a full octet. It is possible to use a subnet mask that is only a partial octet.
For example 255.255.240.0: This enables the administrator to create custom subnets to divide a private network into several discrete sub- networks
An easier way of writing an IP address and its subnet mask is by using the form xxx.xxx.xxx.xxx/bits in the mask. The address 10.1.0.1 with a subnet mask of 255.255.0.0 can also be written as 10.1.0.1/16.
This form of notation shows the number of Bits in the subnet mask, e.g. /8 represents 11111111.00000000.00000000.00000000 or 255.0.0.0.
/20 would represent 11111111.11111111.11110000.00000000 or 255.255.240.0.
IP Address Classes
When TCP/IP first appeared, IP addresses were placed into different classes A,B,C and D. The subnet mask of the machine would be determined by its IP address class. To determine what class an IP address is , refer to the first octet of the address, e.g. 100 for 18.104.22.168
To determine what class an IP address is , refer to the first octet of the address, e.g. 100 for 22.214.171.124
Class Subnet Mask Host ID’s
A 255.0.0.0 16,777,214
B 255.255.0.0 65,534
C 255.255.255.0 254
D 255.255.255.255 (Multicast) N/A
Of the 32 bits available, the bits required for the network ID can’t be used. In a class B network for example this takes away 16 bits, leaving 16 bits for the host addresses. This can be used to make numbers up to 65536 (2 to the power 16). Host addresses using all 1’s or all 0’s are reserved for special use, hence the figure in the above table of 65534.
You have been assigned the address 126.96.36.199/20, how many hosts will you have?
/20 represents the subnet mask of 11111111.11111111.11110000.00000000 (255.255.240.0)
Therefore the Host ID is 0000.00000000, giving a total of 12 host ID’s to play with.
Therefore (212)-2=4094. So there are 4092 different host ID’s
Why take off 2?
Two host ID addresses are reserved for every network.
If the host ID contains all 0’s it represents the Network it is on and can’t be used, e.g. 10.1.0.0/24 (00000000) is invalid. This is known as the Network Address.
If the host ID contains all 1’s then this represents every computer in the network. This is known as the Broadcast Address, e.g. 188.8.131.52/24 (11111111) represents every computer in the 194.34.23 network.
If the host part of the address is all zeroes, this looks similar to the subnet mask and is called the Network Address. By convention, this address is not used for any host. If the host part of the address is all ones, this represents not a single host but all hosts on that network. It is termed the broadcast address, and it shouldn’t be used for any host.
Although these days you can have any subnet mask, classes are still used when a subnet mask isn’t given. There are a number of private address ranges available for use in internal networks. These addresses will never be seen on the internet. As internet routers will not pass packets that originate from these addresses.
Class A : 10.0.0.0 – 10.255.255.255
Class B : 172.16.0.0 – 172.31.255.255
Class C : 192.168.0.0 – 192.168.255.255
Custom Subnet Masks
Imagine a scenario where you have been assigned the address range 184.108.40.206 for your company’s network. You need to have 14 separate networks each with ten computers in.
220.127.116.11 is a class C address which means you have 254 hosts but only the one network (the 193.28.34) network.
Considering that you only need 10 hosts and not 254 we can take some of the host ID’s and turn them into Network ID’s. You can do that by creating a custom subnet mask…
We have the 8 host digits to play with. This equates to (28)-2=254 addresses. However we only need 140. Some of the host ID’s can be used as network ID’s.
Routers are network devices that are used to connect separate networks and to enable network traffic to pass between the networks. We have seen that machines on separate networks cannot pass data between themselves without assistance. A router or default gateway passes data to addresses that are not on the senders network.
With the help of a router computers on both networks would be able to communicate. The router is physically connected to both networks and has two IP addresses.
When a client wants to send a packet out on the network it checks the network ID of the destination machine. If it is different from its own it would send the packet to its default gateway.
Routers can communicate with other routers so that network packets can be passed to their correct destinations.
A network packet travelling out on the internet may pass through several routers before reaching its target. Each router forwards the packet on to the next router until it either reaches or fails to reach its destination.
Routing is covered in much greater detail later on in this course.