Professional Documents
Culture Documents
Computer Networks - UNIT III
Computer Networks - UNIT III
UNIT III
NETWORK LAYER
The role of the network layer is to connect devices like routers or switches that in turn connect the
LANs and WANs.
Network layer lies between the transport layer and the data link layer.
At the source host, the network layer accepts a packet from a transport layer, encapsulates the packet
in a datagram, and delivers the packet to the data-link layer.
At the destination host, the datagram is decapsulated, and the packet is extracted and delivered to the
corresponding transport layer.
Routing
The network layer is responsible for routing the packet from its source to the destination.
A physical network is a combination of networks (LANs and WANs) and routers
There is more than one route from the source to the destination.
The network layer is responsible for finding the best one among these possible routes.
The network layer needs to have some specific strategies for defining the best route and this is done
by the routing protocols.
Forwarding
Forwarding can be defined as the action applied by each router when a packet arrives at one of its
interfaces.
The decision-making table uses is also called the forwarding table or the routing table.
When a router receives a packet from one of its attached networks, it needs to forward the packet to
another attached network (in unicast routing) or to some attached networks (in multicast routing).
Other Services
Error Control
Flow Control
Congestion Control
Quality of Service
Security
Error Control
• The packet in the network layer may be fragmented at each router, which makes error checking at this
layer inefficient.
• The designers have added a checksum field to the datagram to control any corruption in the header,
but not in the whole datagram.
Flow Control
• Flow control regulates the amount of data a source can send without overwhelming the receiver.
• If the upper layer at the source computer produces data faster than the upper layer at the destination
computer can consume it, the receiver will be overwhelmed with data.
• To control the flow of data, the receiver needs to send some feedback to the sender to inform the
latter that it is overwhelmed with data.
Congestion Control
• Congestion in the network layer is a situation in which too many datagram are present in an area of
the Internet.
• Congestion may occur if the number of datagram sent by source computers is beyond the capacity of
the network or routers.
• In this situation, some routers may drop some of the datagram.
Quality of Service
• As the Internet has allowed new applications such as multimedia communication (in particular real-
time communication of audio and video), the quality of service (QoS) of the communication has
become more and more important.
• The Internet has thrived by providing better quality of service to support these applications.
Security
• Another issue related to communication at the network layer is security.
• Security was not a concern when the Internet was originally designed because it was used by a small
number of users at universities for research activities; other people had no access to the Internet.
• The network layer was designed with no security provision.
Delay
The delay defines how long a packet travels from its source to its destination,
The delays in a network can be divided into four types:
o Transmission delay
o Propagation delay
o Processing delay
o Queuing delay.
Transmission delay time between the first bit leaving the sender and the last bit arriving at the
receiver.
Delaytr = (Packet length) / (Transmission rate)
Propagation Delay the time it takes for a bit to travel from point A to point B in the transmission
media.
Delaypg = (Distance) / (Propagation speed)
Processing Delay the time required for a router or a destination host to receive a packet from its input
port, remove the header, perform an error detection procedure, and deliver the packet to the output port or
deliver the packet to the upper-layer protocol.
Delaypr = Time required to process a packet in a router or a destination host
Queuing Delay The queuing delay for a packet in a router is measured as the time a packet waits in the
input queue and output queue of a router.
Delayqu = The time a packet waits in input and output queues in a router
Throughput
Throughput at any point in a network is defined as the number of bits passing through the point in a second,
which is actually the transmission rate of data at that point.
Packet Loss
• When a router receives a packet while processing another packet, the received packet needs to be
stored in the input buffer waiting for its turn.
• A router, however, has an input buffer with a limited size.
• A time may come when the buffer is full and the next packet needs to be dropped.
• The effect of packet loss on the Internet network layer is that the packet needs to be resent, which in
turn may create overflow and cause more packet loss.
Congestion Control
• Congestion control is a mechanism for improving performance.
• Congestion control refers to techniques and mechanisms that can either prevent congestion before it
happens or remove congestion after it has happened.
Congestion control mechanisms are divided into two broad categories:
• Open-loop congestion control (prevention)
• Closed-loop congestion control (removal).
Discarding Policy
• A good discarding policy by the routers may prevent congestion and at the same time may not harm
the integrity of the transmission.
• For example, in audio transmission, if the policy is to discard less sensitive packets when congestion
is likely to happen, the quality of sound is still preserved and congestion is prevented or alleviated.
Admission Policy
• An admission policy, which is a quality-of-service mechanism can also prevent congestion in virtual-
circuit networks.
• Switches in a flow first check the resource requirement of a flow before admitting it to the network.
• A router can deny establishing a virtual-circuit connection if there is congestion in the network or if
there is a possibility of future congestion.
Choke packet
• A choke packet is a packet sent by a node to the source to inform it of congestion.
• In the choke-packet method, the warning is from the router, which has encountered congestion,
directly to the source station.
• The intermediate nodes through which the packet has traveled are not warned.
Implicit Signaling
• In implicit signaling, there is no communication between the congested node or nodes and the source.
• The source guesses that there is congestion somewhere in the network from other symptoms.
Explicit Signaling
• The node that experiences congestion can explicitly send a signal to the source or destination.
• The explicit-signaling method, however, is different from the choke-packet method.
Address Space
• An address space is the total number of addresses used by the protocol. IPv4 uses 32-bit addresses,
which means that the address space is 232 or 4,294,967,296 (more than four billion).
• More than 4 billion devices could be connected to the Internet.
Notation
• There are three common notations to show an IPv4 address:
– Binary notation (base 2) an IPv4 address is displayed as 32 bits. One or more spaces are usually
inserted between each octet (8 bits).
– Dotted-decimal notation (base 256) To make the address more compact and easier to read, it is
written in decimal form with a decimal point (dot) separating the bytes. Each number in the dotted-
decimal notation is between 0 and 255.
– Hexadecimal notation (base 16) Each hexadecimal digit is equivalent to four bits.
Hierarchy in Addressing
• A 32-bit IPv4 address is also hierarchical, but divided only into two parts.
• The first part of the address, called the prefix, defines the network;
• the second part of the address, called the suffix, defines the node (connection of a device to the
Internet).
Classful 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.
• 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.
• In class A, the network length is 8 bits, the first bit, which is 0, defines the class, we can have only
seven bits as the network identifier. This means there are only 2 7 = 128 networks in the world that can
have a class A address.
• In class B, the network length is 16 bits, the first two bits, which are (10)2, define the class, we can
have only 14 bits as the network identifier. There are only 214 = 16,384 networks in the world that can
have a class B address.
• All addresses that start with (110) 2 belong to class C. In class C, the network length is 24 bits, but
since three bits define the class, we can have only 21 bits as the network identifier. There are 221 =
2,097,152 networks in the world can have a class C address.
• Class D addresses were designed for multicasting. Each address in this class is used to define one
group of hosts on the Internet.
• Class E addresses were reserved for future use.
Address Depletion
• Since the addresses were not distributed properly, the Internet was faced with the problem of the
addresses being rapidly used up, resulting in no more addresses available for organizations and
individuals that needed to be connected to the Internet.
• Class A can be assigned to only 128 organizations in the world, but each organization needs to have a
single network with 16,777,216 nodes. Since there may be only a few organizations that are this
large, most of the addresses in this class were wasted (unused).
• Class B addresses was designed for midsize organizations, but many of the addresses in this class also
remained unused.
• Class C addresses have a completely different flaw in design. The number of addresses that can be
used in each network (256) was so small that most companies were not comfortable using a block in
this address class.
• Class E addresses were almost never used, wasting the whole class.
Subnetting and Supernetting
• To alleviate address depletion, two strategies were proposed and implemented:
• Subnetting
• Supernetting
• In subnetting, a class A or class B block is divided into several subnets. Subnetting was devised to divide a large
block into smaller ones in Class A & B, supernetting was devised to combine several class C blocks into a
larger block.
Advantage of Classful Addressing
• We can easily find the class of the address and, since the prefix length for each class is fixed.
Classless Addressing
• In 1996, the Internet authorities announced a new architecture called classless addressing.
• In classless addressing, variable-length blocks are that belong to no classes.
• We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and so on.
Address Aggregation
• One of the advantages of the CIDR strategy is address aggregation.
• When blocks of addresses are combined to create a larger block, routing can be done based on the
prefix of the larger block.
Special addresses
Five special addresses that are used for special purposes:
– this-host address 0.0.0.0/32. It is used whenever a host needs to send an IP datagram but it
does not know its own address to use as the source address.
– limited-broadcast address 255.255.255.255/32. It is used whenever a router or a host
needs to send a datagram to all devices in a network.
– loopback address 127.0.0.0/8. Any address in the block is used to test a piece of software
in the machine.
– private addresses Four blocks are assigned as private addresses:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
169.254.0.0/16
– multicast addresses The block 224.0.0.0/4 is reserved for multicast addresses.
DHCP Operation
1. The joining host creates a DHCPDISCOVER message in which only the transaction- ID field is set to
a random number. The user datagram is encapsulated in an IP datagram with the source address set to
0.0.0.0 (“this host”) and the destination address set to 255.255.255.255 (broadcast address).
2. The DHCP server or servers responds with a DHCPOFFER message in which the your address field
defines the offered IP address for the joining host and the server address field includes the IP address
of the server.
3. The joining host receives one or more offers and selects the best of them. The joining host then sends
a DHCPREQUEST message to the server that has given the best offer. The fields with known value
are set.
4. Finally, the selected server responds with a DHCPACK message to the client if the offered IP address
is valid. If the server cannot keep its offer, the server sends a DHCPNACK message and the client
needs to repeat the process.
Two Well-Known Ports
• DHCP uses two well-known ports (68 and 67) instead of one well-known and one ephemeral.
• The reason for choosing the well-known port 68 instead of an ephemeral port for the client is that the
response from the server to the client is broadcast.
Error Control
• To provide error control, DHCP uses two strategies.
1. DHCP requires that UDP use the checksum.
2. DHCP client uses timers and a retransmission policy if it does not receive the DHCP reply to
a request.
Transition States
• When the DHCP client first starts, it is in the INIT state (initializing state).
• The client broadcasts a discover message. When it receives an offer, the client goes to the
SELECTING state.
• After it selects an offer, it sends a request message and goes to the REQUESTING state.
o If an ACK arrives while the client is in this state, it goes to the BOUND state and uses the IP
address.
o When the lease is 50 percent expired, the client tries to renew it by moving to the
RENEWING state.
o If the server renews the lease, the client moves to the BOUND state again.
o If the lease is not renewed and the lease time is 75 percent expired, the client moves to the
REBINDING state.
• If the server agrees with the lease (ACK message arrives), the client moves to the BOUND state and
continues using the IP address; otherwise, the client moves to the INIT state and requests another IP
address.
• The client uses three timers: renewal timer (set to 50 percent of the lease time), rebinding timer (set to
75 percent of the lease time), and expiration timer (set to the lease time).
Address Translation
• All of the outgoing packets go through the NAT router, which replaces the source address in the
packet with the global NAT address.
• All incoming packets also pass through the NAT router, which replaces the destination address in
the packet (the NAT router global address) with the appropriate private address.
Translation Table
• Translating the source addresses for an outgoing packet is done by translation table.
• Some of the methods are:
– Using One IP Address
– Using a Pool of IP Addresses
– Using Both IP Addresses and Port Addresses
Using One IP Address
• A translation table has only two columns: the private address and the external address (destination
address of the packet).
• When the router translates the source address of the outgoing packet, it also makes note of the
destination address— where the packet is going.
Address Aggregation
• The increased size of the table results in an increase in the amount of time needed to search the table.
• To alleviate the problem, the idea of address aggregation was designed.
• Address aggregation combines the blocks of addresses for different organizations into one larger
block.
Hierarchical Routing
• To solve the problem of gigantic forwarding tables, we can create a sense of hierarchy in the
forwarding tables.
• Internet is divided into backbone and national ISPs.
• National ISPs are divided into regional ISPs, and regional ISPs are divided into local ISPs.
• If the forwarding table has a sense of hierarchy like the Internet architecture, the forwarding table can
decrease in size.
Geographical Routing
• To decrease the size of the forwarding table even further, we need to extend hierarchical routing to
include geographical routing.
• We divide the entire address space into a few large blocks.
• We assign a block to America, a block to Europe, a block to Asia, a block to Africa, and so on.
• The routers of ISPs outside of Europe will have only one entry for packets to Europe in their
forwarding tables.
• The routers of ISPs outside of America will have only one entry for packets to America in their
forwarding tables, and so on.
• Label. This 20-bit field defines the label that is used to index the forwarding table in the router.
• Exp. This 3-bit field is reserved for experimental purposes.
• S. The one-bit stack field defines the situation of the subheader in the stack. When the bit is 1, it
means that the header is the last one in the stack.
• TTL. This 8-bit field is similar to the TTL field in the IP datagram. Each visited router decrements the
value of this field. When it reaches zero, the packet is discarded to prevent looping.
Hierarchical Switching
• A stack of labels in MPLS allows hierarchical switching. This is similar to conventional hierarchical
routing.
• For example, a packet with two labels can use the top label to forward the packet through switches
outside an organization;
• the bottom label can be used to route the packet inside the organization to reach the destination
subnet.
IPV4
Datagram Format
• Version Number The 4-bit version number (VER) field defines the version of the IPv4 protocol,
which has the value of 4.
• Header Length The 4-bit header length (HLEN) field defines the total length of the
• Service Type This field was referred to as type of service (TOS), which defined how the datagram
should be handled. IETF redefined the field to provide differentiated services (DiffServ).
• Total Length This 16-bit field defines the total length (header plus data) of the IP datagram in
bytes.
• Identification, Flags, and Fragmentation Offset These three fields are related to the fragmentation
of the IP datagram when the size of the datagram is larger than the underlying network can carry.
• Time-to-live The time-to-live (TTL) field is used to control the maximum number of hops
(routers) visited by the datagram. If this value, after being decremented, is zero, the router discards
the datagram.
• Protocol A datagram can carry a packet belonging to any transport-layer protocol such as UDP or
TCP.
• Header checksum Error checking of the payload on the protocol that owns the payload, such as
UDP or TCP.
• Source and Destination Addresses These 32-bit source and destination address fields define the IP
address of the source and destination respectively.
• Options A datagram header can have up to 40 bytes of options. Options can be used for network
testing and debugging.
• Payload Payload is the packet coming from other protocols that use the service of IP. Payload is
the content of the package.
Fragmentation
• A datagram can travel through different networks.
• Each router decapsulates the IP datagram from the frame it receives, processes it, and then
encapsulates it in another frame.
• The format and size of the received frame depend on the protocol used by the physical network
through which the frame has just traveled.
d. Continue the process. The last fragment has its M bit set to 0.
e. Continue the process. The last fragment has a more bit value of 0.
a. The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 =0.
b. The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8 = 175.
c. The third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8 =350.
Options
• The header of the IPv4 datagram is made of two parts:
• a fixed part
• a variable part.
• The fixed part is 20 bytes long and was discussed in the previous section.
• The variable part comprises the options that can be a maximum of 40 bytes (in multiples of 4-bytes)to
preserve the boundary of the header.
No Operation
• A no-operation option is a 1-byte option used as filler between options.
End of Option
• An end-of-option option is a 1-byte option used for padding at the end of the option field. It can only
be used as the last option.
Record Route
• A record route option is used to record the Internet routers that handle the datagram. It can list up to
nine router addresses. It can be used for debugging and management purposes.
Strict Source Route
• A strict source route option is used by the source to predetermine a route for the datagram as it travels
through the Internet.
• If a datagram specifies a strict source route, all the routers defined in the option must be visited by the
datagram.
• A router must not be visited if its IPv4 address is not listed in the datagram. If the datagram visits a
router that is not on the list, the datagram is discarded and an error message is issued.
Loose Source Route
• Each router in the list must be visited, but the datagram can visit other routers as well.
Timestamp
• A timestamp option is used to record the time of datagram processing by a router. The time is
expressed in milliseconds from midnight, Universal time or Greenwich Mean Time.
• We can estimate the time it takes for a datagram to go from one router to another.
• The IP provides unreliable and connectionless datagram delivery. The IP protocol is a best-effort
delivery service that delivers a datagram from its original source to its final destination.
• The IP protocol has two deficiencies
o Lack of error control
o Lack of assistance mechanisms for host and management queries.
• The Internet Control Message Protocol (ICMP) has been designed to compensate for the above two
deficiencies.
Types of Messages
Message Format
An ICMP message has an 8-byte header and a variable-size data section. The header is different for
each message type; the first 4 bytes are common to all.
Destination Unreachable
• When a router cannot route a datagram or a host cannot deliver a datagram, the datagram is discarded
and the router or the host sends a destination-unreachable message back to the source host that
initiated the datagram.
• Destination-unreachable messages are created by a router or the destination host.
Source Quench
IP does not have a flow control mechanism in the protocol because IP is connectionless.
The source-quench message in ICMP was designed to add a kind of flow control to the IP. When a
router or host discards a datagram due to congestion, it sends a source-quench message to the sender
of the datagram.
This message has two purposes.
First, it informs the source that the datagram has been discarded.
Second, it warns the source that there is congestion somewhere in the path and that the source
should slow down (quench) the sending process.
Time Exceeded
The time-exceeded message is generated in two cases:
1. Routers use routing tables to find the next hop (next router) that must receive the packet. If there
are errors in one or more routing tables, a packet can travel in a loop or a cycle, going from one
router to the next or visiting a series of routers endlessly.
When a datagram visits a router, the value of this field is decremented by 1. When the time-to-
live value reaches 0, after decrementing, the router discards the datagram.
When the datagram is discarded, a time-exceeded message must be sent by the router to the
original source.
2. A time-exceeded message is also generated when not all fragments that make up a message arrive
at the destination host within a certain time limit.
Parameter Problem
If a router or the destination host discovers an ambiguous or missing value in any field of the
datagram, it discards the datagram and sends a parameter-problem message back to the source.
Redirection
• The redirection message (type 5) is used when the source uses a wrong router to send out its message.
• The router redirects the message to the appropriate router, but informs the source that it needs to
change its default router in the future.
• The IP address of the default router is sent in the message.
Query Messages
• ICMP can diagnose some network problems. This is informed through the query messages.
• In this type of ICMP message, a node sends a message that is answered in a specific format by the
destination node.
Debugging Tools
• Two tools that use ICMP for debugging:
• Ping to find if a host is alive and responding.
• Traceroute The traceroute program also sets a timer to find the round-trip time for each
router and the destination.
ICMP Checksum
In ICMP the checksum is calculated over the entire message (header and data).
Example:
In the figure the checksum calculation for a simple echo-request message, We ramdomly chose the
identifier to be 1 and the sequence number to be 9. The message is divided into 16-bit (2-byte) words. The
words are added and the sum is complemented. Now the sender can put this value in the checksum field.
Least-Cost Routing
• When an internet is modeled as a weighted graph, one of the ways to interpret the best route from the
source router to the destination router is to find the least cost between the two.
• The best route between A and E is A-B-E, with the cost of 6.
Least-Cost Trees
• A better way to see all of these paths is to combine them in a least-cost tree.
• A least-cost tree is a tree with the source router as the root that spans the whole graph (visits all other
nodes) and in which the path between the root and any other node is the shortest
ROUTING ALGORITHMS
• Distance-Vector Routing
• Link-State Routing
• Path-Vector Routing
DISTANCE-VECTOR ROUTING
• In distance-vector routing, the first thing each node creates is its own least-cost tree with the basic
information it has about its immediate neighbors.
• The incomplete trees are exchanged between immediate neighbors to make the trees more and more
complete and to represent the whole internet.
• Steps:
– Initialization
– Sharing
– Updation
Bellman-Ford Equation
• The following shows the general case in which Dij is the shortest distance and cij is the cost between
nodes i and j.
Dxy = min{(cxa + Day), (cxb + Dby), (cxc + Dcy), …}
• In distance-vector routing, normally we want to update an existing least cost
Dxy = min{Dxy, (cxz + Dzy)}
Initialization
• At the beginning each node can know only the distance between itself and its immediate
neighbors, those directly connected to it.
• Figure shows the initial tables for each node. The distance for any entry that is not a neighbor is
marked as infinite (unreachable).
Sharing
• The whole idea of distance vector routing is the sharing of information between neighbors.
• Node ‘A’ does not know about node ‘E’, node ‘C’ does. So if node ‘C’ shares its routing table with
‘A’, node ‘A’ can also know how to reach node ‘E’.
• On the other side, node ‘C’ does not know how to reach node ‘D’, but node ‘A’ does. If node ‘A’
shares its routing table with node ‘C’, node ‘C’ also knows how to reach node ‘D’.
• There is only one problem.
o A node is not aware of a neighbor's table.
o The best solution for each node is to send its entire table to the neighbor and let the neighbor
decide what part to use and what part to discard.
o The third column of a table (next hop) is not useful for the neighbor. When the neighbor
receives a table, this column needs to be replaced with the sender's name.
• Sharing here means sharing only the first two columns.
When to Share
Periodic Update A node sends its routing table, normally every 30 seconds, in a periodic update.
The period depends on the protocol that is using distance vector routing.
Triggered Update A node sends its two-column routing table to its neighbors anytime there is a
change in its routing table. This is called a triggered update.
Distance_Vector_Routing ( )
{
// Initialize (create initial vectors for the node)
D[myself ] = 0
for (y = 1 to N)
{
if (y is a neighbor)
D[y] = c[myself ][y]
else
D[y] = ∞
}
send vector {D[1], D[2], …, D[N]} to all neighbors
// Update (improve the vector with the vector received from a neighbor)
repeat (forever)
{
wait (for a vector Dw from a neighbor w or any change in the link)
for (y = 1 to N)
{
D[y] = min [D[y], (c[myself ][w] + Dw[y ])] // Bellman-Ford equation
}
if (any change in the vector)
send vector {D[1], D[2], …, D[N]} to all neighbors
}
} // End of Distance Vector
Poison Reverse
• The split horizon strategy can be combined with the poison reverse strategy. Node B can still
advertise the value for X, but if the source of information is A, it can replace the distance with infinity
as a warning: "Do not use this value; what I know about this route comes from you”.
• The two-node instability can be avoided by using the split horizon strategy combined with poison
reverse.
2. Three-Node Instability
• Creation of LSDB.
• Creation of LSP and flooding
• Formation of least cost trees
• Calculation of a routing table based on the shortest path tree.
Creation of LSDB.
• The collection of states for all links is called the link-state database (LSDB).
• There is only one LSDB for the whole internet
Dijkstra’s Algorithm ( )
{
// Initialization
Tree = {root} // Tree is made only of the root
for (y = 1 to N) // N is the number of nodes
{
if (y is the root)
D[y] = 0 // D[y] is shortest distance from root to node y
else if (y is a neighbor)
D[y] = c[root][y] // c[x][y] is cost between nodes x and y in LSDB
else
D[y] = ∞
}
// Calculation
repeat
{
find a node w, with D[w] minimum among all nodes not in the Tree
Tree = Tree ∪ {w} // Add w to tree
// Update distances for all neighbors of w
for (every node x, which is a neighbor of w and not in the Tree)
{
D[x] = min{D[x], (D[w] + c[w][x])}
}
} until (all nodes included in the Tree)
} // End of Dijkstra
PATH-VECTOR ROUTING
• Path-vector routing is not based on least-cost routing.
• The best route is determined by the source using the policy it imposes on the route.
• In other words, the source can control the path.
Steps:
• Creation of Spanning trees
• Initialization of path vectors
• Updating path vectors
Creation of Spanning trees
• The spanning trees are made, gradually and asynchronously, by each node.
Path-Vector Algorithm
Path_Vector_Routing ( )
{
// Initialization
for (y = 1 to N)
{
if (y is myself)
Path[y] = myself
else if (y is a neighbor)
Path[y] = myself + neighbor node
else
Path[y] = empty
}
Send vector {Path[1], Path[2], …, Path[y]} to all neighbors
// Update
repeat (forever)
{
• The Routing Information Protocol (RIP) is one of the most widely used intradomain routing protocols
based on the distance-vector routing algorithm.
• RIP was started as part of the Xerox Network System (XNS)
Hop Count
• The number of hops means the number of networks (subnets) a packet needs to travel through from
the source router to the final destination host.
• In RIP, the maximum cost of a path can be 15
Forwarding Tables
• The routers in an autonomous system need to keep forwarding tables to forward packets to their
destination networks.
• A forwarding table in RIP is a three-column table
RIP Implementation
• RIP is implemented as a process that uses the service of UDP on the well-known port number 520.
• RIP has gone through two versions:
– RIP-1
– RIP-2.
RIP Messages
RIP Algorithm
• Instead of sending only distance vectors, a router needs to send the whole contents of its forwarding
table in a response message.
• The receiver adds one hop to each cost and changes the next router field to the address of the sending
router.
• The received router selects the old routes as the new ones except in the following three cases:
1. If the received route does not exist in the old forwarding table, it should be added to the route.
2. If the cost of the received route is lower than the cost of the old one, the received route should be
selected as the new one.
3. A neighbor has previously advertised a route to a destination with cost, but now there is no path
between this neighbor and that destination. The neighbor advertises this destination with cost value
infinity
• The new forwarding table needs to be sorted according to the destination route.
Timers in RIP
RIP uses three timers to support its operation.
• Periodic timer controls the advertising of regular update messages. Value is set to a number
between 25 and 35 seconds
• Expiration timer governs the validity of a route. The expiration timer is set to 180 seconds.
• Garbage collection timer used to purge a route from the forwarding table. Timer is set to 120
seconds.
Performance
• Update Messages
• Convergence of Forwarding Tables
• Robustness
• Open Shortest Path First (OSPF) is also an intradomain routing protocol based on the link-state
routing protocol.
• OSPF is an open protocol, which means that the specification is a public document.
Metric
Each link (network) can be assigned a weight based on the throughput, round-trip time, reliability, and so
on.
Forwarding Tables
• Each OSPF router can create a forwarding table after finding the shortest-path tree between itself and
the destination using Dijkstra’s algorithm.
Link-State Advertisement
• OSPF is based on the link-state routing algorithm, which requires that a router advertise the state of
each link to all neighbors for the formation of the LSDB.
• 5 types of link-state advertisements:
– Router Link
– Network Link
– Summary Link To Network
– Summary Link To As Border Router
– External Link.
OSPF Implementation
• OSPF is implemented as a program in the network layer, using the service of the IP for propagation.
• An IP datagram that carries a message from OSPF sets the value of the protocol field to 89.
• OSPF has gone through two versions:
– version 1
– version 2
OSPF Messages
OSPF Algorithm
• After each router has created the shortest-path tree, the algorithm needs to use it to create the
corresponding routing algorithm.
• The algorithm needs to be augmented to handle sending and receiving all five types of messages.
Performance
• Update Messages
• Convergence of Forwarding Tables
• Robustness
• The Border Gateway Protocol version 4 (BGP4) is the only interdomain routing protocol used in
the Internet today.
• BGP4 is based on the path-vector algorithm.
• BGP4, is a complex protocol.
Variation of BGP4
• External BGP (eBGP) on each border router (the one at the edge of each AS which is connected to
a router at another AS).
• Internal BGP (iBGP), on all routers.
• The eBGP variation of BGP allows two physically connected border routers in two different ASs to
form pairs of eBGP speakers and exchange messages.
• The routers that are eligible form three pairs: R1-R5, R2-R6, and R4- R9.
• The connection between these pairs is established over three physical WANs (N5, N6, and N7).
• However, there is a need for a logical TCP connection to be created over the physical connection to
make the exchange of information possible.
• Each logical connection in BGP parlance is referred to as a session.
Path Attributes
• BGP allows a destination to be associated with up to seven path attributes.
• Path attributes are divided into two broad categories:
– well-known
– optional
Well-knownWell-known attributes are themselves divided into two categories: mandatory and
discretionary.
A well-known mandatory attribute is one that must appear in the description of a route. Well-
known mandatory attribute ORIGIN defines the source of the routing information (RIP, OSPF, and
so on), and AS_PATH defines the list of autonomous systems through which the destination can be
reached, and NEXT-HOP defines the next router to which the data packet should be sent.
A well-known discretionary attribute is one that must be recognized by each router, but is not
required to be included in every update message.
Optional attributeIt is one that needs not be recognized by every router.
The optional attributes can also be subdivided into two categories: transitive and nontransitive.
An optional transitive attribute is one that must be passed to the next router by the router that
has not implemented this attribute.
An optional nontransitive attribute is one that must be discarded if the receiving router has not
implemented it.
BGP Messages
Multicast Addresses
• In multicast communication, the sender is only one, but the receiver is many, sometimes thousands or
millions spread all over the world.
• It should be clear that we cannot include the addresses of all recipients in the packet.
• A multicast address defines a group of recipients, not a single one.
• In other words, a multicast address is an identifier for a group.
• If a new group is formed with some active members, an authority can assign an unused multicast
address to this group to uniquely define it.
• This means that the source address of a packet in multicast communication can be a unicast address
that uniquely defines the sender, but the destination address can be the multicast address that defines a
group.
– GLOP Block 233.0.0.0/8. This block defines a range of addresses that can be used inside
an autonomous system (AS).
– Administratively Scoped Block 239.0.0.0/8
• Network with No Multicast Support Most WANs do not support physical multicast addressing. To
send a multicast packet through these networks, a process called tunneling is used. In tunneling, the
multicast packet is encapsulated in a unicast packet and sent through the network, where it emerges
from the other side as a multicast packet
Creation of forwarding tables in both unicast and multicast routing involves two steps:
1. A router needs to know to which destinations it is connected.
2. Each router needs to propagate information obtained in the first step to all other routers so that
each router knows to which destination each other router is connected.
• In unicast routing, the collection of the information in the first step is automatic;
• In multicast routing, the collection of information in the first step is not automatic for two reasons.
– A router does not know which host in the attached network is a member of a particular group;
– the membership is not a fixed attribute of a host; a host may join some new groups and leave
some other seven in a short period of time.
Multicast Forwarding
2. Forwarding decisions in unicast communication depend only on the destination address of the packet.
Forwarding decisions in multicast communication depend on both the destination and the source
address of the packet. In other words, in unicasting, forwarding is based on where the packet should
go; in multicasting, forwarding is based on where the packet should go and where the packet has
come from.
Notations
• The following shows two of these notations:
– Binary
– Colon Hexadecimal
• Binary notation is used when the addresses are stored in a computer.
• The colon hexadecimal notation (or colon hex for short) divides the address into eight sections,
each made of four hexadecimal digits separated by colons.
Representation
– Abbreviation
– Mixed Notation
– CIDR Notation
Abbreviation
• Although an IPv6 address, even in hexadecimal format, is very long, many of the digits are zeros.
• In this case, we can abbreviate the address.
• We can remove all the zeros and replace them with a double semicolon.
Mixed Notation
• Sometimes we see a mixed representation of an IPv6 address: colon hex and dotted decimal notation.
• This is appropriate during the transition period in which an IPv4 address is embedded in an IPv6
address (as the rightmost 32 bits).
• We can use the colon hex notation for the leftmost six sections and four-byte dotted-decimal notation
instead of the rightmost two sections.
• For example, the address (::130.24.24.18)
CIDR Notation
• IPv6 uses hierarchical addressing.
• For this reason, IPv6 allows slash or CIDR notation.
Address Space
• The address space of IPv6 contains 2128 addresses.
• This address space is 296 times the IPv4 address—definitely no address depletion.
• The size of the space is
• Like the address space of IPv4, the address space of IPv6 is divided into several blocks of varying
size and each block is allocated for a special purpose.
Special Addresses
• Addresses that use the prefix (0000::/8) are reserved, but part of this block is used to define some
special addresses.
Renumbering
• To allow sites to change the service provider, renumbering of the address prefix (n) was built into
IPv6 addressing.
• Each site is given a prefix by the service provider to which it is connected. If the site changes the
provider, the address prefix needs to be changed.
• A router to which the site is connected can advertise a new prefix and let the site use the old prefix for
a short time before disabling it.
• In other words, during the transition period, a site has two prefixes. The main problem in using the
renumbering mechanism is the support of the DNS, which needs to propagate the new addressing
associated with a domain name.
• A new protocol for DNS, called Next Generation DNS, is under study to provide support for this
mechanism.
Packet Format
• Next header type of the first extension header (if present) or the type of the data that follows the
base header in the datagram..
• Hop limit same as the TTL field in IPv4.
• Source and destination addresses 128-bit Internet address that identifies the original source and
destination of the datagram.
• Payload Original data.
Extension Header
• An IPv6 packet is made of a base header and some extension headers.
• The length of the base header is fixed at 40 bytes.
• The base header can be followed by up to six extension headers.
Hop-by-Hop Option used when the source needs to pass information to all routers visited by the
datagram.
Destination Option The destination option is used when the source needs to pass information to the
destination only.
Source Routing The source routing extension header combines the concepts of the strict source
routeand the loose source route options of IPv4.
Fragmentation In IPv6, only the original source can fragment.
Authentication validates the message sender and ensures the integrity of data.
Encrypted Security Payload extension that provides confidentiality and guards against eavesdropping