Title: Network Layer
1Network Layer
2The context
3Store and Forward Packet Switching
- A packet is stored in entirety, checksum
recomputed at every hop and forwarded.
4Services provided to the transport layer
- Services should be independent of the router
technology. - Transport layer be shielded from the topology of
the routers. - The network addresses made available to the TL
should use a uniform numbering plan, even across
LANs and WANs.
5Two schools of thought
- Whether NL provides a CL service to the TL
(Internet Community), or - Whether It provides a CO service to the TL
(telephone companies)
6CL VS CO
- CL Since subnet is inherently unreliable, host
should do the error , flow control, packet
ordering etc themselves. - CO subnet must provide reliable service QoS is
imporatnt
7Implementation of CL
- Packets are called datagrams and the subnet is
called datagram subnet.
8Implementation of Connectionless Service
- Routing within a diagram subnet.
9Implementation of Connection-Oriented Service
- Routing within a virtual-circuit subnet.
10Comparison of Virtual-Circuit and Datagram Subnets
5-4
11Comparison of Virtual-Circuit and Datagram Subnets
5-4
12Routing Algorithms desirable properties
- Correctness
- Simplicity
- Robustness
- Stability converge to equilibrium
- Fairness
- Optimality Minimize mean packet delay, maximize
throughput conflicting, since queuing near full
capacity implies long delays - Minimize the number of hops improves delays as
well as throughput
13Equilibrium
14Fairness Vs Optimality
- Conflict between fairness and optimality.
15Routing Algorithms Adaptive or Non-adaptive
- Non-adaptive Static
- Adaptive Dynamic
16Routing Algorithms
- The Optimality Principle
- Shortest Path Routing
- Flooding
- Distance Vector Routing
- Link State Routing
- Hierarchical Routing
- Broadcast Routing
- Multicast Routing
- Routing for Mobile Hosts
- Routing in Ad Hoc Networks
17The Optimality Principle
- (a) A subnet. (b) A sink tree for router B.
18Shortest Path Routing Static
- The first 5 steps used in computing the shortest
path from A to D. The arrows indicate the
working node.
19Flooding
- Problems Jamming/Congestion
- Solutions
- Hop count in the header
- Sequence number for every source discard
duplicate packets. - Adv Though not practical for routine routing but
useful when a system starts afresh.
20Distance Vector Routing Dynamic
- (a) A subnet. (b) Input from A, I, H, K, and the
new - routing table for J.
21Distance Vector Routing (2)
The count-to-infinity problem.
22Link State Routing
- Each router must do the following
- Discover its neighbors, learn their network
address. - Measure the delay or cost to each of its
neighbors. - Construct a packet telling all it has just
learned. - Send this packet to all other routers.
- Compute the shortest path to every other router.
23Discovering the neighbours
- Send a HELLO packet
- The other router sends a reply telling who he is
24Problem
- (a) Nine routers and a LAN. (b) A graph model of
(a).
25Measuring the delay to neighbours
- Send an ECHO packet
- The receiver sends it back immediately with a
time stamp
26Building Link State Packets
- (a) A subnet. (b) The link state packets for
this subnet.
27Distributing the Link State Packets
- Packets are flooded,
- Seq no.s to check jamming
28Distributing the Link State Packets
- The packet buffer for router B in the previous
slide (Fig. 5-13).
29Hierarchical Routing
30Broadcasting in point to point subnet
- Individual packet for each destination
- Flooding
- Multidestination routing each packet has to
contain either a list of destinations or a bit
map indicating all the destinations. - Spanning tree best in terms of channel
utilization minimum number of copies are
generated . But knowledge of some spanning tree
at every router is required ..which is sometimes
available (as in LSR) but sometimes not(as in
DVR) - Reverse path forwarding
31Reverse path forwarding
- Approximates the behaviour of Spanning tree algo
.. When routers have no knowledge of spanning
trees.
32Reverse path forwarding
Reverse path forwarding. (a) A subnet. (b) a
Sink tree. (c) The tree built by reverse path
forwarding.
33Reverse path forwarding
- No knowledge of spanning trees required
- No bit map etc required
- Simple and easy to implement
- No additional CPU time required
- Not the best but in practice reasonably
efficient.
34Multicast Routing in the subnet
- MR sending a message to members within a group
35Multicast Routing
(a) A network. (b) A spanning tree for the
leftmost router. (c) A multicast tree for
group 1. (d) A multicast tree for group 2.
36Congestion Control
37What is congestion?
- Too many packets in a part of the subnet, too
many to handle.
38Some of the Causes of congestion
- Lot of packets arriving at 3-4 lines of a router,
all needing the same output line. As a result, a
queue will build up on the outgoing line. When
the Q is full, packets will start dropping. - Increasing the size of the buffer may help
initially but after a certain limit may have
adverse effect--- By the time a packet moves up
in the Q, it times out and retransmitted
increasing the load on the network.
39Causes of congestion
- Slow processors If the computational powers of a
router are weak, it will take time in
book-keeping and processing, again resulting in
building up of Qs. - Low bandwidth
- In fact, Slow processors and High bandwidth, or
- Fast processors but Low Bandwidth
- a good combination of fast processors and high
bandwidth is required to improve the situation.
40Solutions to Congestion
- Classified into two categories
- Open Loop solutions Static Solutions, take
preventive measures by good design, but no
corrections are done once the system is up, that
is do not take the current state of the system
into account. Adv simplicity - Closed Loop Solutions Based on feedback
- a router detects congestion,
- pass the information (feedback) to nodes where
action can be taken, say the sender, and - adjust the system parameters to fix the problem.
41Open Loop Solutions
- Policy-Decisions at various levels
42Congestion Prevention Policies
- Policies that affect congestion.
5-26
43Open Loop Solutions contd..
- Flow Control --- window size
- Acknowledgement policy --- piggyback or not
- Out-of-order policy --- Go back N/Selective
repeat - Retransmission Policy --- Time out etc
44Closed Loop Solutions
- Detecting/Predicting congestion Let u be any
parameter being monitored say, output line
utilization or queue length or buffer
utilization Let a be a constant between 0 and
1 - U_new is predicted as folllows
- u_new a u_old (1-a)u_new
- A value of u going above a certain threshold is
considered as a situation for congestion - Congestion Control in Virtual-Circuit Subnets
- Congestion Control in Datagram Subnets
45Congestion Control in Virtual-Circuit Subnets
- Admission Control No more new VCs
- Allow new VCs but route them around the problem
area.
46Congestion Control in Virtual-Circuit Subnets
- A congested subnet. (b) A redrawn subnet,
eliminates congestion and a virtual circuit from
A to B. - Back
47Congestion Control in Datagram Subnets
- Warning Bit is set in the forwarded packet and
copied en-route by the destination in the
acknowledgement packet. - Choke Packets are sent back to the sender as a
feedback. - The corrective measures (slow down the
transmission) are taken only at the source, Fig
a. - The corrective measures (slow down the forwarding
of the packets coming from the source) are taken
at every Hop en-route the Choke Packet, Fig b.
48Hop-by-Hop Choke Packets
- (a) A choke packet that affects only the source.
- (b) A choke packet that affects each hop it
passes through. - Back
49Load Shedding in Datagram Subnet
- Throw the packet when nothing else works
- Select the packet to be dropped randomly
- Select intelligently For example
- In a file transfer, older is better so drop the
later ones. Dropping older would cause a gap at
the destination and more packets would have to be
retransmitted. - In audio/video file loosing few bits is not
important, so dropping older is better, no
retransmission may be asked by the destination. - Or, sender may specify the priority
50Internetworking
51Connecting Networks of different type by routers
- So far we have assumed that our subnet is
connected to LANs of same type. So the only role
of routers was to route the packets. - As the h/w and n/w gets cheaper, the place where
decisions are made move downwards in the
hierarchy in an organization. For eg ..in a univ
.. Each department decides on its own what type
of LAN do they want. Hence Maths deptt may have
an Ethernet LAN whereas CS may have a wireless
LAN. - Now the univ. must be able to provide a subnet to
connect these two LANs so that a host on one can
communicate with the host on another.
52Connecting LANs of different types by bridge
- Sort of assumes that their NL are same..
- If that is not the case, then the scheme studied
earlier will not suffice.
53Connecting Networks
- A collection of interconnected networks.
54How Networks Differ
5-43
- Some of the many ways networks can differ.
55How Networks Can Be Connected
- (a) Two Ethernets connected by a switch.
- (b) Two Ethernets connected by routers.
56Concatenated Virtual Circuits
- Internetworking using concatenated virtual
circuits.
57Connectionless Internetworking
- A connectionless internet.
58Tunneling
- Tunneling a packet from Paris to London.
59Tunneling (2)
- Tunneling a car from France to England.
60Autonomous System
- Each network in an Internet is independent and
hence it is called an Autonomous System.
61Internetwork Routing
- (a) An internetwork. (b) A graph of the
internetwork.
62Two level routing algorithm in IN
- Once a graph of multi-protocol routers(gateways)
is constructed , routing algorithms such as DVR
and LSR can be applied. This leads to 2-level
routing in internetworks - Interior Gateway Protocol (within a network).
- Exterior Gateway Protocol (across the networks)
63Routing in Internet contd..
- A host H1 on LAN 1 wants to send a packet to a
host H2 on LAN 2. - A packet is prepared by NL of H1 with Network
address of H2 but, - Encapsulated in a frame by the DLLwith MAC
address of the multi-protocol router connected to
LAN 1 - Packet arrives at MPR1 on LAN1
- NL at MPR1 uses the Network address to decide
which MPR2 to forward the packet to. - If the Network Protocol used by the Network
through which MPR1 sends a packet to MPR2 is same
as that used by LAN1, the packet is sent directly
with no change in the packet. - Else, the packet is encapsulated in the payload
field of the packet of the Network Protocol used
by the connecting Network and tunneled. - Of course, assuming that the connecting network
uses MAC addressing, DLL of MPR1 puts the MAC
address of MPR2. - The process is repeated at MPR2
- Until the packet reaches the destination network.
64Fragmentation
- (a) Transparent fragmentation. (b)
Nontransparent fragmentation.
65Fragmentation (2)
- Fragmentation when the elementary data size is 1
byte. - (a) Original packet, containing 10 data bytes.
- (b) Fragments after passing through a network
with maximum packet size of 8 payload bytes plus
header. - (c) Fragments after passing through a size 5
gateway.
66The Network Layer in the Internet
- The IP Protocol
- IP Addresses
- Internet Control Protocols
- OSPF The Interior Gateway Routing Protocol
- BGP The Exterior Gateway Routing Protocol
- Internet Multicasting
- Mobile IP
- IPv6
67Design Principles for Internet
- Make sure it works.
- Keep it simple.
- Make clear choices.
- Exploit modularity.
- Expect heterogeneity.
- Avoid static options and parameters.
- Look for a good design it need not be perfect.
- Be strict when sending and tolerant when
receiving. - Think about scalability.
- Consider performance and cost.
68Collection of Subnetworks
- The Internet is an interconnected collection of
many networks.
69The IP Protocol
- The IPv4 (Internet Protocol) header.
70IP Protocol contd..
- Version
- IHL
- Type of Service
- Total Length, Identification, DF, MF, Fragment
Offset - TTL
- Protocol
- Header Checksum
- Options
71Version Number
- To let several versions to work
simultaneouslyactually two during a transition
period which takes years.
IP Protocol contd..
72IHL IP Header Length
- Header length is variable
- specified as number of 32 bit words
- 20 bytes (5 32 bit words) to 60 bytes (15 32 bit
words)
IP Protocol contd..
73Type of Service
- Various combinations of reliability and speed can
be specified here. For Example, digitized voice
prefers fast over error-free transmission and
file transfer prefers error-free over fast
transmission. Routers on the way use this
information to choose a path. If the shortest
path is error-prone, it may use an alternate path
to transfer a packet for file-transfer whereas
for voice packet it will choose the shortest path
even if it is error-prone.
74Type of Service contd..
- First 3 bits precedence or priority bits
- Next 3 are flags D (delay), T (Throughput) and
R (Reliability) - Allow the routers to make a choice between high
throughput and high delay link like satellite and
low throughput, low delay link like leased line.
IP Protocol contd..
75Other fields
- Total Length Header Data 16 bits ..65,535
bytes - Identification No. To know which datagram the
fragment belongs to - DF, MF Dont Fragment and More Fragment
- Fragment Offset
- specified in number of elementary fragment unit
i.e. 8 bytes i.e multiple of 8 bytes. - 13 bits 2138192
- Total Datagram 8192 8.
IP Protocol contd..
76Time to Live
- Specified in seconds and decremented on every Hop
and even when in the queue. - In practice, Number of Hops is used.
IP Protocol contd..
77Protocol
- Mentions the number of Transport Layer Protocol
to which the packet must be handed over. For eg.
TCP/UDP or any other. - These TP are assigned numbers (called ports) are
unique across the globe.
IP Protocol contd..
78Header Checksum
- Computed at every hop
- to take care of error that might creep in due to
bad bits in the router memory. - TTL field changes at every hop
IP Protocol contd..
79Some of the IP Options
5-54
80IP Addresses 32 bit number
- Assigned by central naming authority ICANN
Internet Corporation for Assigned Names and
Numbers
81IP Addresses
82Dotted decimal Notation
- 202.14.13.1
- 192.133.13.5
- Each 8 bit block is written as its decimal eqvt.
83IP Addresses (2)
84Routing Tables
- Routing tables at each router has two types of
entries - (network,0)
- (this network, host)
- Note the first type of entry. By keeping only the
network number and not all the IP addresses
belonging to a distant network, the size of the
routing table is greatly reduced.
85Problems in Class based Addressing
- What to do when the network grows beyond the
current maximum. - Solution To allow a network to be split into
several parts (called subnet) for internal use
but appear to be a single network to the outside
world. - Note The word subnet has been used again now
to define a different context. The difference
will be clear from the context.
86Subnets
- A campus network consisting of LANs for various
departments.
87Subnets (2)
- A class B network subnetted into 64 subnets.
88Routing Tables
- Routing tables at each router now has three types
of entries - (network,0)
- (this network, subnet, 0)
- (this network, subnet, host)
89CDR Classless InterDomain Routing
- A set of IP address assignments.
5-59
90IP Addresses are scarce
- Most of the people are opting for broadband
Internet Connection i.e. a permanent IP address - One solution IPV6 128 bit address, but it
will take years to come. - A quick solution is needed NAT
91NAT Network Address Translation
- Placement and operation of a NAT box.
92Three reserved ranges of IP addresses for
Internal Use
- 10.0.0.0 -- 10.255.255.255/8
- 172.16.0.0 172.31.255.255/12
- 192.168.0.0 192.168.255.255/16
- For example Delhi University Intranet
- IP addresses are of the form 10.25.2.23
- Gateway 10.25.1.4
- DNS 10.2.1.13, 10.2.1.16
93Working of NAT
- Before a packet from internal host exits the
company (connected to ISP through say a leased
line) as shown in the figure or - a packet from a home/ business user connected
through broadband to ISP exits ISP - local IP address (10.x.y.z etc) is mapped to the
company's/ ISP' s true IP address and sent out. - What when a packet comes from Internet? How does
a router decide whom to hand it over to?
94NAT contd..
- NAT must remember the internal addresses. How?
- It uses Header of the Transport Layer.
- Source Port field is replaced by a pointer to an
entry in a table (maintained by NAT box)
containing the local address. - How does it remember the Source Port then?
- The table entry contains the source port also,
which is copied into the destination port on
return.
95Other Network Layer Protocols used in Internet
Internet Control Protocols
- ICMP Internet Control Message Protocol used
by the routers to monitor the Internet for
unexpected events, and also to test the Internet
from time to time. - ARP Address Resolution Protocol maps an IP
address to a unique DLL address - RARP Reverse ARP DLL address to IP
- BOOTP, DHCP and others
96Internet Control Message Protocol
- The principal ICMP message types.
5-61
97ARP
- Although every machine on the Internet has one or
more IP addresses, they are not sufficient for
sending packets as the DLL h/w doesnt understand
the IP addresses. - How are IP addresses mapped to DLL addresses?
98ARP The Address Resolution Protocol
- Three interconnected /24 networks two Ethernets
and an FDDI ring.
99ARP How does it work
- Suppose H1 wants to send a packet to H2.
- It sends a broadcast packet (broadcast address in
the DLL address for destination) on its LAN
asking who owns the IP address 192.31.65.5? - Everyone on LAN1 gets it but only H2 replies with
its DLL address. - H1 now prepares the data packet meant for H2 and
sends it.
100ARP How does it work
- Now Suppose H1 wants to send a packet to H4.
- It sends a broadcast packet (broadcast address in
the DLL address for destination) on its LAN
asking who owns the IP address 192.31.63.8? - Everyone on LAN1 gets it but this time the router
replies with its DLL address. - H1 now prepares the data packet meant for H4 with
the DLL address of the router and sends it to the
router. - The process is repeated on the FDDI ring and so
on.
101DHCP Dynamic Host Configuration Protocol
- Maps DLL address to IP address
- When a diskless workstation boots from a remote
machine, how does it get its IP address?
Remember, - IP addresses are assigned in the s/w and,
- DLL address in h/w
- When a machine boots from a local OS it learns
its IP address from the settings already done
(settings in TCP/IP etc) but, - When it boots from a remote machine it gets the
binary image of its OS from a remote file server.
The IP address cannot be included in this binary
image for then a separate binary image will be
required to boot each host.
102DHCP contd..
- Such a host (say H1) asks a question My DLL
address is..Does anyone know my IP address? - Another machine running DHCP server responds back
with the IP address of H1. - DHCP Server maintains a table of (DLL address, IP
address) of the nodes it serves. - How does H1 get down (IP address of) to the DHCP
server? - If the DHCP server is on the same LAN as the host
H1, there is no problem - A broadcast packet from H1 is enough.
- However, if DHCP server is on a remote machine, a
machine called DHCP relay agent (who knows the IP
address of the DHCP server) is required on each
LAN. - DHCP relay agent relays the packet from H1 to the
DHCP server and back.
103Dynamic Host Configuration Protocol
104Routing Protocols in Internet
- OSPF Open Shortest Path First (Interior Gateway
Protocol) - BGP Border Gateway Protocol (Exterior Gateway
Protocol)
105OSPF Open Shortest Path First Interior Gateway
Protocol
- Routing algorithm within an AS
- Initially when As were small .. A variant of
DVR(RIP) was used. - DVR suffered from count to infinity problem and
was replaced by Link State Routing algorithm in
1979.
106OSPF Basic form
- AS is small same as LSR.
- To understand OSPF lets see how an AS looks like
AS is a collection of routers and networks.
107OSPF hierarchical structure when ASes became
large
- When ASes became large they were further divided
into areas - Each area is a collection of networks and routers
now.
108OSPF works in an AS
- Three types of Routers
- Internal routers (used for routing within an area
hence keep the Link State Database for routers
within an area and run Shortest Path Algorithm
locally ) - Area border routers (Inter-area routing through
backbone routers, keeps the LSDB for all the
areas(2 areas in case of non-backbone area
router and may be more than 2 areas for a
backbone area router) each is connected to and
runs a possibly different SPA for each area
separately. - Backbone routers could be internal or area
border routers of Area 0
109OSPF - Hierarchical Structure
The relation between ASes, backbones, and areas
in OSPF.
110OSPF Hierarchical Structure contd..
111Internal Routers
- These are routers that are only connected to
other routers or networks within a single area.
They maintain an LSDB for only that area, and
really have no knowledge of the topology of other
areas.
112Area Border Routers
- These are routers that connect to routers or
networks in more than one area. They maintain an
LSDB for each area of which they are a part. They
also participate in the backbone.
113Backbone Routers
- These are routers that are part of the OSPF
backbone. By definition, this includes all area
border routers, since those routers pass routing
information between areas. - However, a backbone router may also be a router
that connects only to other backbone (or area
border) routers, and is therefore not part of any
area (other than Area 0). - Back
114BGP Border Gateway ProtocolExterior Gateway
Protocol
- Issues
- No transit traffic thru certain Ases
- Never put Iraq on a route starting at Pentagon
- DO not use US to get from British Coumbia to
Ontario - Only transit Albania if there is no alternative
to the destination - Traffic starting or ending at IBM should not
transit Microsoft - These kind of issues cannot be solved by
computing the Shortest Path trees.
115BGP cntd
- BGP is basically a DVR protocol.
- However it maintains and advertise the entire
path. - Since choice of entire paths are available ..
decisions around the routers can be taken on a
datagram basis. - Hence, it takes care of the count to infinity
problem also.
116BGP contd..
- (a) A set of BGP routers. (b) Information
sent to F.
117The Main IPv6 Header
- The IPv6 fixed header (required).
118Extension Headers
5-69
119Extension Headers (2)
- The hop-by-hop extension header for large
datagrams (jumbograms).
120Extension Headers (3)
- The extension header for routing.