CN Unit 4
CN Unit 4
Network Layer
Unit Covered
1. Internetworking 3. Forwarding :
– Need of Network Layer, – Forwarding Techniques,
– Internet as datagram n/w, – Forwarding Process,
– Internet as Connectionless n/w – Routing table
2. Delivery : 4. Routing protocols:
– Direct, – Distance vector routing,
– Indirect – Link state routing,
– Path vector routing
2
Internetworking
4
Internetworking
• Physical and Datalink layer of a network operate locally.
• These two layer are jointly responsible for data delivery on
the network from one node to next.
5
Internetwork
• Internetwork made up of 5 networks :
– 4 LAN and 1 WAN
• If one host A need to send data packet to D
– Packet go 1st from A to R1(Switch or Router)
– R1 to R3
– R3 to Host D.
• Data packet passes through 3 link, in each 2 physical and 2
Datalink layer are involved.
6
Internetworking
7
Problem with Delivery through
several link
• When data arrive at interface f1 of R1, how does R1 know
that interface f3 is the outgoing interface?
• There is no provision in the data link (or physical) layer to help
R1 to make right decision.
• The frame does not carry any routing information.
• Frame contain MAC address of A as a source and R1 as
Destination.
• For a LAN or MAN, delivery means carrying the frame through
one link not beyond.
8
Need of Network Layer
9
Network layer in an
Internetwork
10
Network Layer Functionality
– Source
– Router
– Destination
11
Network Layer at Source
12
Network Layer at Source
13
Network Layer At
Switch or Router
1. Responsibility for routing a packet.
2. When packet is arrive, router and switch consults it routing
table
– Find interface from which the packet must be sent.
14
Network Layer At Destination
2. If packet is fragmented
– The network layer wait until all fragments have arrived.
15
Network Layer At Destination
16
Internet as a Datagram
Network
• The internet has chosen the datagram approach to switching
in network layer.
• It uses universal addresses defines in the network to route
packet from the source to destination.
17
Datagram Approach
18
Internet as a Datagram
Network
• The internet , at network layer is a packet – switched
network.
• Switching can be divided into 3 category
– Circuit Switching
– Packet Switching
• Virtual circuit
• Datagram
– Message Switching
19
Internet as a Connectionless
Network
• Delivery can be done by either connection oriented or
connectionless network service.
• Connection – Oriented Service:
– Source must make connection with destination before sending packet.
– And then sequence of packet from same source to destination one
after another.
– Packet is logically connected with each other.
– When all packets of message have been delivered, the connection is
terminated.
– Decision about route made only once, when connection is established.
– Switch do not recalculate route.
20
Connectionless service
• In this, Network layer treat each packet independently , with
each packet having no relationship to any other packet.
• Packet may not be travel the same path to their destination.
• This type of service is used in datagram approach.
• Reason :
– Internet is made up of so many heterogeneous network.
– Impossible to create connection from source to destination.
– Direct Delivery
– Indirect Delivery
22
Direct Delivery
• In direct delivery, the final destination of a packet is a host
connected to the same physical network as the deliverer.
• Direct delivery occurs when
– The source and destination of packet are located on the same
physical network or
– Delivery is between the last router and destination host.
24
Indirect Delivery
• If the destination host is not on the same network as the
deliverer, the packet is delivered indirectly.
• In indirect Delivery :
– The packet goes from router to router until it reaches the
one connected to the same physical network as its final
destination.
26
Forwarding
• Forwarding means to place the packet in its route to its
destination.
• Forwarding requires a host or a router to have a routing table.
• When a host has a packet to send or when a router has
received a packet to be forwarded, it looks at this table to find
the route to the final destination.
• Forwarding Include :
– Forwarding Techniques
– Forwarding Process
– Routing Table
27
Forwarding Technique
• Several technique can make the size of the routing
table manageable and also handle issue such as
security.
– Next – hop method versus Route Method
– Network – specific method versus Host – Specific Method
28
Next – hop method versus
Route Method
• One technique to reduce the content of a routing table is
called the Next-hop-method.
• The routing table holds only the address of the next hop
instead of information about the complete route (route
method).
• The entry of routing table must be consistent with one
another.
29
Route method versus
next-hop method
30
Network-specific Method
versus Host-specific Method
• A second technique to reduce the routing table and simplify the
searching process is called the Network-specific method.
• Here, instead of having an entry for every destination host
connected to the same physical network (host- specific)
– We have only one entry that defines the address of the
destination network itself.
• We treat all hosts connected to the same network as one single
entry.
• Example:
– If 1000 host are attached to the same network, only one entry exists in the
routing table.
31
Host-specific versus
network-specific method
32
Default Method
33
Default Method
34
Forwarding Process
• Host and routers uses classless addressing
– Because classful addressing is special case of classless addressing.
• In classless addressing, the routing table needs to have one
row of information for each block involved.
• The table need to be searched based on the network address.
• Destination address in the packet gives no clue about the
network address.
• To solve the problem, we need to include the mask(/n) in the
table.
– Extra column that includes the mask for the corresponding block.
35
Simplified forwarding module
in classless address
36
Example 22.1
37
Configuration of Example 22.1
38
Solution
39
Example 22.2
Show the forwarding process if a packet arrives at R1 in Figure
22.6 with the destination address 180.70.65.140.
Solution
• The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The
result is 180.70.65.192, which does not match the
corresponding network address.
2. The second mask (/25) is applied to the destination address.
The result is 180.70.65.128, which matches the corresponding
network address. The next-hop address and the interface
number m0 are passed to ARP for further processing.
40
Routing Table
• Host and router has routing table with entry for each
destination, or combination of destination , to route IP
packets.
• The routing table can be either
– Static
– Dynamic.
41
Static
• Static routing table contains information entered manually.
• The administrator enters the route for each destination into
routing table.
• When table is created, it can not update automatically when
there is change in Internet.
• The table must be manually altered.
• It can be used in small internet that does not change.
• It is poor strategy to use a static routing table in a big internet
as the Internet.
42
Dynamic Routing Table
43
Format of Routing Table
44
Intra and interdomain routing
• Autonomous System :
– Group of network and router
under the authority of single
administrator.
• Intradomain Routing
– Routing inside autonomous
system .
• Interdomain Routing
– Routing between autonomous
system .
45
Cont…
A routing protocol is a combination of rules and procedures that
lets routers in the Internet inform each other for changes.
46
Optimization
• When router receive packet, to which network should it pass
the packet?
• The decision based on optimization :
– Which of the available pathways is the optimal pathway?
• Policy (BGP)
47
Optimization Protocol
• RIP : Routing information protocol
– Treat all network are equal and cost of passing through
network is same.
– It is a Intradomain routing protocol used inside an
autonomous system.
– RIP used Hop Count metrics .
• The number of link to reach destination is called hop
count.
48
Optimization Protocol
49
Distance Vector Routing
• The least cost route between any two nodes is the route with
minimum distance.
• In this protocol , as the name implies, each node maintain
vector (table) of minimum distance to every node.
• The table at each node also guides the packet to the desired
node by showing the next stop in the route.
50
Distance Vector Routing Table
51
• The tables (Vectors) are stable.
• Each node knows how to reach any other node and the cost.
• 3 steps for dynamic routing table
– Initialization
• Each node can know only the distance between itself and its
immediate neighbor.
• The distance for any entry that is not a neighbor is marked as infinite.
– Sharing
• Sharing of information between neighbors.
– Updating
• When node receive a two column routing table from neighbor, it
needs its routing table.
52
Initialization of tables in
distance vector routing
53
Note
54
Updating in distance
vector routing
55
When to share
56
Link State Routing
• It has different philosophy than distance vector routing.
• In link state routing
58
• Each node uses the same topology to create a routing table.
• But routing table for each node is unique.
– Because the calculation based on different interpretation of topology.
• It is similar to city map in which each person may have the
same map
– Each need to take a different route to reach their specific destination.
• Topology must be dynamic.
– Representing the latest state of each node and each link.
– If there are changes in any point in the network, topology must be
updated for each node.
59
Link state knowledge
• Whole topology can be compiled from the partial knowledge of
each node.
Figure indicating part of knowledge belonging to each node.
60
Building Routing Table
61
Step 1
• Creation of Link State Packet (LSP)
– It carry minimum amount of data like
• Node Identity and List of link : To make the topology.
• Age : Prevent old LSP from remaining in the domain from long time.
– LSP Generated on 2 occasion
• When there is a change in the topology of the domain
62
Step 2
• Flooding of LSPs
– After node has prepared an LSP, it must disseminated to all
other node. This process is called flooding.
– Flooding based on following
• Creating node sends a copy of LSP out of each interface.
• Receiving node compares LSP with copy that already have.
– If old one, then discard LSP.
– If newer, discard old LSP and keep new one.
» Sends copy to each interface except the one from which
the packet is arrived.
63
Step 3
• Formulation of Shortest Path
– Tree is a graph of nodes and links: one node is called Root.
– Dijkstra algorithm creates shortest path.
– It divides node in to 2 parts.
• Permanent
• Tentative
– It find the neighbor of current node, make them tentative,
examine them and if they pass the criteria, make them
permanent.
64
Example of formulation of
shortest path tree
65
Tracing
Permanent list: A(0 ),B(5) C(2), D(3), E(6) Tentative List Empty
66
Routing Table for node A
67
OSPF
• Intradomain routing protocol.
• Its Domain is also autonomous.
• To handle routing efficiently and timely manner.
– OSPF divides the system in to areas.
• Area is a collection of network, host and router all contained
within autonomous system.
• Router inside an area flood the area with routing information.
• At the border of an area, special router called area border
router.
– It summarize the information about area and send it to
other area.
68
Areas in an
autonomous system
69
Path Vector Routing
70
• Speaker node in an AS creates the routing table and advertises
it to speaker node in neighboring ASs.
• Idea is same as distance vector
– But only speaker node in each AS can communicate with each
other.
– Speaker node advertises the path, not the metric of each node.
• Three steps to follow
– Initialization
– Sharing
– Updating
71
Initialization
• At the beginning each node can knows only the reachability
of nodes inside its autonomous system.
• Initial table for each speaker node.
• Node A1 is a speaker of AS1, B1 for AS2, C1 for AS3 and D1
for AS4.
• Node A1 creates an initial table that shows A1 to A5 are
located in AS1 and can be reached through it. And so on.
72
Initial routing table in
path vector routing
73
Sharing
74
Updating
• When speaker receive 2 column table from neighbor, it
updates its own table by adding the nodes that are not in a
routing table.
– Adding its own AS and AS that sent the system.
• That table gives information about how to reach each node in
other As.
• Example :
– If node A1 receive a packet to for D1, it know that packet should
go from AS1 to AS2 and then AS4.
– D1 receive packet for Node A2, it knows it should go through
AS4 to AS3 and AS1.
75
Stabilized tables for three
autonomous systems
76
Loop Preservation
77
Policy Routing
78
Optimal Path
79
BGP
• Border Gateway Protocol is a Intradomain routing protocol.
• Types of AS : As is divides into 3 category.
– Stub AS :
• Has only one connection to another AS.
• Data traffic can not pass through a stub AS.
– Multihomed AS
• Has more than one connection to other As.
• It can send data traffic to more than one AS, but there is no
temporary traffic.
– Transit AS
• A transit AS is a Multihomed AS that also allows transient traffic.
80
Internal and external
BGP sessions
81