Chapter - Network Protocols and Architecture
Chapter - Network Protocols and Architecture
Chapter one
Network Protocols and Architecture
5.1 The Physical Layer
The physical layer, the lowest layer of the OSI model, which primarily concerned with the
transmission and reception of the unstructured raw bit stream over a physical medium. This layer
have the following main function in the data communication over the network.
Line configuration:
Physical layer also defines the way in which the devices are connected to the medium. Two
different line configurations are used point to point configuration and multipoint configuration. To
activate, maintain and deactivate the physical connection.
Multiplexing:
Physical layer can use different techniques of multiplexing, in order to improve the channel
efficiency.
Note:
Protocols used at physical layer includes ISDN, IEEE 802 and IEEE 802.2. The X.25 protocols
works at the physical, data link, and network layers.
The diagram below shows the main functions of data link layer are
5.2.1 Framing
The data link layer divides (breaking) the stream of bits received from the network layer into
manageable data units called frames (typically a few hundred bytes) and wrap it with layer two
Header that is known as frame.
Our postal system practices a type of framing. The simple act of inserting a letter into an envelope
separates one piece of information from another; the envelope serves as the delimiter. In addition,
each envelope defines sender and receiver addresses since postal system is a manyto-many carrier
facility.
Framing in the data link layer separates a message from one source to a destination, or from other
messages to other destinations, by adding a sender address and a destination address. The
destination address defines where the packet is to go; the sender address helps the recipient
acknowledge the receipt.
Although the whole message could be packed in one frame, that is not normally done. One reason
is that a frame can be very large, making flow and error control very inefficient. When a message
is carried in one very large frame, even a single-bit error would require the retransmission of the
The trouble with this algorithm is that the count can be garbled by a transmission error. For
example, if the byte count of 5 in the second frame of the above Fig. becomes a 7 due to a single
bit flip, the destination will get out of synchronization. It will then be unable to locate the correct
start of the next frame. Even if the checksum is incorrect so the destination knows that the frame
is bad, it still has no way of telling where the next frame starts. Sending a frame back to the source
Variable-Size Framing:
Variable-size framing is prevalent in local area networks. In variable-size framing, we need a way
to define the end of the frame and the beginning of the next. Historically, two approaches were
used for this purpose: a character-oriented approach and a bit-oriented approach.
(1) Character-Oriented Protocols
In a character-oriented protocol, data to be carried are 8-bit characters from a coding system such
as ASCII. The header, which normally carries the source and destination addresses and other
control information, and the trailer, which carries error detection or error correction redundant
bits, are also multiples of 8 bits. To separate one frame from the next, an 8-bit (1-byte) flag is
added at the beginning and the end of a frame.
The flag, composed of protocol-dependent special characters, signals the start or end of a frame.
Character-oriented framing was popular when only text was exchanged by the data link layers. The
flag could be selected to be any character not used for text communication.
Now, however, we send other types of information such as graphs, audio, and video, in which any
pattern used for the flag could also be part of the information. If this happens, the receiver, when
it encounters this pattern in the middle of the data, thinks it has reached the end of frame.
To fix this problem, a byte-stuffing strategy was added to character-oriented framing. In byte
stuffing (or character stuffing), a special byte is added to the data section of the frame when there
is a character with the same pattern as the flag. The data section is stuffed with an extra byte. This
byte is usually called the escape character (ESC), which has a predefined bit pattern. Whenever
receiver encounters the ESC character, it removes it from the data section and treats next character
as data, not delimiting flag.
Byte stuffing by the escape character allows the presence of the flag in the data section of the
frame, but it creates another problem. What happens if the text contains one or more normal
escape characters followed by a flag? The receiver removes the escape character, but keeps the
flag, which is incorrectly interpreted as the end of the frame. To solve this problem, the escape
characters that are part of the text must also be marked by another escape character. In other words,
if the escape character is part of the text, an extra one is added to show that the second one is part
of the text.
This flag can create the same type of problem we saw in the byte-oriented protocols. That is, if the
flag pattern appears in the data, we need to somehow inform the receiver that this is not the end of
the frame. We do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern from looking
like a flag. The strategy is called bit stuffing.
In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added. This extra
stuffed bit is eventually removed from the data by the receiver. Note that the extra bit is added
after one 0 followed by five 1s regardless of the value of the next bit. This guarantees that the flag
field sequence does not inadvertently appear in the frame.
The above figure shows bit stuffing at the sender and bit removal at the receiver. Note that even if
we have a 0 after five 1s, we still stuff a 0. The 0 will be removed by the receiver. This means that
if the flag like pattern 01111110 appears in the data, it will change to 011111010 (stuffed) and is
not mistaken as a flag by the receiver. The real flag 01111110 is not stuffed by the sender and is
recognized by the receiver as a flag.
MAC address is the 12 digit hexadecimal (48 bit) number unique to every computer in this world.
It is also known as hardware address. This address is burnt with device by manufacturing company
and located on its Network Interface Card (NIC). In these 12 digits of MAC address, the first six
hexadecimal digits of a MAC address represent the NIC manufacturer (manufacture company) and
the last six digits are unique. For example, 32-14-a6-42-71-0c is the 12 digit hexadecimal MAC
address. Thus MAC address represents the physical address of a device in the network. The MAC
addresses only need to be unique in a broadcast domain. You can have the same MAC address in
different broadcast domains.
(b) Checksum
An alternative error-checking scheme is called checksum. This technique works by considering
the data stream as a sequence of integer values. After the sending computer has transmitted n
integer values, the arithmetic sum of the n integers is computed and transmitted. The receiving
computer computes the same sum and compares it against the received checksum value.
Checksum can normally detect, but not correct for, multiple bit errors. However, there are cases in
which checksum can miss transmission errors. For example, consider the following sequence of
integers: 11, 34, 3, 0, 12. The checksum generated by this sequence would be 60, so the transmitted
sequence would be 11, 34, 3, 0, 12, 60. Now assume that two bits in this sequence are corrupted
and their values flipped, so that the transmitted sequence is actually 11, 32, 3, 2, 12, 60. The
receiving computer would calculate the checksum value as 60 (=11+32+3+2+12) and assume that
there has been no error. In fact, undetected transmission errors can occur with checksum whenever
the same bit is changed in two different integers in the sequence: in the example described above
the second bit in the integers 34 and 0 was flipped, one changing from 0 to 1 and one changing
from 1 to 0.
Collision occurs if two computers put data on the cable at the same time
Access methods need to be consistent in the way they handle data. If different computers were to
use different access methods, the network would fail because some methods would dominate the
cable.
Random Access Protocols
In random access or contention methods, no station is superior to another station and none is
assigned the control over another. No station permits, or does not permit, another station to send.
At each instance, a station that has data to send uses a procedure defined by the protocol to make
a decision on whether or not to send. This decision depends on the state of the medium (idle or
busy). In other words, each station can transmit when it desires on the condition that it follows the
predefined procedure, including the testing of the state of the medium.
In a random access method, each station has the right to the medium without being controlled by
any other station. However, if more than one station tries to send, there is an access
conflictcollision and the frames will be either destroyed or modified. To avoid access conflict or
to resolve it when it happens, each station follows a procedure that answers the following
questions:
When can the station access the medium?
What can the station do if the medium is busy?
How can the station determine the success or failure of the transmission?
What can the station do if there is an access conflict?
The random access methods have evolved from a very interesting protocol known as ALOHA,
which used a very simple procedure called multiple access (MA). The method was improved with
the addition of a procedure that forces the station to sense the medium before transmitting. This
was called carrier sense multiple access. This method later evolved into two parallel methods:
carrier sense multiple access with collision detection (CSMA/CD) and carrier sense multiple
access with collision avoidance (CSMA/CA).
The Figure below illustrates when a computer can and cannot transmit data.
Computer senses that the cable is free and the data is sent.
The sending device will monitor the channel while it is transmitting its message to make
certain there are no collisions. So that If data is on the cable, no other computer can transmit
until the cable is free again
If the network is free and two devices access the line at exactly the same time, their signals
collide and sending device detects a collision, it and other transmitting device(s) will
transmit jamming signal to notify all attached stations that collision has occurred.
When collision is detected both sending device back off and will wait for a random amount
of time and then will attempt to retransmit the message. On a busy network, such an attempt
may be repeated many times before the transmission is successful.
If collisions are still detected after many attempts, the user may be informed that the network
is too busy to transmit.
Known as a contention method because computers compete for the opportunity to send data.
(Database applications cause more traffic than other applications).
More computers cause the network traffic to increase and performance to degrade.
The ability to "listen" extends to a 2,500 meter cable length => segments can't sense signals
beyond that distance.
used by Ethernet LANs
Demand
Feature/function CSMA/CD CSMA/CA Token passing
priority
Type of Broadcast Broadcast
Token based Hub based
communication based based
Type of access
Contention Contention Non-contention Contention
method
To meet the objective stated above the network layer is responsible for the following functions:
(1) Logical addressing and Logical-Physical Address Mapping:
The physical addressing implemented by the data link layer handles the addressing problem
locally. If a packet passes the network boundary, we need another addressing system to help
distinguish the source and destination systems. So that this layer is in charge of packet addressing,
converting logical addresses into physical addresses.
Inter-Networking
The network layer lies between data link layer and transport layer. It takes services from Data link
and provides services to the transport layer.
(4) Packetizing
The network layer receive message segment from transport layer and wrap it with IP header that
is known as datagram among other things, includes the logical addresses of the sender and receiver
to creates its own packets by encapsulating these packets. The process is known as packetizing.
This packetizing in done by Internet Protocol (IP) that defines its own packet format.
Datagram is just another name of packet. Network layer use datagram to transfer information
between nodes. Two types of packets are used at the Network layer: data and route updates.
Data packets:- are used to transport the user data across the network. Protocols used by data
packets are known as routed protocol. For example IP and IPv6
Route update packets:- These packets are used to update the route information within
internetwork. Routers use these packets. Protocols that send route update packets are called
routing protocols; for example RIP, RIPv2, EIGRP, and OSPF
(5) Fragmentation
Fragmentation means dividing the larger packets into small fragments. The maximum size for a
transportable packet in defined by physical layer protocol. For this, network layer divides the large
packets into fragments so that they can be easily sent on the physical medium. If it determines that
a downstream router's maximum transmission unit (MTU) size is less than the frame size, a router
can fragment a frame for transmission and re-assembly at the destination station.
IP Addressing
As discuss in previous section communication at the network layer is host-to-host (computer-
tocomputer); a computer somewhere in the world needs to communicate with another computer
somewhere else in the world. Usually, computers communicate through the Internet. The packet
transmitted by the sending computer may pass through several LANs or WANs before reaching
the destination computer. IP is the primary protocol that has the task of delivering distinguished
protocol datagrams (packets) from the source host to the destination host solely based on their
addresses. For this purpose the Internet Protocol defines addressing methods and structures for
datagram encapsulation. Such an address distinguishes each device uniquely and universally.
These logical address known as IP address. IP routes packets on the network by using IP
addresses.
The first major version of addressing structure, now referred to as Internet Protocol Version 4
(IPv4) is still the dominant protocol of the Internet, although the successor, Internet Protocol
Version 6 (IPv6), is being deployed actively worldwide (128 bits).
Address Space:- A protocol such as IPv4 that defines addresses has an address space. An address
space is the total number of addresses used by the protocol. If a protocol uses N bits to define an
address, the address space is 2N because each bit can have two different values (0 or 1) and N bits
can have 2N values. IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than 4 billion). This means that, theoretically, if there were no restrictions,
more than 4 billion devices could be connected to the Internet. We will see shortly that the actual
number is much less because of the restrictions imposed on the addresses.
Notations: There are two prevalent notations to show an IPv4 address: binary notation and dotted-
decimal notation. In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often
referred to as a byte. So it is common to hear an IPv4 address referred to as a 32-bit addressor a 4-
byte address. The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
To make the IPv4 address more compact and easier to read, Internet addresses are usually written
in decimal form with a decimal point(dot) separating the bytes. The following is the dotteddecimal
notation of the above address:
117.149.29.2
The figure below shows an IPv4 address in both binary and dotted-decimal notation. Note that
because each byte (octet) is 8 bits, each number in dotted-decimal notation is a value ranging from
0 to 255.
Change the following IPv4 addresses from dotted-decimal notation to binary notation
Classful Addressing
IPv4 addressing, at its inception, used the concept of classes. This architecture is called classful
addressing. Although this scheme is becoming obsolete, we briefly discuss it here to show the
rationale behind classless addressing.
In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Each class
occupies some part of the address space.
We can find the class of an address when given the address in binary notation or dotted-decimal
notation. If the address is given in binary notation, the first few bits can immediately tell us the
class of the address. If the address is given in decimal-dotted notation, the first byte defines the
class. Both methods are shown in Figure below.
CLASS A 0XXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
CLASS B 10XXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
Note: “X” stands for don’t care values (i.e. either “o” or ” 1”)
The first 3 classes ( A, B and C) are used to identify workstations, routers, switches and other
devices whereas the last 2 Classes (D and E) are reserved for special use.
Classes and Blocks
One problem with classful addressing is that each class is divided into a fixed number of blocks
with each block having a fixed size as shown in Table below.
Let us examine the table. Previously, when an organization requested a block of addresses, it was
granted one in class A, B, or C. Class A addresses were designed for large organizations with a
large number of attached hosts or routers. Class B addresses were designed for mid size
In class A networks, the first one byte (8 bits) of the IP address are fixed (i.e. the first of the four
numbers) and defines the network id, whereas the last three bytes define the host id, allowing
network administrators to assign as computer addresses. In class A, As 24 bits are available for
For example, given the IP address 128.255.10.1, we know immediately that this is on a class B
network. We can tell this because if we rewrite the address in binary form
(10000000.11111111.00001010.00000001), the first two bits are 10, which always indicate a class
B network. So the first 16 bits represent the network ID (128.255) and the last 16 bits are the
computer ID (10.1).
To tell what class of network an IP address is on, we do not need to always rewrite the address in
binary form. Any address beginning with a number between 0 and 127 is on a class A network,
between 128 and 191 is on a class B network, and between 192 and 223 is on a class C network.
Any IP address starting with any number greater than 223 is reserved for special uses.
Exercise 1
For example, using the class-based system of IP addressing, what can you deduce from the
following IP addresses? i.e. What class network are they on, and what are the network ID and
computer ID?
We can see that any IP address that has a valid network ID, but all binary 0’s for the computer ID, is
the network number. The network number is a way of referring to an entire subnet. Therefore this
address cannot be assigned to a computer. Similarly if the computer ID is all binary 1’s it is a
broadcast address. The broadcast address is used if you want to send a packet to every computer on
a subnet. Therefore this address can also not be assigned to a computer on the network. For example,
a class C network provides 256 different values for the computer ID, but only 254 of these can be
assigned to computers.
Most subnets have at least one router. If it didn’t have a router it would be isolated and could not
communicate with any other networks. A router must also have an IP address on the subnet, and by
convention the first IP address after the network number is assigned to the default router. Note that
this is not a rule, just a convention (it is usually done but you do not have to do it).
Therefore the valid IPv4 addresses range for classful address are give below:
Class A addresses range from 1-126.
Class B addresses range from 128-191.
Class C addresses range from 192-223.
Class D addresses range from 224-239.
Data Communication and Computer Networks
Class E addresses range from 240-254.
Mask
Although the length of the network id and host id (in bits) is predetermined in classful addressing, we
can also use a mask(also called the default mask), a 32-bit number made of contiguous 1s followed
by contiguous 0s. The masks for classes A, B, and C are shown in Table below. The concept does not
apply to classes D and E.
The mask can help us to find the network id and the host id. For example, the mask for a class A
address has eight 1s, which means the first 8 bits of any address in class A define the network id; the
next 24 bits define the host id.
The last column of the above Table shows the mask in the form /n where n can be 8, 16, or 24 in
classful addressing. This notation is also called slash notation or Classless Inter domain Routing
(CIDR) notation. The notation is used in classless addressing, which we will discuss later. We
introduce it here because it can also be applied to classful addressing. We will show later that classful
addressing is a special case of classless addressing.
Block Size:- Block size is size of subnet including network address, hosts addresses and broadcast
address.
Network address:- First address of subnet is called network ID. This address is used to identify
one segment or broadcast domain from all the other segments in the network.
Broadcast ID:- There are two types of broadcast, direct broadcast and full broadcast.
Direct broadcast or local broadcast is the last address of subnet and can be hear by all
hosts in subnet.
Full broadcast is the last address of IP classes and can be hear by all IP hosts in network.
Full broadcast address is 255.255.255.255
The main difference between direct broadcast and full broadcast is that routers will not
propagate local broadcasts between segments, but they will propagate directed
broadcasts.
Data Communication and Computer Networks
Host Addresses:- All address between the network address and the directed broadcast address
is called host address for the subnet. You can assign host addresses to any IP devices such as
PCs, servers, routers, and switches.
(2) Subnetting and Classless Addressing
Subnetting
During the era of classful addressing, sub netting was introduced. If an organization was granted a
large block in class A or B, it could divide the addresses into several contiguous groups and assign
each group to smaller networks (called subnets) or, in rare cases, share part of the addresses with
neighbors. These smaller network known as subnets and this process known as subnetting. Let's take
an example of a company that have three story building, divided by floors, with each floor divided
into offices. Think building as network, floors as subnets, and office as host.
Subnetting is a process of breaking large network in smaller network known as subnet (a group of
computers divided by layer 3 IP address). Subnet are easier to manage. Subnetting reduces network
traffic, which improve network performance. Subnetting increases the number of 1s in the mask.
Subnet have hierarchical structure and In subnetting some bits from host portion are taken to create
subnet address.
Supernetting
The time came when most of the class A and class B addresses were depleted; however, there was
still a huge demand for midsize blocks. The size of a class C block with a maximum number of 256
addresses did not satisfy the needs of most organizations.
Even a midsize organization needed more addresses, one solution was supernetting. In supernetting,
an organization can combine several class C blocks to create a larger range of addresses. In other
words, several networks are combined to create a super-network or a supemet. An organization can
apply for a set of class C blocks instead of just one. For example, an organization that needs 1000
addresses can be granted four contiguous class C blocks. The organization can then use these
addresses to create one super-network. Supernetting decreases the number of 1s in the mask. For
example, if an organization is given four class C addresses, the mask changes from /24 to /22. We
will see that classless addressing eliminated the need for supernetting.
Supernetting(the reverse process of subnetting) is done at router, for route broadcast. Supernetting
allows router to keep its routing table as small as possible. Router relies on routing to determine route
for packet. Router broadcast its routing table so other router can learn about the network it have. As
network grow routers require huge memory tables to store all routing information. Supernetting helps
reduce the size of router memory tables by combining and summarizing multiple routing information
entries into one single entry.
Data Communication and Computer Networks
Differences between Subnetting and Supernetting
Subnetting breaks large network in smaller networks which are smaller networks are easier to
manage, while supernetting combine smaller networks in single possible large network.
Subnetting is done to reduce network traffic by removing collision and broadcast traffic, that
overall improve performance, while supernetting is done to reduce size of routing table
Subnetting reduce collision and broadcast traffic between subnets. Supernetting reduce
broadcast traffic between routers.
Subnetting reduces network traffic Subnetting allows you to apply network security polices at
the interconnection between subnets.
Subnetting allows you to save money by reducing requirement for IP range
Classless Addressing
When the class-based system was introduced, it was thought that it would easily provide enough IP
addresses for the Internet. However, the flaws in classful addressing scheme combined with the fast
growth of the Internet users worldwide led to the near depletion of available addresses (i.e. due to
rapid increase in the number of Internet users, IP addresses eventually came to be in short supply).
Yet the number of devices on the Internet is much less than the 232 address space, we have run out of
class A and B addresses, and a class C block is too small for most midsize organizations. To overcome
address depletion and give more organizations access to the Internet, classless addressing was
designed and implemented. In 1994 a new system was introduced: classless inter-domain routing
(CIDR).
Address Block:- In classless addressing (CIDR scheme), there are no classes, but when an entity,
small or large, needs to be connected to the Internet, it is granted a block (range) of addresses. The
size of the block (the number of addresses) varies based on the nature and size of the entity. For
example, a household may be given only two addresses; a large organization may be given thousands
of addresses. An ISP, as the Internet service provider, may be given thousands or hundreds of
thousands based on the number of customers it may serve.
Restriction:- To simplify the handling of addresses, the Internet authorities impose three restrictions
on classless address blocks:
We can see that the restrictions are applied to this block. The addresses are contiguous. The number
of addresses is a power of 2 (16 = 24), and the first address is divisible by16. The first address, when
converted to a decimal number, is 3,440,387,360, which when divided by 16 results in 215,024,210.
Classless addressing Mask (Subnet Mask)
A better way to define a block of addresses is to select any address in the block and the mask. CIDR
uses subnet masks to subdivide networks. As we discussed before, a mask (a subnet mask in case of
classes addressing) is a 32-bit number in which the n leftmost bits are 1s and the 32 - n rightmost bits
are 0s. However, in classless addressing the mask for a block can take any value from 0 to 32 and
indicate which of the bits in an IP address are a part of the prefix (network ID), and which are a part
of the suffix (computer ID). It is very convenient to give just the value of n preceded by a slash (CIDR
– Classless Inter Domain Routing notation). The address and the /n notation completely define the
whole block (the first address, the last address, and the number of addresses).
Subnet masks allow much more flexibility than the class-based system. For example, suppose we wish
to have a subnet with 1000 IP addresses. Under the class-based system we would have to allocate a
class B network, which has a total of 65,534 addresses, approximately 64,000 of which would be
unused. Using CIDR we can specify the following subnet mask:
11111111 11111111 11111100 00000000
Now we are using 22 bits to specify the network ID, and 10 bits for the computer ID. This allows a
total of 210, or 1024, different IP addresses in the subnet, which minimizes the number of unused
addresses.
Because we can now have any number of bits in the network ID part of the IP address, the IP address
is generally written with a slash at the end followed by the number of bits in the network ID, e.g.
200.123.192.2/22. Because of this notation a subnet with 22 bits for the network ID is known as a
“slash 22 network”.
Data Communication and Computer Networks
In decimal notation
IP address 192.168.1.10
Subnet mask 255.255.252.0
Network address is 192.168.1 and host address is 10. In binary
notation
IP address 11000000.10101000.00000001.00001010 Subnet mask
11111111.11111111.11111100.00000000
Network address is 11000000.10101000.00000001 and host address is 00001010
CIDR system has temporarily alleviated shortage of IP addresses on Internet, but still we will run out
of addresses one day. Because of this a new system is being devised that uses 128 bit addresses.
Method of subnetting
The classless addressing schema is achieved by using the subnetting process. In subnetting we find
the answer of following questions.
What is subnet mask for given address?
How many subnets does given subnet mask provide ?
What is block size for given subnet mask?
What are the valid subnets?
What are the total hosts?
How many valid hosts are available per subnet?
What is broadcast address of each subnet (i.e. last address of the subnet)?
What is network address of each subnet ((i.e. first address of the subnet)?)?
For example find the subnet mask of address 188.25.45.48/20? This address belong to class B and
class B has default subnet mask 255.255.0.0[ /16 in CIDR ]. We borrowed 4 bits from hosts portion.
As you know subnetting move from left to right and it cannot skip any network bit. So this subnet
mask in binary would be 11111111.11111111.11110000.00000000. First two octet have default value
so its decimal value would be 255.255. We will convert third octet in decimal value. To convert a
binary number in decimal we add its decimal equivalent value. In our example it would be
128+64+32+16+0+0+0+0 = 240. Our fourth octet has all bits off so its decimal value would be
0+0+0+0+0+0+0+0 =0. Our answer subnet mask would be 255.255.240.0
How many subnets does given subnet mask provide ?
To calculate the number of subnets provided by given subnet mask we use 2K , where K = number of
bits borrowed from host bits to create subnets. For example in 192.168.1.0/27, K is 3. By looking at
address we can determined that this address is belong to class C and class C has default subnet mask
255.255.255.0 [/24 in CIDR]. In given address we borrowed 27 - 24 = 3 host bits to create subnets.
Now 23 = 8, so our answer is 8.
Another way to find the first address is ANDing the given addresses with the mask. ANDing here is
done bit by bit. The result of ANDing 2 bits is 1 if both bits are 1s; the result is 0 otherwise.
For example, a block of addresses is granted to a small organization. We know that one of the
addresses is 205.16.37.39/28. What is the first address in the block?
Another way to find the first address is ORing the given addresses with the complement of subnet
mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 if both bits are 0s; the result is 1
otherwise. The complement of a number is found by changing each 1to 0 and each 0 to 1. For example,
a block of addresses is granted to a small organization. We know that one of the addresses is
205.16.37.39/28. What is the first address in the block?
Note:
Network address is always the first IP address of subnet.
Broadcast address is always the last IP address of subnet (IP address before the next subnet).
Valid hosts are the IP addresses between network address and broadcast address.
As we have already discussed earlier in this article that we have to have at least 2 host bits for
assigning IP addresses to hosts, that means we can't use /31 and /32 for subnetting.
/25
CIDR /25 has subnet mask 255.255.255.128 and 128 is 10000000 in binary. We used one host bit in
network address.
Default subnet mask of class C======= 11111111. 11111111. 11111111.10000000
N = 1 [Number of host bit used in network]
H = 7 [Remaining host bits]
Total subnets ( 2N):- 21 = 2.
Network ID 0 128
/26
CIDR /26 has subnet mask 255.255.255.192 and 192 is 11000000 in binary. We used two host bits in
network address.
Default subnet mask of class C====== 11111111. 11111111. 11111111.11000000
N=2 H=6
Total subnets ( 2N) :- 22 = 4.
Example 2: Assume that we have a subnet with the network number 21.100.19.0, and a subnet mask
of 255.255.255.192 (i.e. a slash 26 network) which of the following IP addresses would be on the
subnet?
a) 21.100.19.1 b) 21.101.19.1 c) 21.100.19.128 d) 21.100.19.62
Answers
First we should note that the subnet mask indicates that the first 26 bits represent the network ID, and
the last 6 bits the host ID. Now we write the network ID in binary form: 21.100.19.0 corresponds to
00010101.01100100.00010011.00000000 (network ID is normal text, computer ID in italics).
Therefore, so long as the first 26 bits of an IP address are the same as indicated above, it will be on
the subnet. If any are different it will not be. Therefore the range of IP addresses for this subnet are
Data Communication and Computer Networks
21.100.19.0 to 21.100.19.63.
a) This is on the same subnet as it is in the range specified above.
b) This is not on the same subnet as it is not in the range specified. You can check this by writing
the address in binary form – you will find that one of the first 26 bits is different.
c) Again, this is not on the same subnet because it is not in the range specified. In this case the
25th bit is different to the network number of the subnet.
d) This is on the same subnet as it is in the range specified.
Example 3: Look at the network diagram in Figure 2 and answer the following questions:
(a) What class network are the computers A, B, D and E on? What about computer C?
(b) If computer E wanted to send a packet to computer C, what IP address would it send that
packet to?
(c) Can you identify any problems with the assignment of IP addresses and default gateways in
this network?
Example 4: Given the Class C network of 204.15.5.0/24, subnet the network in order to create the
following network with the host requirements shown.
Net A: must support 14 hosts Net D: must support 7 hosts
Net B: must support 28 hosts Net E: must support 28 host
Net C: must support 2 hosts
You are required to create five subnets. The largest subnet must support 28 host addresses. Is this
possible with a Class C network? and if so, then how?
You can start by looking at the subnet requirement. In order to create the five needed subnets you
would need to use three bits from the Class C host bits. Since you need three subnet bits, that leaves
you with five bits for the host portion of the address. How many hosts will this support? 25 = 32 (30
usable). This meets the requirement.
Therefore you have determined that it is possible to create the above network with a Class C network.
An example of how you might assign the sub-networks is as follows:
Net A: 204.15.5.0/27 Host Address Range 1 To 30
Net B: 204.15.5.32/27 Host Address Range 33 To 62
Net C: 204.15.5.64/27 Host Address Range 65 To 94
Net D: 204.15.5.96/27 Host Address Range 97 To 126
Net E: 204.15.5.128/27 Host Address Range 129 To 158
Exercise
1) What is the address space in each of the following systems?
a) A system with 8-bit addresses c) A system with 16-bit addresses
b) A system with 64-bit addresses
2) An address space has a total of 1024 addresses. How many bits are needed to represent an address?
3) An address space uses the three symbols 0, 1, and 2 to represent addresses. If each address is made
of 10 symbols, how many addresses are available in this system?
4) Find the class of the following IP addresses.
a. 11110111 11110011 10000111 11011101 b. 10101111 11000000 11110000 00011101
c. 11011111 10110000 00011111 01011101 d. 11101111 11110111 11000111 00011101
5) Find the net id and the host id of the following IP addresses .
a. 114.34.2.8 b. 132.56.8.6 c. 208.34.54.12
6) In a block of addresses, we know the IP address of one host is 25.34.12.56/16. What are the first
address(network address) and the last address(limited broadcast address) in this block?
8) In a block of addresses, we know the IP address of one host is 182.44.82.16/26. What are the first
address(network address) and the last address in this block?
7) An organization is granted the block 16.0.0.0/8. The administrator wants to create 500 fixedlength
subnets.
Data Communication and Computer Networks
a. Find the subnet mask.
b. Find the number of addresses in each subnet.
c. Find the first and last addresses in subnet 1 and subnet 500.
8) An organization is granted the block 130.56.0.0/16. The administrator wants to create 1024
subnets.
a. Find the subnet mask. b. Find the number of addresses in each subnet.
c. Find first and last addresses in subnet 1 and subnet 1024.
9) Write the following masks in slash notation (/n).
a. 255.255.255.0 b. 255.0.0.0 c. 255.255.224.0 d. 255.255.240.0
10) Find the range of addresses in the following blocks.
a. 123.56.77.32/29 b. 200.17.21.128/27
c. 17.34.16.0/23 d. 180.34.64.64/30
(3) Address Allocation
The next issue in classless addressing is address allocation. How are the blocks allocated? The
ultimate responsibility of address allocation is given to a global authority called the Internet
Corporation for Assigned Names and Addresses(ICANN). However, ICANN does not normally
allocate addresses to individual organizations. It assigns a large block of addresses to an ISP. Each
ISP, in turn, divides its assigned block into smaller sub blocks and grants the sub blocks to its
customers. In other words, an ISP receives one large block to be distributed to its Internet users. This
is called address aggregation: many blocks of addresses are aggregated in one block and granted to
one ISP.
Example: An ISP is granted a block of addresses starting with 190.100.0.0/16(65,536 addresses). The
ISP needs to distribute these addresses to three groups of customers as follows:
a) The first group has 64customers; each needs 256 addresses.
b) The second group has 128 customers; each needs 128 addresses.
c) The third group has 128 customers; each needs 64addresses.
Design the sub blocks and find out how many addresses are still available after these allocations.
Solution
Group 1:- For this group, each customer needs 256 addresses. This means that 8 bits are needed to
define each host. The prefix length is then 32 - 8 = 24. The addresses are 1st Customer:
Data Communication and Computer Networks
Group2:- For this group, each customer needs 128 addresses. This means that 7 bits are needed to
define each host. The prefix length is then 32- 7 = 25. The addresses are
Group3:- For this group, each customer needs 64 addresses. This means that 6 bits are needed to each
host. The prefix length is then 32- 6 = 26. The addresses are
Exercise
1) An ISP is granted a block of addresses starting with 150.80.0.0/16. The ISP wants to distribute
these blocks to 2600customersas follows.
a) The first group has 200 medium-size businesses; each needs 128 addresses.
b) The second group has 400 small businesses; each needs 16 addresses.
c) The third group has 2000households; each needs 4 addresses.
Design the sub blocks and give the slash notation for each sub block. Find out how many addresses
are still available after these allocations.
2) An ISP is granted a block of addresses starting with 120.60.4.0/22. The ISP wants to distribute
these blocks to 100 organizations with each organization receiving just eight addresses. Design the
sub blocks and give the slash notation for each sub block. Find out how many addresses are still
available after these allocations.
3) An ISP has a block of 1024addresses. It needs to divide the addresses among 1024 customers.
Does it need subnetting? Explain your answer.
Variable Length Subnet Mask (VLSM)
In subnetting, you will notice that the same subnet mask was applied for all the subnets. This means
that all subnets have the same number of hosts as they use same subnet mask. You may need this in
some cases, but, in most cases, having the same subnet mask for all subnets ends up wasting address
space or it leads to inefficiencies.
For example, if you borrow 4 bits on a Class C network, the network was split into sixty equal-size
subnets of 14 valid hosts. however, each subnet did not utilize all the available host addresses,
Data Communication and Computer Networks
resulting in wasted address space. For instance, a serial link to another router only needs 2 hosts, but
with classical subnetting, you end up wasting 12 of those hosts. This can be visualized as follows:
Looking at the above graphic, you can see that of the subnets that are being used, NetA, NetC, and
NetD have a lot of unused host address space. This may have been a deliberate design accounting for
future growth, but in many cases this is just wasted address space due to the fact that the same subnet
mask is being used for all the subnets. Variable Length Subnet Masks (VLSM) allows you to use
different masks for each subnet, thereby using address space efficiently.
With VLSM, you can summarize subnets back to the Class A, B, or C network boundary. For example,
if you have a Class C network 192.168.1.0/24 and subnet it with a 26-bit mask, you have created four
subnets. Using VLSM and summarization, you can summarize these four subnets back to
192.168.1.0/24.
Example of VLSM: Given the following requirements, develop Subnetting scheme using VLSM:
Net A: must support 14 hosts Net B: must support 28 hosts
Net C: must support 2 hosts Net D: must support 7 hosts
Net E: must support 28 host
Determine what mask will allow the required number of hosts.
Net A: requires a /28 (255.255.255.240) mask to support 14 hosts
Net B: requires a /27 (255.255.255.224) mask to support 28 hosts
Net C: requires a /30 (255.255.255.250) mask to support 2 hosts
Data Communication and Computer Networks
Net D: requires a /28 (255.255.255.240) mask to support 7 hosts
Net E: requires a /27 (255.255.255.224 mask to support 28 hosts
The easiest way to assign the Subnets is to start assigning the largest first. Thus, you can assign in the
following manner.
Net B: 204.15.5.0/27 Host Address Range 1 To 30
Net E: 204.15.5.32/27 Host Address Range 33 To 62
Net A: 204.15.5.64/28 Host Address Range 65 To 78
Net D: 204.15.5.80/28 Host Address Range 81 To 94
Net C: 204.15.5.96/30 Host Address Range 97 To 98
This can be graphically represented as follows.
From the above graphic you can see how using VLSM helped save more than half of address space.
The third range (192.168.*.*) is the range used on the FBE network.
Any organization can use an address out of this set without permission from the Internet authorities.
Everyone knows that these reserved addresses are for private net-works. They are unique inside the
organization, but they are not unique globally.
These IP addresses also called ‘non-routable’ addresses. This means that routers on the Internet will
never forward them. This is because they are reserved for local network use. If every computer in the
world that was on a network connected to the Internet had to have a unique IP address we would have
run out of IP addresses many years ago. But many of these computers are on networks that only
connect to the Internet through a single router, gateway computer or dial-up connection. Therefore,
on networks like this we only need a single routable IP address; the rest of the computers can be given
non-routable addresses. A number of computers on networks in different parts of the world can share
the same non-routable IP address provided they are not directly connected on the same network.
Internet routers are programmed to ignore these addresses so there can be no address conflict.
See the Figure below for an illustration. Here we have two LANs, called A and B. Both contain 3
PCs with the same IP addresses (192.168.0.2 to 192.168.0.4). Similarly the routers that connect the
LANs to the Internet have the same IP address on the LAN (192.168.0.1). However, the Internet IP
addresses of each of these routers are different (200.111.23.12 and 197.210.33.12). Since all routers
are programmed to ignore addresses in the range 192.168.0.0 – 192.168.255.255 there is no address
Data Communication and Computer Networks
conflict. Note also that these computers can never receive packets from the Internet, because their
router would ignore them. All packets for these subnets must be addressed to the routable IP address
of the router. Therefore every network connected to the Internet must have at least 1 routable IP
address.
Exercise:- Which of the following IP addresses are invalid addresses for computers on the Internet?
If they are invalid, explain why.
a) 130.22.256.22 f) 255.255.255.255
b) 222.222.255.222 g) 127.0.0.1
c) 240.12.3.24 h) 13.13.0.13
d) 128.128.0.128 i) 10.240.12.11
e) 200.128.0.255
Answers
b, d, h are valid IP addresses
a) invalid address because the third number is 256 – the highest possible value is 255.
c) invalid address because the first number is above 223, which belong to reserved address
e) invalid address because the last number is 255, which represents directed broadcast address,
f) invalid address because it represents the full broadcast address, which is reserved
g) invalid address because it represents loopback address and cannot be assigned to computers.
This is used for troubleshooting purposes, and will send a message to the local computer.
i) invalid address because this is a non-routable address – it will be ignored by Internet routers so
the computer will never receive any packets.
Data Communication and Computer Networks
5.3.3 IPv6 Address
Despite all short-term solutions, such as classless addressing, Dynamic Host Configuration Protocol
(DHCP), that will explained later under an application layer protocols and NAT, address depletion is
still a long-term problem for the Internet. This and other problems in the IP protocol itself, such as
lack of accommodation for real-time audio and video transmission, and encryption and authentication
of data for some applications, have been the motivation for IPv6.
Using this form of abbreviation, 0074 can be written as 74, OOOF as F, and 0000as O. Note that 3210
cannot be abbreviated. Further abbreviations are possible if there are consecutive sections consisting
of zeros only. We can remove the zeros altogether and replace them with a double semicolon.
Data Communication and Computer Networks
Note that this type of abbreviation is allowed only once per address. If there are two runs of zero
sections, only one of them can be abbreviated. Re-expansion of the abbreviated address is very simple:
Align the unabbreviated portions and insert zeros to get the original expanded address.
Example: Expand the address 0:15::1:12:1213 to its original.
Solution:- We first need to align the left side of the double colon to the left of the original pattern and
the right side of the double colon to the right of the original pattern to find now many Os we need to
replace the double colon.
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
0: 15: l: 12:1213
This means that the original address is 0000:0015:0000:0000:0000:0001 :0012: 1213
Reading Assignment
Ipv6 Unicast Addresses
Ipv6 Multicast Addresses
Ipv6 Allycast Addresses
Ipv6 Reserved Addresses
Ipv6 Local Addresses
Data Communication and Computer Networks
Exercise
(1) Show the shortest form of the following addresses.
a) 2340:lABC: 119A:A000:0000:0000:0000:0000
b) 0000: 00AA: 0000: 0000: 0000: 0000: 119A:A231
c) 2340:0000:0000:0000:0000: 119 A:AOO1 :0000
d) 0000:0000:0000:2340:0000:0000:0000:0000
(2) Show the original(unabbreviated) form of the following addresses.
a) 0::0 b) 0:AA::0 c) 0: 1234::3 d) 123::1:2
(3) What is the type of each of the following addresses?
a) FE80::12 b) FECO: :24A2 c) FF02::0 d) 0::01
(4) A host has the address 581E: 1456:2314:ABCD::1211. If the node identification is 48 bits, find
the address of the subnet to which the host is attached.
(5) A site with 200 subnets has the class B address of 132.45.0.0. The site recently migrated to IPv6
with the subscriber prefix 581E:1456:2314::ABCD/80.Design the subnets and define the subnet
addresses, using a subnet identifier of 32bits.
(6) Show in hexadecimal colon notation the IPv6 address
a) Compatible to the IPv4 address129.6.12.34
b) Mapped to the IPv4 address129.6.12.34
5.3.4 Addressing Mapping (ARP and RARP)
An internet is made of a combination of physical networks connected by internetworking devices such
as routers. A packet starting from a source host may pass through several different physical networks
before finally reaching the destination host. The hosts and routers are recognized at the network level
by their logical (IP) addresses.
However, packets pass through physical networks to reach these hosts and routers. At the physical
level, the hosts and routers are recognized by their physical addresses. The physical address and the
logical address are two different identifiers. We need both because a physical network such as
Ethernet can have two different protocols at the network layer such as IP and IPX (Novell) at the same
time. Likewise, a packet at a network layer such as IP may pass through different physical networks
such as Ethernet and LocalTalk(Apple).
This means that delivery of a packet to a host or a router requires two levels of addressing: logical
and physical. We need to be able to map a logical address to its corresponding physical address and
vice versa. These can be done by using either static or dynamic mapping.
Data Communication and Computer Networks
Static mapping involves in the creation of a table that associates a logical address with a physical
address. This table is stored in each machine on the network. Each machine that knows, for example,
the IP address of another machine but not its physical address can look it up in the table. This has
some limitations because physical addresses may change in the following ways:
a) A machine could change its NIC, resulting in a new physical address.
b) In some LANs, such as LocalTalk, the physical address changes every time the computer
is turned on.
c) A mobile computer can move from one physical network to another, resulting in a change
in its physical address.
To implement these changes, a static mapping table must be updated periodically. This overhead could
affect network performance.
In dynamic mapping each time a machine knows one of the two addresses (logical or physical), it can
use a protocol to find the other one.
ARP stands for the address resolution protocol. It operates at the Network layer of OSI, and the
Internet layer of TCP/IP. It is responsible for mapping from IP addresses to MAC addresses.
Anytime a host or a router has an IP datagram to send to another host or router, it has the logical (IP)
address of the receiver. The logical (IP) address is obtained from the DNS if the sender is the host or
it is found in a routing table if the sender is a router. But the IP datagram must be encapsulated in a
frame to be able to pass through the physical network. This means that the sender needs the physical
address of the receiver. The host or the router sends an ARP query packet. The packet includes the
physical and IP addresses of the sender and the IP address of the receiver. Because the sender does
not know the physical address of the receiver, the query is broadcast over the network
For example, suppose that a computer COM1 with IP address 10.0.0.2 wanted to send a message to a
computer COMSERVER with IP address 10.0.0.1. Before any communication is possible COM1 must
know the MAC address of COMSERVER. Stored in the RAM of COM1 will be an ARP cache. This
cache will contain a list of all IP-MAC translations that COM1 knows about. If there is no entry for
COMSERVER in the ARP cache on COM1, COM1 will broadcast an ARP Request packet to the
network. COMSERVER will receive this broadcast and notice that the target IP address in the message
is the same as its own. Therefore it will send a unicast ARP Reply back to COM1 with the required
MAC address. Notice that the ARP Request must be broadcast to the whole network, as COM1 does
not yet know the MAC address to send it to. But the ARP reply from COMSERVER can be unicast
because COMSERVER knows the MAC address of COM1 from the ARP Request packet. After COM1
receives the ARP Reply it can communicate directly with COMSERVER. It will also add the IP-MAC
translation for COMSERVER to its ARP cache.
Data Communication and Computer Networks
RARP stands for the reverse address resolution protocol, and is responsible for mapping from MAC
addresses to IP addresses. There are occasions in which a host knows its physical address, but needs
to know its logical address. This may happen in two cases:
(a) A diskless station is just booted. The station can find its physical address by checking its
interface, but it does not know its IP address.
(b) An organization does not have enough IP addresses to assign to each station; it needs to assign
IP addresses on demand. The station can send its physical address and ask for a short time
lease.
To create an IP datagram, a host or a router needs to know its own IP address or addresses. The IP
address of a machine is usually read from its configuration file stored on a disk file. The machine can
get its physical address (by reading its NIC, for example), which is unique locally. It can then use the
physical address to get the logical address by using the RARP protocol. A RARP request is created
and broadcast on the local network. Another machine on the local network that knows all the IP
addresses will respond with a RARP reply.
Because of the service provided by ARP and RARP, all protocols above them in the OSI model are
able to use IP addresses only when referring to network devices.
Data Communication and Computer Networks
5.3.5 ICMP
As discussed earlier, the IP protocol provides unreliable and connectionless datagram delivery. It has
no error-reporting or error-correcting mechanism. What happens if something goes wrong? What
happens if a router must discard a datagram because it cannot find a router to the final destination, or
because the time-to-live field has a zero value? What happens if the final destination host must discard
all fragments of a datagram because it has not received all fragments within a predetermined time
limit? These are examples of situations where an error has occurred and the IP protocol has no built-
in mechanism to notify the original host. The IP protocol also lacks a mechanism for host and
managementq ueries. A host sometimes needs to determine if a router or another host is alive. And
sometimes a net-work administrator needs information from another host or router.
ICMP stands for Internet Message Control Protocol and has been designed to compensate for the
above two deficiencies. It is a companion to the IP protoco1. ICMP is used to transmit status and error
messages between network stations. For example, whenever you type a URL into Internet Explorer
and you get the message “Page cannot be displayed”, it is an ICMP packet that is responsible.
Types of Messages:- ICMP messages are divided into two broad categories: error-reporting messages
and query messages. The error-reporting messages report problems that a router or a host
(destination) may encounter when it processes an IP packet. The query messages, which occur in
pairs, help a host or a network manager get specific information from a router or another host. For
example, nodes can discover their neighbors. Also, hosts can discover and learn about routers on their
network, and routers can help a node redirect its messages.
Message Format:- An ICMP message has an 8-byte header and a variable-size data section. Although
the general format of the header is different for each message type, the first 4 bytes are common to
all. As shown on below Figure, the first field, ICMP type, defines the type of the message. The code
field specifies the reason for the particular message type. The last common field is the checksum field.
The rest of the header is specific for each message type. The data section in error messages carries
information for finding the original packet that had the error. In query messages, the data section
carries extra information based on the type of the query.
Data Communication and Computer Networks
One of the main responsibilities of ICMP is to report errors. Although technology has produced
increasingly reliable transmission media, errors still exist and must be handled. Error checking and
error control are not a concern of IP and ICMP was designed, in part, to compensate for this
shortcoming. However, ICMP does not correct errors, it simply reports them. Error correction is left
to the higher-level protocols. Error messages are always sent to the original source because the only
information available in the datagram about the route is the source and destination IP addresses. ICMP
uses the source IP address to send the error message to the source (originator) of the datagram. ICMP
handle five types of error (such as destination unreachable, source quench, time exceeded, parameter
problems, and redirection) and always reports error messages to the original source.
5.3.6 IGMP
The Internet Group Management Protocol (IGMP) is one of the necessary, but not sufficient, protocols
that is involved in multicasting. IGMP is a companion to the IP protocol. IGMP is not a multicasting
routing protocol; it is a protocol that manages group membership.
In any network, there are one or more multicast routers that distribute multicast packets to hosts or
other routers. The IGMP protocol gives the multicast routers information about the membership status
of hosts (routers) connected to the network. A multicast router may receive thousands of multicast
packets every day for different groups. If a router has no knowledge about the membership status of
the hosts, it must broad cast all these packets. This creates a lot of traffic and consumes bandwidth.
By default two different IP networks cannot communicate with each other. They need a mediator
device that can switch packet between them. Router takes this responsibility and used for routing.
Routers interfaces are associated with different networks. This association is kept in routing table.
Routers use it to take switching decision.
Every packet has two address; source and destination. Router uses destination address to deliver the
packet. The delivery of a packet to its final destination is accomplished by using two different methods
of delivery, direct and indirect.
Direct Delivery:- In a direct delivery, the final destination of the packet is a host connected to the
same physical network as the deliverer. Direct delivery occurs when the source and destination of the
packet are located on the same physical network or when the delivery is between the last router and
the destination host. The sender can easily determine if the delivery is direct. It can extract the network
address of the destination (using the mask) and compare this address with the addresses of the
networks to which it is connected. If a match is found, the delivery is direct.
Indirect Delivery:- If the destination host is not on the same network as the deliverer, the packet is
delivered indirectly. In an indirect delivery, the packet goes from router to router until it reaches the
one connected to the same physical network as its final destination. Note that a delivery always
involves one direct delivery but zero or more indirect deliveries. Note also that the last delivery is
always a direct delivery.
Data Communication and Computer Networks
Forwarding means to place the packet in its route to its destination. It requires a host or a router to
have a routing table. When a host has a packet to send or when a router has received a packet to be
forwarded, it looks at this table to find the route to the final destination. Several techniques can make
the size of the routing table manageable and also handle issues such as security
Next-Hop Method Vs. Route Method
In the next-hop technique, the routing table holds only the address of the next hop instead of
information about the complete route (route method). The entries of a routing table must be consistent
with one another.
Routing Table
A host/router has routing table with an entry for each destination, or combination of destinations, to
route IP packets. The routing table can be either static or dynamic.
Static routing table:- Contains information entered manually (i.e. routers learn from an
administrator). In static routing the Administrator enters the route for each destination and all network
locations manually into table. If any change occurs in network, administrator is responsible to update
it by hand in all routers i.e. When a table is created, it cannot update automatically when there is a
change in the Internet and the table must be manually altered by the administrator.
Can be used in small internet that doesn’t change very often, or in an experimental internet for
troubleshooting. It is poor strategy to use a static routing table in a big internet such as the Internet.
Advantage of static routing
It is easy to implement.
It is most secure way of routing, since no information is shared with other routers.
It puts no overhead on resources such as CPU or memory.
Disadvantage of static routing
It is suitable only for small network.
If a link fails static route cannot reroute the traffic.
Dynamic routing:- When routers learn from neighboring router through the routing protocols, it is
called dynamic routing. In dynamic routing routers add network locations automatically form the
routing information and updated periodically by using one of the dynamic routing protocols such as
RIP, OSPF, or BGP.
Data Communication and Computer Networks
Whenever there is a change in the Internet, such as a shutdown of a router or breaking of a link, the
dynamic routing protocols update all the tables in the routers (and eventually in the host)
automatically. The routers in a big internet such as the Internet need to be updated dynamically for
efficient delivery of the IP packets.
Advantage of dynamic routing
It is suitable for all type of networks.
Automatically build routing tables.
Reroute the traffic from possible network, in link failure condition.
Disadvantage of dynamic routing
It is hard to implement.
It is less secure, since it shares routing updates with other routers.
It puts additional overhead on resources such as CPU, memory and link bandwidth.
Depending on network requirement we can use either static routing or dynamic routing. Even more we
can use a combination of both dynamic and static routing.
Routing Table Format
A routing table for classless addressing has a minimum of four columns.
Routing Protocols
Routing protocols have been created in response to the demand for dynamic routing tables. A routing
protocol is a combination of rules and procedures that lets routers in the internet inform each other of
changes. It allows routers to share whatever they know about the internet or their neighborhood.
Routing protocols insure that packet takes the best path from these paths. To accomplish this task, a
router will need to perform following:
– Learn about the directly connected routers on its interface
– Find the networks that they have
– Build routing table from this information
– Choose best network from routing table to send the packet
Routing protocol uses routing Updates (mechanism of sharing information) to shares routing update
that contains network information with neighboring routers. Routers keep this information in routing
tables. In a particular time duration router advertise its routing information through broadcast or
multicast (Some protocols use broadcast for routing updates while some uses multicast). Different
protocols have different time intervals.
Routing updates contain all necessary information for routing protocol such as learned network,
timers, AS, AD, matrix values, interface details etc. The router keep the update in routing table.
Routing tables are used to determine the best path for packet. Routing protocols uses several concepts
to determine the best path.
Data Communication and Computer Networks
Types of Routing Protocols
Link State
Link state routing protocols use more composite metric to locate the best path for destination network.
It maintains three separate tables. First table keeps track of directly connected neighbors. Second table
determines the entire network topology. Third is the routing table that keeps actual path. The node
can use Dijkstra's algorithm to build a routing table. OSPF is the example of link state protocol. Link
state protocols share their own links to all other routers in network.
Hybrid
Hybrid routing protocols are the mix of distance vector and link state protocol. To locate more
accurate path, it uses aspect from both distance vector and link state. EIGRP is the example of hybrid
routing protocols.
Data Communication and Computer Networks
All three types of protocol have their own advantage and disadvantage. They take different approach
in sharing routing updates and in choosing the best path. Administrative distance and metric value are
the mostly used approaches.
Administrative Distance
Administrative distance (AD) is the trustworthiness of routing update received from a neighbor router.
If a router receives two routing updates for same path from two different routing protocols then router
will check the AD value to choose the best path. AD is a numeric value from 0 to 255. If one update
has lower AD value than other, then the route with the lowest AD will be placed in the routing table
Route source Default AD value
Direct connected interface 0
Static route 1
EIGRP 90
IGRP 100
OSPF 110
RIP 120
External EIGRP 170
Unknown 255
Lower AD value is more believable by router. 0 is considered as the most trustworthiness network
while 255 is considered as invalid route and it will be never used.
Metric value
If two routing updates for same network have same AD value then metric will use to choose the best
path. Metric is a measurement to calculate best path. Route with the lowest metric will be chosen.
Different routing protocols use different metrics. It may use single metric or multiple metrics. For
example EIGRP uses bandwidth, delay, load, MTU and reliability while RIP only uses hop count as
metric.
Routing Metric Description
Protocol
Routing Example: In following figure we have two PCs. Both are located in different network.
Assume that PC0 sends a packet to PC1. It will go through the following steps.
There are five main functions of transport layer you want to remember always. These are:
Connection management
Segmentation
Service-point addressing
Error Control (Reliable and unreliable data delivery)
Flow control
Connection multiplexing
Connectionless Transmission
In a connectionless service, the packets are sent from one party to another with no need for connection
establishment or connection release.
Connection less service is modeled after the postal system. Each letter carries the destination address
and is routed independent of all the others. Here, it is possible that the letter sent first is delayed so
that the second letter reaches the destination before the first letter.
Similarly, in connectionless transmission each packet of an application is treated as an independent
entity. On each packet of the application the destination address is provided and packet is routed.
In this type of transmission the receiver does not acknowledge receipt of a packet. Sending device
assumes that packet arrive just fine. This approach allows for much faster communication between
devices. The trade-off is that connectionless transmission is less reliable than connection oriented.
TCP Services
Process-to-Process Communication
Full-Duplex Communication
Connection-Oriented Service
Reliable Service
• Large amounts of data sent as one large unit tie up the network and make timely interaction
and communications impossible because one computer is flooding the cable with data.
• The impact of retransmitting large units of data further multiplies network traffic.
These effects are minimized when the large data units are reformatted into smaller packages. This
way, only a small section of data is affected, and, therefore, only a small amount of data must be
retransmitted, making it relatively easy to recover from the error. These packages are commonly
called packets or frames, and are the basic building blocks of network data communications.
The process of breaking large data file into smaller files that can be accommodated by network is
called Segmentation. To understand this process thinks about a 700 MB movie that you want to
download from internet. You have 2MBPS internet connection. How will you download a 700MB
movie on 2MBPS internet connection?
In this case segmentation process is used. On server transport layer breaks 700MB movie in smaller
size of segments (less than your internet connection speed). Assume that 700Mb movie is divided in
700 segments. Each segment has file size of 1Mbthat your PC can easily download at current
connection speed. Now your PC will download 700 small files instead of one large file. So next time
when you see download progress bar in browser, think it about segment receiver progress bar. Once
Data Communication and Computer Networks
your browser receives all segments from server, it will pop up a message indicating download is
completed. Transport layer at your PC will merge all segments back in a single 700Mb movie file.
End user will never know how 700Mb movie makes its way through 2Mbps connection line.
The transport layer accepts a message from the (session) layer above it, splits the message into smaller
units (if not already small enough), and passes the smaller units down to the network layer.
The transport layer at the destination station reassembles the message.
0–1023 Well-Known
Assigned and controlled by IANA
For common TCP/IP functions and applications
Data Communication and Computer Networks
49152–65535 Dynamic/Private
Neither controlled nor registered
For dynamic connections
Ephemeral ports (temporary ports).
The client program defines itself with a port number, chosen randomly by the transport layer software
running on the client host. This is the ephemeral (temporal) port number.
The server process must also define itself with a port number. This port number, however, cannot be
chosen randomly. If the computer at the server site runs a server process and assigns a random number
as the port number, the process at the client site that wants to access that server and use its services
will not know the port number. Of course, one solution would be to send a special packet and request
the port number of a specific server, but this requires more overhead. The Internet has decided to use
universal port numbers for servers which is called well-known port numbers. Example of well known
port numbers: 21 for FTP, 23 telnet, 25 SMTP, 80 HTTP, etc
There are some exceptions to this rule; for example, there are clients that are assigned well-known
port numbers. Every client process knows the well-known port number of the corresponding server
process.
Data Communication and Computer Networks
Socket Addresses
Process-to-process delivery needs two identifiers, IP address and the port number, at each end to make
a connection. The combination of an IP address and a port number is called a socket address. The
client socket address defines the client process uniquely just as the server socket address defines the
server process uniquely. A transport layer protocol needs a pair of socket addresses: the client socket
address and the server socket address. These four pieces of information are part of the IP header and
the transport layer protocol header. The IP header contains the IP addresses; the UDP or TCP header
contains the port numbers.
Data Communication and Computer Networks
Reliability means guaranteed data delivery. To insure delivery of each single segment, connection
oriented method is used. In this approach before sending any segments three way handshake process
is done.
Like Data link layer, Transport layer also performs error control. Here error control is performed end-
to-end rather than across a single link. The sending transport layer ensures that the entire message
arrives at the receiving transport layer without error (damage, loss or duplication). Error correction is
achieved through retransmission. In general the transport layer provides reliable endto-end message
delivery with acknowledgments.
In Ready / not ready signals method, sender sends data according to its buffer size. Receiver receives
data in its buffer. When receivers buffer get filled, it send a not ready signal to sender, so sender can
stop transmitting more segments. Receivers send ready signal when it becomes ready to receive next
segments. This method has two problems. First, the receiver may respond to the sender with a not
ready signal only when its buffer fills up. While this message is on its way to the sender, the sender
is still sending segments to the receiver, which the receiver will have to drop because its buffer space
is full. The second problem with the uses of this method is that once the receiver is ready to receive
more segments, it must first send a ready signal to the sender, which must be received before sender
can send more segments.
Windowing
In windowing a window size is defined between sender and receiver. Sender host will wait for an
acknowledgement signal after sending the segments equal to the window size. If any packet lost in
the way, receiver will respond with acknowledgement for lost packet. Sender will send lost packet
again. Window size is automatically set during the three step handshake process. It can be adjust
anytime throughout the lifetime of connection.
Data Communication and Computer Networks
Reading Assignment
o Congestion Control and Quality services
Note: The known protocols that work on the session layer includes NetBIOS, Mail Slots, Names Pipes,
and RPC.
Data Communication and Computer Networks
5.6 The Presentation Layer
Presentation Layer is also called Translation layer. The objective of this layer is to presents the data
into a uniform format and masks the difference of data format between two dissimilar systems. The
presentation has the following main functions
Translation
Before being transmitted, information in the form of characters and numbers should be changed to bit
streams. The presentation layer is responsible for interoperability between encoding methods as
different computers use different encoding methods, for example, ASCII to EBCDIC.
It can be viewed as the translator for the network. This layer may translate data from a format used
by the application layer into a common format at the sending station, and then translate the common
format to a format known to the application layer at the receiving station. It takes data from application
layer and marks it with formatting code such as .doc, .jpg, .txt, .avi etc. These file extensions make it
easy to realize that particular file is formatted with particular type of application.
Compression and encryption
With formatting presentation layer also deals with compression and encapsulation. It carries out data
compression (on sending computer) to reduce the bandwidth of the data to be transmitted and
decompresses (on receiving computer) the data file. The primary role of Data compression is to reduce
the number of bits to be transmitted. It is important in transmitting multimedia such as audio, video,
text etc.
This layer can also encapsulate the data (carries out encryption at the transmitter and decryption at the
receiver), but it’s uncommon as this can be done by lower layers more effectively.
Data conversion: bit order, CR-CR/LF, integer-floating point, and so on.
Data Communication and Computer Networks
5.7 The Application Layer
Application layer provides platform to send and receive data over the network. This layer serves as
the window for users and application processes to access network services. The application layer
makes the interface between the program that is sending or is receiving data and the protocol stack.
When you download or send emails, your e-mail program contacts this layer.
This layer provides network services to the end-users like Mail, ftp, telnet, DNS. All applications and
utilities that communicate with network fall in this layer. For examples, Browsers (like Mozilla
Firefox, Internet Explorer, Google Chrome etc), Email clients (such as Outlook Express, Mozilla
Thunderbird etc.), FTP clients (like Filezilla, sFTP, vsFTP).
Protocols used at application layer are FTP, DHCP, DNS, NFS, HTTP, POP3, SNMP, SMTP, FINGER,
TFTP, NTP and TELNET.
5.7.7 Telnet
The TELNET is an abbreviation for TErminaL NETwork. It is the standard TCP/IP protocol for
virtual terminal service as proposed by the International Organization for Standards(ISO).
TELNET protocol is used for providing remote terminal access over a network by enabling the
establishment of a connection to a remote system in such a way that the local terminal appears to be
a terminal at the remote system. For example, using TELNET a user can log in to another computer
somewhere else on the network and take part in an interactive session on that computer. TELNET
also uses TCP as its underlying basis for communications.
Data Communication and Computer Networks
TELNET was designed at a time when most operating systems, such as UNIX, were operating in a
timesharing environment. In such an environment, a large computer supports multiple users. The
interaction between a user and the computer occurs through a terminal, which is usually a combination
of keyboard, monitor, and mouse. Even a micro computer can simulate a terminal with a terminal
emulator
Application Provides network access for applications, Gateway NCP, DHCP, DNS,
flow control and error recovery SMTP, FTP, SNMP,
Telnet, Appletalk
Presentation Performs protocol conversion, encryption Gateway and NCP, AFP, TDI
and data compression redirectors
Network Handles addressing, translates logical Router and IP, IPX, NWLink,
addresses and names to physical brouter NetBEUI, NAT, ARP,
addresses, routing and traffic RARP, ICMP, IGMP.
management.
**Data Packages raw bits into frames and Switch, bridge Ethernet, Token Ring,
Link includes a Cyclical Redundancy Check and brouter FDDI, X.25, Token bus,
(CRC) AppleTalk
• NDIS (Network Driver Interface Specification):- used by Microsoft based Network Operating
Systems, such as Microsoft LAN Manager, Windows NT, Windows for Work Groups and IBM's
OS/2.
• ODI (Open Datalink Interface):- ODI drivers are used by Novell's NetWare Network Operating
System and Apple.
Note: The binding Process allows more than one protocol to function on a single network adapter
card. Binding order dictates which protocol the operating systems uses first.