Unit 4
Unit 4
19.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Contents
Switching, Logical addressing – IPV4 addressing,
subnet mask, classless Inter-domain routing (CIDR)
IPV6
Address mapping – ARP, RARP
BOOTP and DHCP–Delivery, Forwarding, and
Unicast Routing
Protocols—shortest path algorithm, flooding,
distance vector routing
Algorithm, Bellman-ford algorithm, Dijkstra’s
algorithm, link state routing, RIP, Open shortest
path first protocol (OSPF).
19.2
Switching
Switching techniques in computer networks
to connect devices and allow them to
communicate with each other.
Additionally, we can utilize switching techniques to
transfer data from one device to another.
Switching allows multiple devices to share the
same communication channel simultaneously.
As a result, it improves the efficiency of the
network. Furthermore, switching also enables the
network to route data to its intended destination.
Additionally, it provides a mechanism for
error checking and correction
19.3
Switching
Switching techniques in computer networks
to connect devices and allow them to
communicate with each other.
Additionally, we can utilize switching techniques to
transfer data from one device to another.
Switching allows multiple devices to share the
same communication channel simultaneously.
As a result, it improves the efficiency of the
network. Furthermore, switching also enables the
network to route data to its intended destination.
Additionally, it provides a mechanism for
error checking and correction
19.4
Circuit Switching
We mainly use circuit switching in traditional telephone
networks.
When two devices want to communicate in a
circuit-switched network, they establish a
connection by setting up a dedicated path
between them.
This path is reserved exclusively for the duration of the
communication. Hence, no other devices can use it
during that specific time.
Once we establish the connection, we can transfer data
between devices over the dedicated path.
This path typically comprises a series of interconnected
switches or nodes that route the data to its destination.
19.5
Circuit Switching
19.6
Circuit Switching
Circuit switching isn’t commonly used in
computer networks, as it isn’t very efficient for
data transmission.
We reserve the dedicated path for the entire
duration of the communication.
Therefore, we waste a significant amount of
bandwidth during those times.
Additionally, circuit switching is not well-suited for
networks with high traffic volumes.
19.7
Advantages
Circuit switching provides a dedicated
communication path between two devices for the
duration of the communication. Hence, we
reserve the bandwidth for the entire
conversation. This results in guaranteed
bandwidth, which can be important for
applications that require a constant data rate.
As we reserve the dedicated communication for
the entire conversation, there’s no packet loss.
Finally, circuit switching provides predictable
performance.
19.8
Disadvantages
Circuit switching requires the dedicated communication
path to be reserved for the entire duration of the
communication.
This results in an inefficient use of bandwidth, as the
dedicated path isn’t being utilized during these times.
Circuit switching isn’t well-suited for networks with high
traffic volumes. This limits the scalability of circuit
switching in large networks.
Finally, it requires dedicated resources, such as switches
or nodes, to establish the dedicated communication path.
This can result in high costs for establishing and
maintaining circuit-switched networks
19.9
Packet Switching
Packet switching is a method used to transmit data over a
network.
We divide data into small packets and transmit them
over the network independently.
Each packet contains the data and destination address
information required to route the packet to its destination.
In packet switching, each packet travels separately through
the network and can take different paths to reach its
destination.
This approach allows for more efficient use of network
resources because we can transmit multiple packets
simultaneously over the same network.
19.10
Packet Switching
19.11
Packet Switching
Packet switching is the basis for the Internet,
which uses the
Transmission Control Protocol/Internet Protocol (T
CP/IP)
suite of protocols for communication between
devices.
In this system, we transmit packets between
devices, and routers along the way use the
destination address information in each packet to
route it to the next hop until it reaches its
destination.
19.12
Packet Switching-Advantages
19.13
Packet Switching-Advantages
19.14
Packet Switching-Advantages
19.15
Packet Switching-Disadvantages
The process of breaking data into packets and
adding header information to each packet can
introduce additional overhead and latency into
the transmission process. This can increase the
time required for packets to reach their destination.
Additionally, it can reduce the overall speed of data
transmission.
It can be vulnerable to security threats such as
packet sniffing. This can compromise the privacy and
security of data transmitted over the network.
Furthermore, it can be complex to set up and manage,
particularly in larger or more complex networks.
.
19.16
Datagram Packet Switching
Datagram packet-switching is a packet switching
technology by which each packet, now called a
datagram, is treated as a separate entity.
Each packet is routed independently through the
network.
Therefore packets contain a header with the full
information about the destination.
The intermediate nodes examine the header of a
packet and select an appropriate link to another node
which is nearer to the destination.
In this system, the packets do not follow a pre-
established route, and the intermediate nodes do not
require prior knowledge of the routes that will be used.
19.17
Datagram Packet Switching
The individual packets which form a data stream may
follow different paths between the source and the
destination. As a result, the packets may arrive at the
destination out of order.
When this occurs, the packets will have to be
reassembled to form the original message.
Because each packet is switched independently, there is
no need for connection setup and no need to dedicate
bandwidth in the form of a circuit.
Datagram packet switches use a variety of techniques
to forward traffic; they are differentiated by how long it
takes the packet to pass through the switch and their
ability to filter out corrupted packets.
19.18
Virtual Circuit Switching
Virtual circuit switching is a packet switching methodology whereby
a path is established between the source and the final destination
through which all the packets will be routed during a call.
This path is called a virtual circuit because to the user, the
connection appears to be a dedicated physical circuit.
However, other communications may also be sharing the parts of
the same path.
Before the data transfer begins, the source and destination identify
a suitable path for the virtual circuit.
All intermediate nodes between the two points put an entry of the
routing in their routing table for the call.
Additional parameters, such as the maximum packet size, are also
exchanged between the source and the destination during call
setup.
The virtual circuit is cleared after the data transfer is completed.
19.19
Virtual Circuit Switching
Virtual circuit packet switching is connection orientated.
This is in contrast to datagram switching, which is a
connection less packet switching methodology.
Advantages of virtual circuit switching are:
Packets are delivered in order,since they all take the
same route;
The overhead in the packets is smaller,
since there is no need for each packet to contain the full
address;
The connection is more reliable,network resources are
allocated at call setup so that even during times of
congestion, provided that a call has been setup, the
subsequent packets should get through;
19.20
Disadvantages
The switching equipment needs to be more
powerful,since each switch needs to store details
of all the calls that are passing through it and to
allocate capacity for any traffic that each call
could generate;
Resilience to the loss of a trunk is more
difficult,since if there is a failure all the calls must
be dynamically reestablished over a different
route.
19.21
Message Switching
Message switching is a method of data transmission that was
popular in the early days of networking, before the development
of packet switching. In message switching, we divide a
message into fixed-length blocks or frames.
Furthermore, we transmit each frame independently through the
network. Additionally, each intermediate node stores the frames
until the entire message is received. Finally, the nodes forward the
entire message to its destination.
Unlike packet switching, message switching is a store-and-forward
method of data transmission.
It means that each intermediate node stores the entire message
until it can be forwarded to the next node.
This can result in longer transmission times compared to packet
switching. We can only transmit each message when an
intermediate node receives all the parts of the message.
19.22
Message Switching
19.23
Advantages
While message switching is an older method of data transmission
that has largely been replaced by packet switching, it does offer
some advantages.
Message switching is a highly reliable method of data
transmission. Each intermediate node stores the entire message
until it can be forwarded to the next node. This reduces the risk of
data loss or corruption, as we store each message at intermediate
nodes before forwarding them.
It’s a simple method of data transmission that doesn’t require
complex routing algorithms or network management techniques.
This makes it easy to implement and manage, particularly in small
or low-bandwidth networks.
Message switching has a lower overhead compared to
other methods of data transmission. This means that more
bandwidth is available for data transmission.
19.24
Dis-advantages
Message switching has a higher latency compared to
other methods, such as packet switching. Additionally,
it can be inefficient in terms of network resource utilization
because each intermediate node must store the entire
message until it can be forwarded.
Finally, it requires more network resources for each
message. This means that message-switching networks
may be unable to support large numbers of devices or high-
bandwidth applications.
19.25
19.26
IPv4 ADDRESSES
19.27
Note
19.28
Note
19.29
Note
19.30
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4 address
19.31
Example 19.1
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
19.32
Example 19.2
Solution
We replace each decimal number with its binary
equivalent
19.33
Note
19.34
Figure 19.2 Finding the classes in binary and dotted-decimal notation
19.35
Example 19.4
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
19.36
Note
19.38
Table 19.2 Default masks for classful addressing
19.39
Note
19.40
Note
19.41
Note
19.42
Example 19.6
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.
This is actually the block shown in Figure 19.3.
19.43
Note
19.44
Example 19.7
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
This is actually the block shown in Figure 19.3.
19.45
Note
19.46
Example 19.8
Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
19.47
Example 19.9
Another way to find the first address, the last address, and
the number of addresses is to represent the mask as a 32-
bit binary (or 8-digit hexadecimal) number. This is
particularly useful when we are writing a program to find
these pieces of information. In Example 19.5 the /28 can
be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.
19.48
Example 19.9 (continued)
Solution
a. The first address can be found by 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.
19.49
Example 19.9 (continued)
19.50
Figure 19.4 A network configuration for the block 205.16.37.32/28
19.51
Note
19.52
Figure 19.6 IP Address Format
19.53
Note
19.54
Figure 19.7 Configuration and addresses in a subnetted network
19.55
Figure 19.8 Three-level hierarchy in an IPv4 address
19.56
IPv4 Header - Review
Total Length (16 bits)
Indicates the total length of the IPv4 packet (IPv4 header + IPv4
payload) and does not include link layer framing.
Identification (16 bits)
Identifies this specific IPv4 packet.
The Identification field is selected by the originating source of the
IPv4 packet. If the IPv4 packet is fragmented, all of the fragments
retain the Identification field value so that the destination node
can group the fragments for reassembly.
Flags (3 bits)
Identifies flags for the fragmentation process.
There are two flags—one to indicate whether the IPv4 packet
might be fragmented and another to indicate whether more
fragments follow the current fragment.
Fragment Offset (13 bits)
Indicates the position of the fragment relative to the original IPv4
payload.
IPv4 Header - Review
Time to Live ( 8 bits)
Indicate the maximum number of links on which an IPv4 packet
can travel before being discarded.
Originally used as a time count with which an IPv4 router
determined the length of time required (in seconds) to forward the
IPv4 packet, decrementing the TTL accordingly. When the TTL
equals 0,an ICMP Time Expired-TTL Expired in Transit message is
sent to the source IPv4 address and the packet is discarded.
Protocol (8 bits)
Identifies the upper layer protocol.
For example, TCP uses a Protocol of 6, UDP uses a Protocol of 17,
and ICMP uses a Protocol of 1.
The Protocol field is used to demultiplex an IPv4 packet to the
upper layer protocol.
58
IPv4 Packet Format
IPv4 Header - Review
Header Checksum (16 Bits)
Provides a checksum on the IPv4 header only.
The IPv4 payload is not included in the checksum calculation as
the IPv4 payload and usually contains its own checksum..
Source Address ( 32 bits)
Stores the IPv4 address of the originating host.
Destination Address (32 bits)
Stores the IPv4 address of the destination host.
Options (multiple of 32 bits)
Stores one or more IPv4 options.
59
IPv4 vs IPv6 Header
1. Version (4 bits)
4 bits are used to indicate the version of IP and is set to
6
62
IPv6 Header Fields
7. Source IPv6 Address (128 bits)
• Stores the IPv6 address of the originating host.
8. Destination IPv6 Address (128 bits)
Stores the IPv6 address of the current destination
host.
63
DHCP
BOOTP is not a dynamic configuration protocol.
When a client requests its IP address, the BOOTP
server consults a table that matches the physical
address of the client with its IP address.
This implies that the binding between the physical
address and the IP address of the client already
exists.
19.64
DHCP
What if a host moves from one physical network to
another?
What if a host wants a temporary IP address?
BOOTP cannot handle these situations because the
binding between the physical and IP addresses is
static and fixed in a table until changed by the
administrator.
BOOTP is a static configuration protocol.
The Dynamic Host Configuration Protocol (DHCP)
has been devised to provide static and dynamic
address allocation that can be manual or
automatic.
19.65
DHCP
Static Address Allocation:
In this capacity DHCP acts as BOOTP
does.
A DHCP server has a database that
statically binds physical addresses to
IP addresses.
19.66
DHCP
Dynamic Address Allocation DHCP has a second database with
a pool of available IP addresses.
This second database makes DHCP dynamic.
When a DHCP client requests a temporary IP address, the DHCP
server goes to the pool of available (unused) IP addresses and
assigns an IP address for a negotiable period of time.
When a DHCP client sends a request to a DHCP server, the
server first checks its static database. If an entry with the
requested physical address exists in the static database, the
permanent IP address of the client is returned.
On the other hand, if the entry does not exist in the static
database, the server selects an IP address from the available
pool, assigns the address to the client, and adds the entry to
the dynamic database.
19.67
DHCP
The dynamic aspect of DHCP is needed when a host moves
from network to network or is connected and disconnected
from a network (as is a subscriber to a service provider).
DHCP provides temporary IP addresses for a limited time.
The addresses assigned from the pool are temporary
addresses.
The DHCP server issues a lease for a specific time.
When the lease expires, the client must either stop using
the IP address or renew the lease.
The server has the option to agree or disagree with the
renewal. If the server disagrees, the client stops using the
address
19.68
Routing Table
A host or a router has a routing table with an
entry for each destination, or a combination of
destinations, to route IP packets.
The routing table can be either static or dynamic.
Static Routing Table
A static routing table contains information entered
manually. The administrator enters the route for each
destination into the table.
When a table is created, it cannot update automatically
when there is a change in the Internet.
The table must be manually altered by the administrator.
A static routing table can be used in a small internet that
does not 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.
19.69
Routing Table
Dynamic Routing Table
A dynamic routing table is updated periodically by using
one of the dynamic routing protocols such as RIP, OSPF,
or BGP.
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
19.70
Format
A routing table for classless addressing has a minimum of four
columns.
However, some of today's routers have even more columns.
We should be aware that the number of columns is vendor-
dependent, and not all columns can be found in all routers.
Common Fields
Mask: This field defines the mask applied for the entry.
Network address. This field defines the network address to which the
packet is finally delivered.
Next-hop address. This field defines the address of the next-hop
router to which the packet is delivered.
19.71
Format
Interface. This field shows the name of the interface.
Flags. This field defines up to five flags. Flags are on/off switches that
signify either presence or absence. The five flags are U (up), G
(gateway), H (host-specific), D (added by redirection), and M (modified
by redirection).
U (up). The U flag indicates the router is up and running. If this flag is not present, it
means that the router is down. The packet cannot be forwarded and is discarded.
G (gateway). The G flag means that the destination is in another network. The packet
is delivered to the next-hop router for delivery (indirect delivery). When this flag is
missing, it means the destination is in this network (direct delivery).
H (host-specific). The H flag indicates that the entry in the network address field is a
host-specific address. When it is missing, it means that the address is only the network
address of the destination.
D (added by redirection). The D flag indicates that routing information for this
destination has been added to the host routing table by a redirection message from
ICMP.
M (modified by redirection). The M flag indicates that the routing information for
this destination has been modified by a redirection message from ICMP.
19.72
Format
Reference count. This field gives the number of users of this route
at the moment. For example, if five people at the same time are
connecting to the same host from this router, the value of this
column is 5.
Use. This field shows the number of packets transmitted through
this router for the corresponding destination
19.73
Routing Protocols
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
19.74
Optimization
A router receives a packet from a network and
passes it to another network.
A router is usually attached to several networks.
When it receives a packet, to which network
should it pass the packet?
The decision is based on optimization: Which of
the available pathways is the optimum pathway?
What is the definition of the term optimum?
One approach is to assign a cost for passing
through a network.
19.75
Optimization
We call this cost a metric.
However, the metric assigned to each network
depends on the type of protocol.
Some simple protocols, such as the Routing
Information Protocol (RIP), treat all networks as
equals.
The cost of passing through a network is the
same; it is one hop count.
So if a packet passes through 10 networks to
reach the destination, the total cost is 10 hop
counts.
19.76
Optimization
Other protocols, such as Open Shortest Path First (OSPF),
allow the administrator to assign a cost for passing
through a network based on the type of service required.
A route through a network can have different costs
(metrics).
For example, if maximum throughput is the desired type
of service, a satellite link has a lower metric than a fiber-
optic line.
On the other hand, if minimum delay is the desired type of
service, a fiber-optic line has a lower metric than a satellite
link.
Routers use routing tables to help decide the best route.
OSPF protocol allows each router to have several routing
tables based on the required type of service.
19.77
Routing Information
Protocol
The Routing Information Protocol (RIP) is an intradomain
(interior) routing protocol used inside an autonomous
system.
It is a very simple protocol based on distance vector
routing.
RIP implements distance vector routing directly with
some considerations:
In an autonomous system, we are dealing with routers and
networks (links), what was described as a node.
The destination in a routing table is a network, which means the
first column defines a network address
The metric used by RIP is very simple; the distance is defined as
the number of links (networks) that have to be used to reach the
destination. For this reason, the metric in RIP is called a hop count
19.78
Routing Information
Protocol
Infinity is defined as 16, which means that any route in
an autonomous system.
The next node column defines the address of the router
to which the packet is to be sent to reach its destination.
19.79
RIP Request Message
Format
19.80
RIP Request Message
Format
Command: This 8-bit field specifies the type of
message: request (1) or response (2).
Version: This 8-bit field defines the version. RIP version
1 or RIP Version 2
Family: This 16-bit field defines the family of the
protocol used. For TCP/IP the value is 2.
Network address: The address field defines the address
of the destination network. RIP has allocated 14 bytes
for this field to be applicable to any protocol. However,
IP currently uses only 4 bytes. The rest of the address
is filled with 0s.
Distance :This 32-bit field defines the hop count (cost)
from the advertising router to the destination network.
19.81
Requests and Responses:
RIP has two types of messages:
request and response
Request:
A request message is sent by a router that
has just come up or by a router that has
some time-out entries.
A request can ask about specific entries or
all entries
19.82
Request Message
19.83
Requests and Responses:
RIP has two types of messages:
request and response
Response:
A response can be either solicited or
unsolicited.
A solicited response is sent only in answer to
a request.
It contains information about the destination
specified in the corresponding request.
An unsolicited response, on the other hand, is
sent periodically, every 30 seconds or when
there is a change in the routing table.
The response is sometimes called an update
19.84 packet.
Different Types of Timers
RIP uses three timers to support its operation.
The periodic timer controls the sending of
messages, the expiration timer governs the
validity of a route, and the garbage collection
timer advertises the failure of a route.
RIP Timers
19.85
Periodic Timer
The periodic timer controls the advertising of
regular update messages.
Although the protocol specifies that this timer
must be set to 30 s, the working model uses a
random number between 25 and 35 s.
This is to prevent any possible synchronization
and therefore overload on an internet if routers
update simultaneously.
Each router has one periodic timer that is
randomly set to a number between 25 and 35.
It counts down; when zero is reached, the update
message is sent, and the timer is randomly set
once again
19.86
Expiration Timer
The expiration timer governs the validity of a route.
When a router receives update information for a
route, the expiration timer is set to 180 s for that
particular route.
Every time a new update for the route is received,
the timer is reset. In normal situations this occurs
every 30 s.
However, if there is a problem on an internet and
no update is received within the allotted 180 s, the
route is considered expired and the hop count of
the route is set to 16, which means the destination
is unreachable.
Every route has its own expiration timer.
19.87
Garbage Collection Timer
When the information about a route becomes
invalid, the router does not immediately purge that
route from its table.
Instead, it continues to advertise the route with a
metric value of 16.
At the same time, a timer called the garbage
collection timer is set to 120 s for that route.
When the count reaches zero, the route is purged
from the table.
This timer allows neighbors to become aware of
the invalidity of a route prior to purging.
19.88
14.1 INTRA- AND INTERDOMAIN
ROUTING
Routing inside an autonomous system is referred to as intradomain
routing. Routing between autonomous systems is referred to as
interdomain routing.
Initialization
Sharing
Updating
When to Share
Two-Node Loop Instability
Three-Node Instability
Solution
The 21 timers are listed below:
Periodic timer: 1
Expiration timer: 20 − 5 = 15
Garbage collection timer: 5
Solution
This router has three links: two of type 1 (point-to-
point) and one of type 3 (stub network). Figure 14.32
shows the router link LSA.
See Figure 14.32
Solution.
Solution
All routers advertise router link LSAs.
a. R1 has two links, N1 and N2.
b. R2 has one link, N1.
c. R3 has two links, N2 and N3.
Solution
All three network must advertise network links:
a. Advertisement for N1 is done by R1 because it is the only
attached router and therefore the designated router.
b. Advertisement for N2 can be done by either R1, R2, or R3,
depending on which one is chosen as the designated router.
c. Advertisement for N3 is done by R3 because it is the only
attached router and therefore the designated router.
TCP/IP Protocol Suite 140
Figure 14.38 Summary link to network
Initialization
Sharing
Updating
19.165
Two – node instability
One example of count to infinity is
the two-node loop problem.
19.166
Remedies for Two-node Instability
19.167
Distance Vector Routing
In distance vector routing, a router need not
know the entire path to every network segment;
it only requires to know the direction or vector in
which to send the packet.
The technique determines the direction (vector)
and distance (hop count) to any network in the
internetwork.
Distance vector routing algorithms periodically
send all or parts of their routing table to their
adjacent neighbours.
19.168
Distance Vector Routing
The routers running a distance vector routing
protocol will automatically send periodic updates
even if there are no changes in the network.
A router can verify all the known routes and alters
its local routing table on the basis of the updated
information received from neighboring routing.
This process is referred to as “routing by rumour”
because the routing information that a router has of
the network topology is based on the perspective of
the routing table of the neighbor router.
RIP and IGRP is a commonly used distance vector
protocol that uses hop counts or its routing metrics.
19.169
Link State Routing
In link-state routing, each router attempt to
construct its own internal map of the network
topology.
At the initial stage of start-up, when a router
becomes active, it sends the messages into the
network and collects the information from the
routers to which it is directly connected.
It also provides information about whether the link
to reach the router is active or not.
This information is used by other routers to build a
map of network topology. Then the router uses the
map to choose the best path.
19.170
Link State Routing
The link state routing protocols respond swiftly to the
network changes.
It sends triggered updates when a network change
19.172
Key Differences Between Distance
Vector Routing and Link State
Routing
Link state routing updates only the link state while
Distance vector routing updates full routing table.
The frequency of update in both routing technique
is different distance vector update periodically
whereas link state update frequency employs
triggered updates.
The utilization of CPU and memory in distance
vector routing is lower than the link state routing.
The distance vector routing is simple to
implement and manage. In contrast, the link state
routing is complex and requires trained network
administrator.
19.173
Key Differences Between Distance Vector
Routing and Link State Routing
19.174