Network Layer
Network Layer
Network Layer
LAYER
VIRTUAL CIRCUIT AND DATAGRAM NETWORKS
• Network layer also provide connection and connectionless services.
• A VC is connection oriented.
• It consist of
2) VC number- one number for each link along the path. Ech packet will have a VC number
in header.Since each packet has a VC number for each link the router must replace different
VC number for each link.New VC number obtained from forwarding table.
• VC must maintain connection state information for the ongoing connections.Whenever a new
VC is established across a router entry is added to forwarding table whenever VC terminates
the entry is removed.
1 12 2 22
2 63 1 18
3 7 2 17
1 97 3 87
• Why replace VC number for each link?
1. VC Setup: In setup phase transport layer contacts network layer specify receiver
address and waits for network to setup VC.Network determines the path between
sender receiver, routers,links,which all packets will travel and also determine VC
number for each link along the path, it also adds entry in forwarding table in each
router along the path.
2. Data Transfer: Once VC established packets can begin to flow along VC.
3. VC Teardown: The sender intiates and inform network layer to terminate VC.Network
will inform end system and update the forwarding table in each of the packet routers
on the path to indicate the VC no longer exists.
• The messages that the end systems send into network to initiate or terminate
VC and messages passed between routers to set up VC are known signalling
messages and protocols used to exchange these messages are referred to as
signalling protocols.
Datagram Networks
otherwise 3
Prefix Match Link Interface
11001000 00010111 00010000 0
otherwise 3
The Internet Protocol (IP): Forwarding and Addressing in the
internet
• Components of network layer are:
1. IP Protocol
2. Routing Component
3. Report errors in datagram and respond to request for certain network layer
information,
IP Datagram Fragmentation
• MTU Maximum transmission unit - The maximum amount of data that a link
layer frame can carry.
• All Link layer protcols cannot carry network layer packets of same
size,some can carry larger whereas others carry smaller size packets.
• Consider a router that interconnects several links each running different
link layer protocols of different MTUs.If you receive packet from one link
and router checks forwarding table and find out the output link but thay
links MTU size smaller.
• In such case we use fragments.We fragment the IP datagram into 2 or
more smaller fragments and send these smaller fragments through output
link.Fragments need to be reassembled by router before they reach
transport layer.
• When destination host receives series of datagram, it needs to determine whether it is
fragment or larger datagram.
• For destination to perform reassembly IPV4 uses identification number,flag bit and
fragmentation offset field.
• When a datagram is divided into fragments each of the fragments will have the same
datagram identification number therefore receiver would know that this the fragments
of a datagram.
• Fragments can be lost while transmission therefore the reciver to be sure that all
fragments have been received the flag bit of last fragment is set to 0 whereas other is
set to 1.
• The offset field is used to determine where a fragment fit in original datagram which
helps to identify whether fragment is lost .
• If datagram is only destined for one destination then we use unicast routing.Eg Distance
Vector Routing (DV)
• If datagram is destined for multiple destination then we use multicast routing.Eg Protocol
Independent Multicast(PIM)
• ISP - ISPs are companies or organizations that provide access to the internet and various
internet-related services to individuals, businesses, and other entities. They serve as the bridge
between end-users and the vast network of interconnected systems that comprise the internet.It
consist of 3 entities backbones(core structure),provider network and consumer networks.
Heirarchial Routing
• Internet today is ade up of mutliple networks and routers that connect them.
• Routing in internet cannot be done using a single protocol for 2 reasons:
• IP has gone through two versions: RIP-1 and RIP-2. RIP -2 is more compatible and allow more
information in RIP messages.
• Two RIP processes, a client and a server, like any other processes,need to exchange messages.
• A request message is sent by a router that has just come up or by a router that has some time-
out entries.
• An unsolicited response message , on the other hand, is sent periodically, every 30 seconds or
when there is a change in the forwarding table .
Timers in RIP
• The periodic timer controls the advertising of regular update messages . Each router has one
periodic timer that is randomly set to a number between 25 and 35 seconds (to prevent all
routers sending their messages at the same time and creating excess traffic). The timer counts
down; when zero is reached, the update message is sent, and the timer is randomly set again
• 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 seconds for that particular route. Every time a
new update for the route is received, the timer is reset. If there is a problem on an internet and
no update is received within the allotted 180 seconds 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.
• The garbage collection timer is used to purge a route from the forwarding table. When the
information about a route becomes invalid, the router does not immediately purge that route
from its table.
OSPF
• Open Shortest Path First (OSPF) is also an intradomain routing protocol, it is based on the link-state routing
protocol.
• Cost of reaching a destination from the host is calculated from the source router to the destination
network.
Each link (network) can be assigned a weight based on the throughput, round-trip time, reliability
• Forwarding Tables:
• OSPF router can create forwarding table after finding the shortest path tree
between itself and destination using dijkstra algorithm.
• The only difference from forwarding table in RIP here instead of HOP the cost is
mentioned.
Link State Advertisement
• router link
• network link,
• external link
• First install a variation of BGP4, called external BGP (eBGP), on each border router install
• the second variation of BGP, called internal BGP (iBGP) , on all routers.
• it creates a session between any possible pair of routers inside an autonomous system
• BGP uses four types of messages for communication between the BGP speakers across the
ASs and inside an AS:
• Open Message. To create a neighborhood relationship, a router running BGP opens a TCP
connection with a neighbor and sends an open message.
• Update Message. The update message is the heart of the BGP protocol. It is used by a router
to withdraw destinations that have been advertised previously, to announce a route to a new
destination, or both
• Keepalive Message. The BGP peers that are running exchange keepalive messages regularly
(before their hold time expires) to tell each other that they are alive.
• BGP Path Attributes divide into two groups. These classes are Well-
Known and Optional path attributes. These two groups divide also into two
subgroups again.
• A well-known attribute can be mandatory, which means that it must be present in any
BGP update message, or discretionary, which means it does not have to be.
• An optional attribute can be either transitive, which means it can pass to the next AS,
or intransitive, which means it cannot
The first byte in each attribute defines the four attribute flags
The next byte defines the type of attributes assigned by ICANN
The attribute value length defines the length ofthe attribute value field
Attributes Type
• ORIGIN (type 1). This is a well-known mandatory attribute, which defines the source of the
routing information.
• AS-PATH (type 2). This is a well-known mandatory attribute, which defines the list of
autonomous systems through which the destination can be reached.
• NEXT-HOP (type 3). This is a well-known mandatory attribute, which defines the next router
to which the data packet should be forwarded.