Network layer Functions:
Network Addressing
IP Addressing
NETWORK LAYER
The two main functions of the network layer are:
● Network Addressing
● Routing- this is path finding (finding the routes where
data should pass)
NETWORK ADDRESSING: Introduction
● In the internet network nodes are identified with IP (Internet
Protocol)addresses
● These are logical addresses used in Wide Area Network
● Currently there are two Internet Protocol versions in use
○ IPV4
○ IPV6
● The IPV6 was introduced as solutions to the problem of exhausting the
address spaces in IPV4. With IPV6 billions of devices in the internet of
Things will be addressable (every networked device on the planet)
● IP addressing is core to the network design & administration. It provides
the base for all other network and user services.
IP Addressing
In IP assignment you should avoid
● Duplicate IP address assignments: you should not assign an IP address to a computer
when you have already used that IP else inorder to avoid IP collisions. when we have IP
collisions the device/devices are blocked from accessing network
● Wasted IP address space. Don’t waste IP addresses. How do you waste IP addresses?
Disorderly assignment of IP addresses
● Unnecessary complexity
There two ways to assign IPs to network devices: Static and Dynamic IP
assignment
1. Static assignment - done manually by system administrators/network Engineers 2. Dynamic Assignment -Done by Dynamic Host
Configuration Protocol (DHCP) server
DHCP server
● Where is installed?
○ Computers
○ Routers
○ Firewall
○ Access points
● DHCP helps us to avoid tedious work of static IP assignment in big
organizations such Cooperative University. Helps us to avoid wastage of IP
addresses because when the leaves or lease expire it can be assigned to
others
IPV4 Addressing
1. IPV4 address consist of 4 octets separated by decimal point (dot) e.g. 192.168.10.5
2. An octet is I byte and 1 byte is equivalent to 8 bits
3. Each Octet represent 1 byte and therefore IPV4 is a 32 bit address. The value of octet ranges from 0-255 in decimal
4. The IP address can be represented in binary or decimal format. For easy conversion from decimal to binary the table below can be used. Eg.
192.150.10.5 , same as 11000000.10010110.00001010.00000101, this is a class C IP address , Network ID is 192.150.10.0, Host IP
192.150.10.5
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0 192
1 0 0 1 0 1 1 0 150
0 0 0 0 1 0 1 0 10
0 0 0 0 0 1 0 1 5
IPV4 Address Categories/classes
IPV4 addresses have been categorised into 5 IP classes
This classification is known as Classful network architecture
With this system, the first octet defines the class of the address
Class Range
A 0-127
B 128-191
C 192-223
D (multi cast) 224-239
E (reserved) 240-255
IPV4 Address Categories
IP Classes
Class A- The first octet identifies the network (it is the network ID). Can address a maximum of
224-2 network nodes. These are the number of address available which you can assign to
machines/nodes. Less 2 addresses because first address (0) is the network and the last is for
broadcast. The first address is reserved for the network and last one is used for broadcast.
Broadcast is a transmission which is meant for all users ,
Class B- the first 2 octet are used to identify the network and the remain two are used to identify
network nodes. You can address a maximum of 216-2.
Class C- the first 3 octets are used to identify the network and the remaining octet is used for
network nodes. You can address maximum of 28-2=254 nodes. It is less 2 because the first
number or address (0) is for network and the last address (255) is reserved for broadcast (i.e.
when node want to talk with other nodes in the network). 192.150.10.0 is network address, and
192.150.10.255 is broadcast address
Subnet Mask
A subnet Masks- This is an address which is used to identify the network part
and the host part of an IP address. In other words it tells the Network part and
the device IP part. Examples for default network masks
Class A 255.0.0.0 = 11111111.00000000.00000000.00000000
Class B 255.255.0.0=11111111.11111111.00000000.00000000
Class C 255.255.255.0=11111111.11111111.11111111.00000000
NB: The zeros represent host part, and the 255 represent network part. In
Binary the network ID part will have all binary 1, and host part will have zeros
Subnet Mask
Another way of denoting network mask is use of Classless Interdomain Routing
(CIDR) scheme. In this scheme the network mask is denoted as the number of
1’s in the network mask. The IP address of Host is denoted as the IP address
/mask example default network mask in class is Class C 255.255.255.0 in
binary is same as 11111111.11111111.11111111.00000000 or in CIDR scheme /24
Example in Class C network 192.168.10.5 with default subnet mask
255.255.255.0 it can be denoted as 192.168.10.5/24
LOOPBACK Address
In class A the IP address 127.0.0.1 is called loopback address. It is reserved for
testing whether the network adapter card is properly working
Private IP Addresses
The Internet Assigned Numbers Authority (IANA) has reserved a number of IPv4
network ranges as private. The Private IP addresses are used by organizations
which would like to set up their own internal network and dont have or don't want
to use the public IP address space.
The Private IP addresses are not routable in the Internet
● 10.0.0.0 – 10.255.255.255
● 172.16.0.0 – 172.31.255.255
● 192.168.0.0 – 192.168.255.255,
Private IP Addresses
Organizations are recommended to use the provided set of IP addresses inorder
to avoid causing conflicts with public IP addresses. When assigning computers
private IP addresses as Network Engineer you must make reference to this set
provided by IANA
Network Address Translation (NAT)
To allow traffic from hosts that are using private addresses to access Internet
hosts using a public address, Network Address Translation (NAT) is required. NAT
allows internal hosts IPs to be translated to a public address for Internet access.
Public address space is difficult to get and is expensive. These public IPs are sold
by ISPs such SAFARICOM, AIRTEL, TELKOM, etc
Subnetting
The process of dividing network into two or more subnetworks is called subnetting/Segmentation
To subnet a network, extend the mask using some of the bits from the host ID portion of the address to create a
subnetwork ID.
Example: Given a network of 192.168.5.0/24, which has a mask of 255.255.255.0 (i.e, the /24), and you are
required to come up with 8 network segments: 11111111.11111111.11111111.00000000, to subnet you will borrow 3 bits
from host part to become part of network ID. New network mask 11111111.11111111.11111111.11100000 (/27)
equivalent to 255.255.255.224
2𝑥 = 𝑛𝑢𝑚𝑏𝑒𝑟 𝑠𝑢𝑏𝑛𝑒𝑡𝑠 ,8=x is the bits to steal, x=3, in this design requirement, each segment has 25 − 2
= 30 ℎ𝑜𝑠𝑡𝑠
List the networks, 256-224=32, therefore 192.168.5.0/27, 192.168.5.32/27,192.168.5.64/27, 192.168.5.96/27,
192.168.5.128/27, 192.168.5.160/27, 192.168.5.192/27, 192.168.5.224/27
Subnetting
The binary representations of network mask helps to easily visualize the network part and the
host part of the network. In the subnet mask, the bits for network ID are set to 1 and those
for those for host ID are set to zero
In the example above the network has been divided to 23 ( 8) subnets and each subnet will have 25 (32) hosts
addresses,
Network Network Mask Address range for the hosts
192.168.5.0 /27 (255.255.255.224) 192.168.5.1, 192.168.5.2,....192.168.5.30
Please note broadcast address
192.168.5.31
192.168.5.32 /27 (255.255.255.224) 192.168.5.33,192.168.5.34,..........,
192.168.5.62
broadcast address 192.168.5.63
192.168.5.64 /27 192.168.5.65, …..,192.168.5.94
broadcast address 192.168.5.95
Networks/subnets
● Formula: 256-224=32, now the networks are
● 192.168.5.0, 192.168.5.32,192.168.5.64, 192.168.5.96, 192.168.5.128,
192.168.5.160, 192.168.5.192, 192.168.5.224
Subnetting
The mask can also be denoted as /27 (CIDR format)as there are 27 bits that are
set in the mask instead of 255.255.255.224 (decimal format)
Example 192.168.5.32/27 for the 192.168.5.32 network
Subnetting
● Example: suppose you are given network address 192.168.10.0/25 determine
● How many subnets are there?
Our mask in decimal Mask in decimal 255.255.255.128
Please note that the default network mask for class c =255.255.255.0/24
■ 21 = 2 subnets/segments
■ No of hosts per subnet = 232−25 − 2 = 126
● 256-128=128, therefore NETWORK 1 192.168.10.0, NETWORK 2 192.168.10.128
● Broadcast address for each subnet
■ 192.168.10.127 broadcast address for first network
■ 192.168.10.255 broadcast address for second network
Subnetting
Valid hosts
First host First network: 192.168.10.1
Second Network 192.168.10.129
Last host First network: 192.168.10.126
Second Network: 192.168.10.254
Subnetting
Example 3: for the given network address 192.168.10.0/255.255.255.224
determine:
● number of subnets = 8subnets
● Number of hosts per subnet= 2^5-2=30
● Networks, 192.168.10.0, 192.168.10.32, 192.168.10.64,192.168.10.96,
192.168.10.128, 192.168.10.160, 192.168.10.192, 192.168.10.224
● Broadcast address for each subnet 192.168.10.31, 192.168.10.63,
192.168.10.95, etc
● Valid first host Ip and Last host IP in each subnet
● 256-224=32