You are on page 1of 120

Network Layer

The context

Store and Forward Packet Switching

A packet is stored in entirety, checksum recomputed at every hop and forwarded.

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

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

CL 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

Implementation of CL

Packets are called datagrams and the subnet is called datagram subnet.

Implementation of Connectionless Service


Routing within a diagram subnet.

Implementation of Connection-Oriented Service


Routing within a virtual-circuit subnet.

Comparison of Virtual-Circuit and Datagram Subnets

5-4

Comparison of Virtual-Circuit and Datagram Subnets

5-4

Routing 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

Equilibrium

Fairness Vs Optimality
Conflict between fairness and optimality.

Routing Algorithms : Adaptive or Non-adaptive

Non-adaptive : Static

Adaptive : Dynamic

Routing 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

The Optimality Principle


(a) A subnet. (b) A sink tree for router B.

Shortest Path Routing: Static


The first 5 steps used in computing the shortest path from A to D. The arrows indicate the working node.

Flooding
Problems : Jamming/Congestion Solutions : 1. Hop count in the header 2. Sequence number for every source : discard duplicate packets. Adv: Though not practical for routine routing but useful when a system starts afresh.

Distance Vector Routing : Dynamic


(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.

Distance Vector Routing (2)

The count-to-infinity problem.

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

Discovering the neighbours

Send a HELLO packet

The other router sends a reply telling who he is

Problem
(a) Nine routers and a LAN. (b) A graph model of (a).

Measuring the delay to neighbours

Send an ECHO packet The receiver sends it back immediately with a time stamp

Building Link State Packets

(a) A subnet. (b) The link state packets for this subnet.

Distributing the Link State Packets


Packets are flooded, Seq no.s to check jamming

Distributing the Link State Packets


The packet buffer for router B in the previous slide (Fig. 5-13).

Hierarchical Routing
Hierarchical routing.

Broadcasting 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

Approximates the behaviour of Spanning tree algo .. When routers have no knowledge of spanning trees.

Reverse path forwarding

Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding.

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

Multicast Routing in the subnet

MR sending a message to members within a group

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

Congestion Control

What is congestion?

Too many packets in a part of the subnet, too many to handle.

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

Causes of congestion

Slow processors: If the computational powers of a router are weak, it will take time in bookkeeping 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.

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

Open Loop Solutions

Policy-Decisions at various levels

Congestion Prevention Policies


Policies that affect congestion.
5-26

Open 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

Closed 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

Congestion Control in Virtual-Circuit Subnets

Admission Control : No more new VCs Allow new VCs but route them around the problem area.

Congestion Control in Virtual-Circuit Subnets

(a)

A congested subnet. (b) A redrawn subnet, eliminates congestion and a virtual circuit from A to B.

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

Hop-by-Hop Choke Packets


(a) A choke packet that affects only the source.
(b) A choke packet that affects each hop it passes through.

Load 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

Internetworking

Connecting 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

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

Connecting Networks
A collection of interconnected networks.

How Networks Differ

5-43 Some of the many ways networks can differ.

How Networks Can Be Connected


(a) Two Ethernets connected by a switch. (b) Two Ethernets connected by routers.

Concatenated Virtual Circuits

Internetworking using concatenated virtual circuits.

Connectionless Internetworking

A connectionless internet.

Tunneling
Tunneling a packet from Paris to London.

Tunneling (2)
Tunneling a car from France to England.

Autonomous System

Each network in an Internet is independent and hence it is called an Autonomous System.

Internetwork Routing
(a) An internetwork. (b) A graph of the internetwork.

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

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

Fragmentation

(a) Transparent fragmentation. (b) Nontransparent fragmentation.

Fragmentation (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

The 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

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

Collection of Subnetworks

The Internet is an interconnected collection of many networks.

The IP Protocol
The IPv4 (Internet Protocol) header.

IP Protocol contd..

Version IHL Type of Service Total Length, Identification, DF, MF, Fragment Offset TTL Protocol Header Checksum Options

Version Number

To let several versions to work simultaneouslyactually two during a transition period which takes years.

IP Protocol contd..

IHL : 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..

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

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

Other 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 2^13=8192 Total Datagram : 8192 * 8. IP Protocol contd..

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

Protocol

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.

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

Some of the IP Options


.
5-54

IP Addresses : 32 bit number

Assigned by central naming authority ICANN: Internet Corporation for Assigned Names and Numbers

IP Addresses
IP address formats.

Dotted decimal Notation


202.14.13.1 192.133.13.5

Each 8 bit block is written as its decimal eqvt.

IP Addresses (2)
Special IP addresses.

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

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

Subnets
A campus network consisting of LANs for various departments.

Subnets (2)

A class B network subnetted into 64 subnets.

Routing Tables

Routing tables at each router now has three types of entries:

(network,0) (this network, subnet, 0) (this network, subnet, host)

CDR Classless InterDomain Routing


A set of IP address assignments.
5-59

IP 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

NAT Network Address Translation


Placement and operation of a NAT box.

Three 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

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

NAT 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

Other 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

Internet Control Message Protocol


The principal ICMP message types.
5-61

ARP

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?

ARP The Address Resolution Protocol


Three interconnected /24 networks: two Ethernets and an FDDI ring.

ARP: 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.

ARP: 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.

DHCP: 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.

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

Dynamic Host Configuration Protocol


Operation of DHCP.

Routing Protocols in Internet

OSPF: Open Shortest Path First (Interior Gateway Protocol) BGP: Border Gateway Protocol (Exterior Gateway Protocol)

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

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

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

OSPF 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

OSPF - Hierarchical Structure

The relation between ASes, backbones, and areas in OSPF.

OSPF Hierarchical Structure contd..

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

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

Backbone 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

BGP Border Gateway Protocol Exterior 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.

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

BGP contd..
(a) A set of BGP routers. (b) Information sent to F.

The Main IPv6 Header

The IPv6 fixed header (required).

Extension Headers
5-69

IPv6 extension headers.

Extension Headers (2)

The hop-by-hop extension header for large datagrams (jumbograms).

Extension Headers (3)

The extension header for routing.

You might also like