# Chapter 5: Network Layer

## Presentation on theme: "Chapter 5: Network Layer"— Presentation transcript:

Chapter 5: Network Layer
CS455/555

Network Layer: Design Issues
Services provided to the Transport Layer: Connection-oriented vs Connectionless service Underlying network: Internet (connectionless) and ATM ( Connection-oriented) Virtual circuits vs. datagrams

Routing Algorithms Objective: Route packets from source to destination. At a given node, it decides which output line an incoming packet should be sent. Desirable properties: Correctness, simplicity, robustness, stability, fairness, and optimality. Goals: Maximize network throughput and minimize mean packet delay Optimality principle

Routing algorithms (Cont.)
Shortest path routing Graph: Routers and nodes and links connecting the routers are the edges. Edges of the graph may represent a hop, the mean delay, the distance, cost, traffic flow, etc. Dijkstra’s shortest path algorithm: To find the shortest path and distance from a source node to all other nodes in a graph. Initially, only the source node has a permanent label. In each iteration, one other node is assigned a permanent label.

Routing algorithms (Contd.)
Flooding: Every incoming packet is sent out on every outgoing link. Of course, don’t send a packet to a node from which it is received. Keep a count in the packet to limit the number of nodes it may visit during its life time to avoid infinite looping. Uses: (i) When highly reliable communication is needed (ii) As a baseline for other algorithms to compare with in terms of shortest delay.

Flow-based Routing Assuming that the capacity (Cij) and flow (Fij) along all the links in a network are known, path with a shortest delay can be determined. T = 1/(mC-L) where C is capacity in bps, L is arrival of packets/sec, 1/m is the average number of bits per packet. By trying out different possible paths, minimal routing can be determined

Routing algorithms (contd.)
Distance vector routing: Each router maintains a vector giving the best known distance to each destination and which outgoing link to use next. The vectors are periodically exchanged among the neighbors. The local vector is modified after receiving information from neighboring routers. Count-to-infinity problem: Reacts rapidly to good news but leisurely to bad news.

Routing algorithms Link State Routing: Replaced distance vector routing. Steps: Each router must (1) Discover its neighbors and learn their network addresses. (2) Measure the delay or cost to each of its neighbors. (3) Construct a packet telling all it has learned. (4) Send this packet to all other routers. (5) Compare the shortest path to every other router.

Routing algorithms (Cont.)
Hierarchical routing: When network size os large, the routing tables also are large. One way to solve the problem is by dividing the network into regions. Routers within a region would know only about nodes in their region. There will be one or more nodes that are connected to other regions. Thus a node also has hierarchical table indicating which internal node it has to route a message for a given destination region.

Routing algorithms (Cont.)

CONGESTION CONTROL ALGORITHMS
When too many packets are present in a subnet or a part of it, performance degrades. This is called congestion. Causes of congestion: (1) When a stream of input packets arrive to go on the same outgoing link, packets may be lost due to insufficient buffer size on that queue. But “Nagle discovered that infinite amount of memory at routers may lead to worsening of congestion.” (2) Slow processors (Mismatch is always a problem) (3) “Congestion tends to feed upon itself and become worse.”

CONGESTION CONTROL ALGORITHMS (Contd.)
Flow control vs. Congestion control: Flow control deals with point-to-point traffic---fast sender and slow receiver.This usually achieved by a feedback from receiver to sender (e.g., ACKs in sliding window protocols). Congestion control is more global and is concerned about the ability of the subnet to carry out its tasks.

CONGESTION CONTROL ALGORITHMS (Contd.)
General principles of congestion control: Approaches (1) Open-loop (2) Closed-loop Open loop solutions rely on good designs to make sure that congestion does not occur in the first place. Closed-loop solutions rely on feedback control---(1) Monitor subnet for any congestion. (2) Pass the congestion information to places where action can be taken. (3) Adjust the system operation to correct the problem.

CONGESTION CONTROL ALGORITHMS (Contd.)
What to monitor? % of all packets discarded for lack of buffers, average queue lengths, the # of packets that timeout and are retransmitted, the average packet delay, and the standard deviation of packet delay. Who to inform? (1) Sources can be informed via control messages---this further increases network load; (2) A router puts a flag in all its outgoing packets of the impending congestion (3) Host or routers send explicit control packets to know about congestion Explicit feedback vs implicit feedback

CONGESTION CONTROL ALGORITHMS (Contd.)
Congestion prevention policies: Open-loop systems: (I) Data link layer: retransmission policy, out-of-order caching policy, ACK policy, flow control policy (ii) Network layer: VC vs. datagrams inside the subnet, packet queueing and service policy, packet discard policy, routing algorithms, packet lifetime management (iii) Transport layer: retransmission policy, out-of-order caching policy, ACK policy, flow control policy, timeout determination

CONGESTION CONTROL ALGORITHMS (Contd.)
Traffic shaping: Open loop method: To force packets to be sent at more predictable rate and reducing the effect of bursty traffic. Traffic shaping vs. sliding window protocol Agreement between traffic carrier and user Traffic policing Leaky bucket and token bucket algorithms

CONGESTION CONTROL ALGORITHMS (Contd.)
Leaky bucket: (1) A fixed capacity bucket (2) The output from the bucket is at a constant rate (3) When bucket overflows, information is lost. It can be thought of a single server queue with finite buffer and constant service time. Assuming constant packet (or cell sizes as in in ATM), it can be implemented as finite queue of buffers with one packet being serviced at each tick and put on the network.

CONGESTION CONTROL ALGORITHMS (Contd.)
Example of Leaky bucket algorithm: A source generates data in terms of bursts: 3 MB bursts lasting 2 msec once every 100 msec. The network offers a bandwidth of 60 MB/sec. Thus the leaky bucket can have an output rate of 50 MB/sec. The leaky bucket has a capacity of 4 MB. How does the output look like? Input: 0-2 msec: 1500 MB/sec; msec: 1500 MB/sec; msec: 1500 MB/sec; … Output: 0-50 msec: 60 M/sec; msec: 60 MB/sec; ….

CONGESTION CONTROL ALGORITHMS (Contd.)
What should be the capacity of the leaky bucket to avoid loss? The burst cannot be held and hence there will be an overflow. How much is lost? During the burst, data inflow is at the rate of 1.5 MB/msec and the outflow is at the rate of 0.6 MB/msec. So accumulation is at the rate of 0.9 MB/msec. So at the end of 2 msec, there will be an accumulation of 1.8 MB. This is the minimum leaky bucket capacity to avoid buffer overflow and hence data loss.

CONGESTION CONTROL ALGORITHMS (Contd.)
Token bucket algorithm:Leaky bucket has a stringent outflow rate. A more flexible approach is the token bucket algorithm.Here, the overall rate is controlled rather than a fixed outflow rate all the time. Token bucket has a capacity indicating the maximum unused token that may be outstanding at any given instant. Tokens arrive into the bucket at a constant rate. Data can flow out of the bucket at a maximum rate limited by the network bandwidth as long as the bucket is not empty.

CONGESTION CONTROL ALGORITHMS (Contd.)
Token bucket example: Bucket capacity = 1 Mbytes Token arrival rate = 2 Mbytes/sec Network capacity: 10 Mbytes/sec Application produces 0.5 Mbyte burst every 250 msec. For 3 seconds Initially, output can be at the rate of 10 Mbytes/sec. But how long does this prevail? X seconds 1 + 2X = 10X; 8X = 1; X = 1/8 sec =125 milliseconds. During this time, it can transmit 1.25 Mbytes. But the burst size is not that much. So this will continue until the 0.5 Mbytes is sent. This takes 0.05 seconds or 50 milliseconds Output: msec: 10 Mbytes/sec msec: None By the time the next burst arrives, how many tokens will be accumulated? 2*200/1000 = 0.4 Mbytes of tokens How long with the next burst last? X = 10 X; X = 0.4/8= 50 msec. Output: msec: 10 Mbytes/sec This will continue for 3 seconds.

Congestion Control Alg. (Contd.)
Flow Specifications Congestion control in virtual circuit subnets---admission control Choke packets---VC and datagrams; when the utilization of an output line exceeds a threshold, a router sends a choke packet to the source host---reduce exponentially and increase in small increments Weighted Fair Queueing: A queue is maintained for each source host at an output queue; packets are selected in a round-robin fashion; different weights for different sources Hop-by-hop Choke Packets---quick relief

Congestion Control Algorithm
Load shedding: Wine (old packet is worth more) and milk (new packet is worth more); Low priority and high priority specified by the host Jitter control RSVP—Resource Reservation protocol for multicast routing

INTERNETWORKING Deals with connecting subnets of different type
Networks may differ in : service offered, protoocls, addressing, multicasting, packet size, QoS, error handling, flow control, congestion control, security, parameters (e.g., timeouts), accounting Concatenated virtual circuits: Several VCs are set up and connected Connectionless internetworking Tunneling (Multiprotocol router) Internetwork routing---interior gateway protocol and exterior gateway protocol Fragmentation---transparent, nontransparent Firewalls: Two routers + application gateway(s)

The Network Layer in the Internet
High-speed backbones, regional networks, local LANs IP or Internet protocol at the network layer Typically, when a message is fragmented along the way, the network layer at the host reassembles them. IP Protocol: See Fig for IP header format: Minimum 5 words (32-bit) maximum 15 words

The Network Layer in the Internet (Cont.)
Fields in the IP Header: Version, lheader length, type of service (T/D/R), Total length, Identification (unique for each datagram), DF, MF, fragment offset, time to live, Protocol (transport level), header checksum, source address, destination address, options

The Network Layer in the Internet (Cont.)
IP Addresses: Every host and router on the Internet has an IP address: network number + host number Class A, B, and C: Depending on the environment: Few networks/many hosts, medium Nw/medium hosts, many networks/few hosts Class D- Multicast address 4-byte (32 bit) addresses Each byte is separated from the other by a DOT (.). Hexadecimal address  DOT notation (take two characters at a time and convert to a decimal number (0-255).

The Network Layer in the Internet (Cont.)
Dividing host address into <subnet, host> pair; what the NIC gives is the network address. Each router has a table listing some with (network,0) entries and some with (this-network, host) IP addresses. With subnets, entries are (this-network, subnet,0) and (this-network, this-subnet, host), and (network,0)

The Network Layer in the Internet (Cont.)

The Network Layer in the Internet (Cont.)
IPv4 (current standard): IP is running out of addresses. IPv6: (1) Extend the address space to billions of hosts (2) Security (3) Reduce routing table sizes (4) QoS (5) Coexistence of old and new protocols (see page 437 for a complete list)

The Network Layer in the Internet (Cont.)
Improvements due to IPv6 (over IPv4): Address is 16 bytes rather than 4 bytes Simplified header (40-byte): version, priority, flow label, payload length, next header, hop limit, source/destination addresses Better specification of options Security: Authentication and privacy Flow label for QoS is much larger than 2 bytes in IPv4 Different prefixes for an IPv6 address meant different things (page 441)

IPv4 vs. IPv6 No checksum: For better performance. Assumes that other layers will have their own. No fragmentation field: The fragmentation responsibility is with the host and not with a router No IHL field: Fixed length headers Extension headers (next header field): See pages for more details

The Network layer in ATM Networks
The ATM layer in the ATM reference model (page 63) functions as a network layer: end-to-end VC, switching, and routing; connection-oriented. Virtual channel is the basic VC which connects a source with a destination Virtual path A group of VCs from one a given source to a given destination Does not provide any ACK Within a VC ordering is guaranteed but cells could be dropped

The Network layer in ATM Networks (cont.)
ATM cell: 5-byte header + 48-byte payload Interfaces: ATM-ATM (NNI); User-Network (UNI) NNI: VPI+VCI+PTI+CLP+HEC UNI: GFC (not used)+VPI+VCI+PTI+HEC AAL might use some of the 48-byte payload

The Network layer in ATM Networks
ATM Connection setup: Permanent vs. switched VCs; part of the control panel on top of ATM layer First setup a signaling VC and then use this channel to negotiate: Several <setup, call proceeding> pairs followed by a series of <Connect, connect ACK>; uses a routing algorithm to determine the path Routing and switching: Uses only VPI and not VCI VPI helps reduce the routing table length, speeding-up connection set up, and switching a route in case of a congestion Routing table example: See Fig. 5-67

The Network layer in ATM Networks
Service categories: CBR, VBR (RT and Non-RT), ABR (specifies minimum but could vary and may have loss rate), UBR Figure 5-70 summarizes the four categories Quality of service Contract:Traffic to be offered, service agreed upon, and compliance requirements QoS parameters: See Figure 5-71

Traffic Shaping and Policing
GCRA or generic-cell-rate algorithm: Inputs T (the period) and L (leeway) where T=1/PCR or peak-cell rate Congestion control: (1) Admission control---to prevent congestion (2) Resource reservation---related to admission control (3) Rate-based congestion control: A special RM cell is sent by the sender periodically to examine the status;