Network Layer

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 52

NETWORK

LAYER
VIRTUAL CIRCUIT AND DATAGRAM NETWORKS
• Network layer also provide connection and connectionless services.

1. Connection service - virtual circuit network

2. connectionless service - datagram network

Virtual Circuit Network:

• A VC is connection oriented.

• It consist of

1) a path (series of links and routers)

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.

3) entries in the forwarding table in each routers along the path.


• Suppose host A want to establish network connection with host B and chooses a path A -R1-
R2-B and assign VC numbers 12,22,32.so when a packet leaves host A VC number field in
header is 12 , when it leaves R1 the value is 22 and when it leaves R2 the value is 32.

• 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.

incoming incoming VC outgoing outgoing VC


interface interface

1 12 2 22
2 63 1 18
3 7 2 17
1 97 3 87
• Why replace VC number for each link?

1. Replacing the VC will reduce the length of VC field in header

2. VC setup is simplified by permitting different VC number

• There are three phases in VC

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

• In datagram networks each time end system wants to send packet, it


stamps with the address of the destination end system and pops the packet
into network.
• Routers in datagram network does not maintain any state information.
• As packet passes through different routers to reach destination , each
router has forwarding table that maps destination address to link interface.
• The destination address are 32 bits therefore there 4 billion possible
address,suppose router has 4 links then packets are to be forwarded to
link interfaces.We could use prefix match to shprten the below given table.
Destination Address Range Link Interface
11001000 00010111 00010000 00000000 0
through
11001000 00010111 00010000 11111111

11001000 00010111 00011000 11111111 1


through
11001000 00010111 00011000 00000000

11001000 00010111 00011001 00000000 2


through
11001000 00010111 00011001 11111111

otherwise 3
Prefix Match Link Interface
11001000 00010111 00010000 0

11001000 00010111 00011000 1

11001000 00010111 00011001 2

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 .

• Incomplete datagram is not forwarded to transport layer it is discarded.


IPV4 Addressing
• Boundary between host or router and its link
is known as interface.Therefore a router will
have multiple interface.

• IP address is 32 bit long address that is 4


bytes therefore 2 3 2 possible IP addressess.

• Address is written in dotted decimal


notation.Eg: 192.32.216.8.

• Left three host is of the form 223.1.1.xxx


that is they have same leftmost 24 bits.

• A subnet is a network in the


internet.Through subnetting, network traffic
can travel a shorter distance without
passing through unnecessary routers to
reach its destination.
• Ip addressing assigns an address to the subnet 223.1.1.0/24 where /24is
subnet mask.indicate leftmost 24 bits.
• The internet address assignment strategy is known as classless
interdomain routing (CIDR). It handles subnet addressing.
• IP address is of the form a.b.c.d/x where x represent most significant bits
refered to as prefix. Therefore IP addresses of devices within the
organization will share common prefix and rest bits will used to distinguish
devices on a same organization.
Obtaining Host Address
• Once block of address is received by organization it can assign
individual IP address to host and routers.For router interface the
system administrator manually configure Ip address into router.
• Host can be assigned IP address in two ways:

1. Manual configuration:system administrator manually configure Ip


address into host.
2. DHCP (dynamic host configuration): it allows host to be allocated
IP address automatically.
Distance Vector Algorithm
• The distancevector (DV) algorithm is iterative, asynchronous, and
distributed.
• It is distributed in that each node receives some information from one or
more of its directly attached neighbors, performs a calculation, and then
distributes the results of its calculation back to its neighbors.
• It is iterative in that this process continues on until no more
information is exchanged between neighbors.
• The algorithm is asynchronous in that it does not require all of the
nodes to operate.
• In the DV algorithm, a node x updates its
distance-vector estimate when it either sees a
cost change in one of its directly attached links
or receives a distance vector update from some
neighbor.

• the only information a node will have is the


costs of the links to its directly attached
neighbors and information it receives from
these neighbors.

• Each node waits for an update from any


neighbor calculates its new distance vector
when receiving an update and distributes its
new distance vector to its neighbors .

• DV-like algorithms are used in many


routing protocols in practice, including the
Internet’s RIP and BGP, ISO IDRP, Novell
IPX, and the original ARPAnet.
Link State Routing Algorithm
• In a link-state algorithm, the network topology and all link costs are
known, that is, available as input to the LS algorithm.
• Objective-to find the least cost path from source router to destination
router
• In practice this is accomplished by having each node broadcast link-
state packets to all other nodes in the network, with each link-state
packet containing the identities and costs of its attached links.
• All nodes have an identical and complete view of the network.
Link state routing protocol rely on two mechanisms:
• Reliable dissemination of link state information i.e Flooding
• Calculation of route from the sum of all accumulated link sate
knowledge
Link State Database (LSDB)
• Each node needs to have a complete map of the network, this collection of states for all links is
called the link-state database (LSDB).
REFER COMPARISON BETWEEN DISTANCE VECTOR AND LINK STATE ALGORITHM FROM
TEXT
Unicast,multicast and broadcast
• In network layer the goal is to deliver datagram from source to destination.

• 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)

• If datagram is supposed to be delivered to all host in network then it is broadcast routing.Eg


Reverse Path First(RPF)

• 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:

1. Scalability Problem: Size of forwarding table becomes an huge,search for


destination in forwarding table becomes time consuming and update creates
huge amount of traffic.
2. Administrative issue: ISP is run by authorities who may need control of the
system and they may need routers to be from a particular manufacturer,use
many subnets and routers and may need to use specific algorithms and may
want to impose policy on traffic passing through ISPs.
Heirarchial routing consider each ISP as autonomous systems(AS).Each as can run
a routing protocol that meet its need and global internet uses global protocol to
glue all ASs togethor.
• Routers within the same AS all run the same routing algorithm (for example, an LS or DV
algorithm) and have information about each .
• The routing algorithm running within an autonomous system is called an intra-autonomous
system routing protocol. Eg BGP, OSPF
• It will be necessary, of course, to connect ASs to each other, and thus one or more of the
routers in an AS will have the added task of being responsible for forwarding packets to
destinations outside the AS these routers are called gateway routers.
• Obtaining reachability information from neighboring ASs and propagating the reachability
information to all routers internal to the AS—are handled by the inter-AS routing protocol.
• Since the inter-AS routing protocol involves
communication between two ASs, the two
communicating ASs must run the same inter-AS
routing protocol.

• In fact, in the Internet all ASs run the same


inter-AS routing protocol, called BGP4. Border
Gateway Protocol.

• The problem of scale is solved because an


intra-AS router need only know about routers
within its AS.

• The problem of administrative authority is


solved since an organization can run
whatever intra-AS routing protocol it chooses;
Routing Information Protocol (RIP)
• Intra domain routing protocols based on the distance-vector routing algorithm.
• A router in this protocol basically implements the modified distance-vector
routing algorithm to support autonomous system.
Modifications:
• RIP routers advertise the cost of reaching different networks instead of reaching
other nodes. In other words, the cost is defined between a router and the
network in which the destination host is located.
• the cost is defined as the number of hops, which means the number of networks
(sub-nets) a packet needs to travel through from the source router to the final
destination host.[the maximum cost of a path can be 15, which means 16 is
considered as infinity]
• Forwarding Table:

• 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
 first column is the address of the destination
network
 second column is the address of the next
router to which the packet should be
forwarded,
 third column is the cost(the number of hops)
to reach the destination network.
• It is implemented as a process that uses the service of UDP on the well-known port number 520

• IP has gone through two versions: RIP-1 and RIP-2. RIP -2 is more compatible and allow more
information in RIP messages.

• RIP 2- RIP Messages:

• Two RIP processes, a client and a server, like any other processes,need to exchange messages.

• RIP-2 defines the format of the message.


Types of RIP MESSAGES
• RIP has two types of messages: request and response.

• 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 message can ask about specific entries or all entries.

• A response (or update)message can be either solicited or unsolicited.

• A solicited response message is sent only in answer to a request message . It contains


information about the destinations specified in the corresponding request message.

• 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.

• It is an open protocol which means specification is public documentation.

• 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

• OSPF was designes to handle small or large AS compared with RIP.


• Formation of shortest path trees in OSPF requires all routers flooded with AS
with their LSPs to create LSDB. To prevent this AS is divided into small sections
called areas.
• Each router in an area need to know information about other area.Therefore one
of the area is designated as backbone area responsible for gluing all area
togethor.
• Router in backbone area is responsible for passing information collected by each
area to other.In this way router in an area can receive all Link state packets(LSP)
generated in other areas.
• Each area has a identification value and backbone area value is 0.
• OSPF uses link state algorithm in which the router advertises the state of each link to its
neighbours.But in real world scenario router is not only the case.Here there are different types
of nodes and therefore different types of link state advertisements.

The types are:

• router link

• network link,

• summary link to network:

• summary link to AS,

• external link

• [Detail explanation in text]


OSPF Messages
OSPF Algorithm:
• OSPF implements the link-state routing algorithm we discussed in

the previous section. However, some changes and augmentations need to be


added to the 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.

• [Compare the performace section of OSPF RIP and BGP]


Border Gateway Protocol
• Each router in each AS knows how to reach a network that is in its own AS, but it does not know how
to reach a network in another AS.

• 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.

• Border router will be running intradomain,eBGP,iBGP

• Other routers will be running intradomain and iBGP


Operations of external BGP:
• BGP protocol is a kind of point-to-point protocol.
• The two routers that run the BGP processes that communicate like client server
process are called BGP peers or BGP speakers.
• They create TCP connection using the well-known port 179.
• eBGP allows two router in different AS which are physically connected to form
pairs of eBGP speakers and exchange messages.
• Extrenal BGP speakers in our example are:R1-R5, R2-R6, and R4-R9
• Each logical connection in BGP peers is referred to as a session.
Operations of Internal BGP:

• it creates a session between any possible pair of routers inside an autonomous system

• if an AS has only one router, there cannot be an iBGP session.

• if there are n routers in an autonomous system, there should be [n × (n − 1) / 2] iBGP sessions


in that autonomous system (a fully connected mesh)
BGP Messages

• 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.

• Notification. A notification message is sent by a router whenever an error condition is


detected or a router wants to close the session
Path Attributes
• BGP uses BGP Path Attributes to determine the Best Path to a destination.

• 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 must be recognized by all routers; an optional attribute does


not.

• 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.

• MULT-EXIT-DISC (type 4). The multiple-exit discriminator is an optional non transitive


attribute, which discriminates among multiple exit paths to a destination .

• LOCAL-PREF (type 5). The local preference attribute is a well-known discretionary


attribute. It is normally set by the administrator, based on the organization policy. The routes
the administrator prefers are given a higher local preference value

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy