network layer

120
Computer Networks & Internetworking Layers Prepared by: Reshma Dayma

Upload: reshmadayma

Post on 18-Jul-2015

40 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Network Layer

Computer Networks &Internetworking Layers

Prepared by: Reshma Dayma

Page 2: Network Layer

Network layer

Network layer is responsible for getting the packets from source to destination.

To deliver the packet, network layer must know about the topology of network and choose appropriate path among it.

Every layer in protocol stack provides service to layer above it, in this regard, network layer uses service provided by data link layer and gives service to transport layer.

Page 3: Network Layer

Store & Forward Packet Switching

The environment of the network layer protocols.

Page 4: Network Layer

Services to Transport Layer

Network layer provides two types of services to transport layer.

o Connection oriented service

o Connectionless service

Service provided by network layer need to meet following goal.

o Service should be independent of router technology.

o Transport layer should be shielded from number, type and topology of routers present.

o Network address available at transport layer should use uniform numbering plan.

Page 5: Network Layer

Implementation of Connectionlessservice

Connectionless communication is just packet switching where no connection(path) establishment and release occur.

A message is broken into packets, and each packet is transferred separately. The packets can travel different route to the destination since there is no connection.

Here packets is called datagrams and network is called datagramnetwork.

Page 6: Network Layer

Implementation of Connectionlessservice

Routing within a diagram subnet.

Page 7: Network Layer

Implementation of Connectionlessservice

The algorithm that manages routing table and makes routing decision is called routing algorithm.

IP (Internet Protocol) is dominant example of a connectionless service.

Each packet carries destination IP address that router uses to forward the packet individually.

Page 8: Network Layer

Implementation of Connection-orientedservice

In connection oriented service, a connection (path) from source to destination must be established before any data packet can be sent.

A virtual circuit, sometimes called a logical circuit, is a path between two or more points that seems like a fixed physical path, but actually is one path out of many possible physical paths that can be arranged.

This connection is called virtual circuit and network is called virtual circuit network.

Page 9: Network Layer

Implementation of Connection-orientedservice

Routing within a virtual-circuit subnet.

Page 10: Network Layer

Implementation of Connection-orientedservice

In figure, router A assigns different connection identifier to each outgoing packet of second connection. This process is called label switching.

Example of connection oriented service is MPLS(Multiprotocol label switching).

Page 11: Network Layer

Comparison

Page 12: Network Layer

Routing Algorithms

Main function of network layer is to route the packet from source machine to destination machine.

Routing algorithm is part of network layer software responsible for deciding which output line should be use to deliver the packet to destination.

If network uses virtual circuit, decision of routing are made when circuit is being set up.

If network uses datagram, then routing decision need to make for each arriving packet.

Certain properties are desirable in routing algorithm like, correctness, simplicity, robustness, fairness, stability, efficiency.

Page 13: Network Layer

Routing Algorithms

Correctness: The routing should be done properly and correctly so that the packets may reach their proper destination.

Simplicity: The routing should be done in a simple manner so that the overhead is as low as possible. With increasing complexity of the routing algorithms the overhead also increases.

Robustness: Once a major network becomes operative, it may be expected to run continuously for years without any failures. The algorithms designed for routing should be robust enough to handle hardware and software failures and should be able to cope with changes in the topology and traffic without requiring all jobs in all hosts to be aborted and the network rebooted every time some router goes down.

Stability: The routing algorithms should be stable under all possible circumstances.

Fairness: Every node connected to the network should get a fair chance of transmitting their packets. This is generally done on a first come first serve basis.

Efficiency: The routing algorithms should be optimal in terms of throughput and minimizing mean packet delays. Here there is a trade-off and one has to choose depending on his suitability.

Page 14: Network Layer

Routing Algorithms

Routing algorithms are grouped into two classes:

Adaptive algorithm.

Non adaptive algorithm.

Non adaptive algorithm do not change their routing decision on base of current topology and traffic. Routes are computed in advance and loaded into router. These procedure is also called static routing.

Adaptive algorithm changes their routing decision to reflect current topology and traffic. These algorithm are also called dynamic routing algorithm.

Page 15: Network Layer

Optimality Principle

Optimality Principle says if a router J is on optimal path from router I to K, then optimal path from router J to K also falls among same route.

Set of optimal routes from all source to given destination forms a tree routed at the destination. Such a tree is called sink tree.

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

Page 16: Network Layer

Shortest Path Algorithm

Shortest path algorithm works on graph of network, each node in graph represents router and each edge represents a communication link.

To choose route between given source and destination, this algorithm finds shortest path between them.

Number of hopes, geographical distance, delay are some of the criteria on base of which, algorithm finds shortest path.

One of algorithm to find shortest path is given Dijkstra.

Page 17: Network Layer

Shortest Path Algorithm

In Dijkstra shortest path algorithm, each node is labelled with distance from source and previous node.

Initially, when path are not known, all the node(router ) are labelled with infinity. As the algorithm progress, labels may change reflecting a better path.

A label may be tentative or permanent.

Initially all the labels are tentative, when it is found that the tentative label represents shortest possible path from source, it is made permanent.

Page 18: Network Layer

Shortest Path Algorithm

Page 19: Network Layer

Shortest Path Algorithm

Dijkstra’s algorithm to compute the shortest path through a graph.

Page 20: Network Layer

Shortest Path Algorithm

Dijkstra’s algorithm to compute the shortest path through a graph.

. . .

. . .

Page 21: Network Layer

Shortest Path Algorithm

Dijkstra’s algorithm to compute the shortest path through a graph.

. . .

Page 22: Network Layer

Example1

5

0

2

3

4

6

2

4

21

3

4

2

3

2

1

Page 23: Network Layer

Flooding

Flooding is also a routing technique in which every incoming packet is sent to every out going line except the line from which it arrived.

Flooding generates vast number of packet and some measures are required to control this process.

One solution is hop count, every packet contains hop count, this hop count decreases at each hop packet reach.

When the hop count of packet becomes zero, packets is discarded. In this way number of packets are controlled while flooding.

Hop count should be initialize to the length of path from source to destination.

If sender does not know about path length, it can be initialized with diameter of network.

Page 24: Network Layer

Flooding

Page 25: Network Layer

Flooding

Another solution to control the packet is to keep a record of which packets have been flooded.

For this, sender inserts contains sequence number in packet and every router keeps list of packets per source those have been flooded.

if incoming packet’s sequence number is in list, it will not be flooded.

Flooding is not practical for use, but it have some advantage.

o It ensures that packet is delivered to every node, so it can be used for broadcasting.

o In military network, it makes sure that packet gets delivered if the path exists.

oFlooding always chooses shortest path and gives minimum delay(if overhead due to flooding is ignored).

Page 26: Network Layer

Distance Vector Routing

Distance vector routing is dynamic routing algorithm.

Distance vector routing is also called distributed bellman-ford routing algorithm.

In Distance vector routing algorithm, each router maintains a table (vector) that stores best known distance for each router in network and link to use to reach there.

Router is assumed to know the distance to each of its neighbor.

Distance may be measured in term of number of hop, delay or other metric.

These tables are updated by exchanging information with neighbor routers

Page 27: Network Layer

Distance Vector Routing

Assume that delay is used as metric and router knows delay to each of its neighbor.

Router measures delay to neighbor by sending ECHO packet, receiver just timestamp the packet and sends back the packet as fast as possible.

Once every T msec, each router sends each neighbor the list of estimated delay to each destination.

It also receive same list from each its neighbor.

Assume router A has receive list from B,C. router A knows delay to its neighbor B and C, delay is AB and AC. BD is delay from B to D.

delay from A to D would be calculated like

AD = AB+BD

• Similarly distance to D is calculated using every neighbor and minimum distance is chosen.

Page 28: Network Layer

Distance Vector Routing

(a) A network.

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

Page 29: Network Layer

Count to Infinity problem

The settling of routes to best path across the network is called convergence.

DVR has drawback, although it converges to correct answer but it may do slowly.

React rapidly to positive news, leisurely to bad one.

Suppose router A has long route to destination X. but in next exchange if router B report short path, router A will switch to B to go to X.

Page 30: Network Layer

Count to Infinity problem

The count-to-infinity problem

Core Problem is when X tells Y that it has path somewhere, Y has no way to know weather it itself is on the path.

Page 31: Network Layer

Link State Routing

Link state routing is also a dynamic algorithm. It has following five steps procedure.

1) Discover neighbor and learn network addresses.

2) Set the distance or cost metric to each of its neighbor.

3) Construct the packet which contains distance to its neighbor.

4) Send this packet to and receive packets from all other routers.

5) Compute the shortest path to every other router.

Page 32: Network Layer

Link State Routing

Learning about the Neighbor

When a router a booted, first of all it learns who its neighbor are, this goal is accomplished by sending HELLO packet on point-to – point line.

Receiver router is expected to send a reply giving its name.

Page 33: Network Layer

Link State Routing

Setting Link Cost

• Link state routing requires each line to have a cost for finding shortest path.

• Cost to neighbor can be calculated automatically, a common choice is to make cost inverse of bandwidth.

• Other way to determine delay is to send a ECHO packet. Receiver router will send it back immediately.

• By measuring Round Trip Time(RTT), dividing it by two, sending router can get a estimated delay.

Page 34: Network Layer

Link State Routing

Building State Packet

Once the information needed is collected, next step is to build the packet containing all the data.

Packet start by identity of sender, sequence number, age and list of neighbor along with distance to that neighbor.

Packets are build periodically or when some significant event occurs.

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

Page 35: Network Layer

Link State Routing

Distributing Link State Packets

All of the routers in network must get link state packet.

Flooding is used to distribute link state packets.

To keep check, each packet contains sequence number, sequence number is incremented for every new packet sent from source router.

Routers keep information, source router, max sequence number seen.

When a new packet arrives at any routers, it checks its sequence number against highest sequence number seen, if packet is having is lower seq. number means its already flooded so it is discarded otherwise it is flooded.

Age of each packet decrements once per second. When age reach to zero, packet will be discarded.

Due to age, packet will not be for infinite period of time.

Page 36: Network Layer

Link State Routing

There are few problem with algorithm. First is if sequence number wrap around, confusion will occur. Solution is to use 32 bit sequence number.

Second is if router ever crashes, it will lose track of sequence number sent. So it will start from 0 and packet will be rejected as duplicate.

Third is if sequence number ever corrupted. For example in case of 1 bit error packet number 4 will be received as 65540. so all the packet from 5 to 65540 will be rejected.

Page 37: Network Layer

Link State Routing

The packet buffer for router B

Page 38: Network Layer

Link State Routing

Computing the New Routes

Once router has a full set of packet, it will construct entire network graph.

Dijkstra algorithm can be used to construct shortest path to all possible destination. this information is installed to routing table.

Compare to distant vector routing, link state requires more memory and computation.

Page 39: Network Layer

Hierarchical Routing

As network grows, routing table grows in size. So not only router memory, more CPU time to process the entry also requires.

At certain point , network may grow to point, where it is not longer feasible to have entry for every other router.

Solution is to have hierarchical routing.

In hierarchical routing, routers are divided into regions. Each routers knows all about destination within its own regions and nothing about internal structure of other region.

Page 40: Network Layer

Hierarchical Routing

Hierarchical routing.

Page 41: Network Layer

Hierarchical Routing

Page 42: Network Layer

Hierarchical routing.

if there are 720 routers and they are divided into 24 regions, each contains 30 routers then how many entry will be there in each router?

If three level hierarchy is chosen, 8 clusters each contains 9 regionsand each regions contains 10 routers, then number of entry will be

= 10 entry of each router in same region + 8 entry to route to other region in same cluster + 7 entry for other clusters.

= 25 entries.

optimal number of levels for N router network is ln N.

Page 43: Network Layer

Broadcast Routing

In some application, hosts need to send messages to many or all other host.

Sending a packet to all destination simultaneously is called broadcasting.

One method is that source send a distinct packet to each destination. It wastes bandwidth and slow.

Another is multi-destination routing.in this, each packet contains entire list of destination.

When packet comes at router, it finds line for all destination. Then router generates new copy of packet for each output line, that packet contains only those list of destination that are to use that line.

Eventually after some hopes, each packet will carry only one destination like normal packet.

Requires less bandwidth but much work from router.

One more method is flooding.

Page 44: Network Layer

Broadcast Routing

Reverse Path Forwarding

Router checks whether broadcast packet arrived on interface that is used to send packets to source of broadcast.

If so, it’s likely that it followed best route and thus not a duplicate; router forwards packet on all lines.

If not, packet discarded as likely duplicate.

Page 45: Network Layer

Broadcast Routing

Reverse path Forwarding

Page 46: Network Layer

Broadcast Routing

Spanning Tree Routing

Use spanning tree (sink tree) rooted at broadcast initiator.

No need for destination list.

Each router forwards packets on all lines on the spanning tree (except the one the packet arrived on).

Efficient but needs to generate the spanning tree and routers must have that information.

Page 47: Network Layer

Broadcast Routing

Spanning Tree Routing Example

Page 48: Network Layer

Multicast Routing

Sending a message to group is called multicast. Routing algorithm used is called multicast routing.

If group is dense, then broadcast using spanning tree is good option. But broadcast will deliver the packets to some of member that are not part of group. Which is waste of bandwidth.

Another option is to prune “broadcast spanning tree” by removing links that do not leads to group member. This is called “multicast spanning tree”.

Multicast spanning tree is used to deliver a packet to a group.

Page 49: Network Layer

Multicast Routing

(a) A network. (b) A spanning tree for the leftmost router.

(c) A multicast spanning tree for group 1. (d) A multicast spanning tree for group 2.

Page 50: Network Layer

Multicast Routing

Different ways of pruning spanning tree are possible.

One is if link state routing is used, each router knows about complete topology of network including which host belong to which group.

Each router construct sink tree for each host in network, prunes that tree for each of the group.

with distance vector routing, reverse path forwarding approach is followed. Whenever router that is not part of group receives multicast message for that group. It replies with PRUNE message.

In this way spanning tree is recursively pruned.

Disadvantage of multicast spanning tree is that routers requires lots of work and memory.

For n groups and m nodes, at each router, for each group m pruned trees must be stored. Total m*n tress need to be stored.

Page 51: Network Layer

Multicast Routing

Another approach is core based tree, that computes single spanning tree for group.

Here all the routers agrees on point called root(called core).

Tree is build by sending a packet from each member to root. tree is union of path traced by these packets.

To send packet to group, sender sends packets to core, then core forwards packet to all the member.

Page 52: Network Layer

Multicast Routing

(a)Core-based multicast tree for group 1.(b)Sending to group 1.

Page 53: Network Layer

Multicast Routing

For performance optimization, packet is not necessary to reach to core before multicast.

Disadvantage of shared tree is that it is not optimal for all sources.

Advantage is that it saves memory and computation. Each router keeps only one tree per group.

Page 54: Network Layer

Routing for Mobile host

Mobile host are those that are not stationary, they moves from one location to another hence their network also keeps changing.

One approach is, in which when mobile host moves to new location, acquires new address, there will not be any association between old address and new address. In this model, old connection will not work on new address.

For example, host can do surfing, but mail or any connection orient service will lost the connection. And connection need to be establish again.

In this case, network layer mobility is required to solve problem.

Page 55: Network Layer

Routing for Mobile host

Basic idea used in internet and cellular network is that mobile host tells host at a home location where it is now. The host which act on behalf of mobile host is called home agent.

Home agent accepts packets on behalf of mobile host and forwards to it.

Page 56: Network Layer

Routing in ad hoc Networks

An Ad hoc network is a decentralized type of network.

The network is ad hoc because it does not rely on a pre existing infrastructure, such as routers in wired networks or access points in managed (infrastructure) wireless networks. Instead, each node participates in routing by forwarding data for other nodes, so the determination of which nodes forward data is made dynamically on the basis of network connectivity.

AODV (Ad hoc on-demand distance vector) routing algorithm is one of the most popular algorithm for ad hoc network.

Page 57: Network Layer

Ad hoc Networks

Infrastructure-based Networks traditional cellular systems (base station infrastructure)

Space divided into cells

A base station is responsible to communicate with hosts in its cell

Mobile hosts can change cells while communicating

Page 58: Network Layer

Ad hoc Networks

Mobile Ad Hoc Networks (MANET)

Host movement frequent

Topology change frequent

No pre existing infrastructure.

AB A

B

Page 59: Network Layer

Ad hoc Networks

Page 60: Network Layer

Routing in ad hoc Networks

AODV

Route discovery

In AODV, routes to destination is computed on demand. When someone wants to send packets to that destination.

at any time, topology of network is defined by graph of connected nodes.

Range of A’s Broadcast

Page 61: Network Layer

Routing in ad hoc Networks

(a) Range of A's broadcast.(b) After B and D have received A's broadcast.(c) After C, F, and G have received A's broadcast.(d) After E, H, and I have received A's broadcast.Shaded nodes are new recipients. Arrows show possible reverse routes.

Page 62: Network Layer

Routing in ad hoc Networks

Route Maintenance

In ad hoc network, nodes can be moved out of range any time.

To deal with the problem, algorithm periodically send “hello” packet to each neighbor.

If neighbor does not reply, means that neighbor is no longer connected, so all the routes that goes through that are removed from routing table.

Other neighbors are also informed about the same, they also remove route.

To save battery life and bandwidth, router will keep information only about the routes which are in use. Other routes learned during broadcast are timed out after some time.

Page 63: Network Layer

Congestion

When too many packets are presents in network, network will not able to deliver all the packet or packets are delayed. This situation is called congestion.

Goodput is rate at which useful packets are delivered by network.

Page 64: Network Layer

General principles of congestion control

Solutions of congestion control are divided into two groups.

open loop

closed loop

open loop approach are based on good design, they design policies such that congestion does not occur,

Closed loop solution are reactive. They monitor the network to find whether congestion has occurred or not. If it has take place then it steps to correct the situation.

1. monitor the system to detect when and where congestion occur.

2. pass the information to places where action can be taken.

3. adjust system operation to correct the problem.

Page 65: Network Layer

General principles of congestion control

To monitor network, various metrics are used like percentage of packet discarded, average queue length, number of packets time out, average delay of packet etc.

If congestion is detected, information about it sent from point where congestion occurs to the source of the traffic.

As the source receives the congestion notification, it will take action to reduce the congestion. One option is source cuts down the sending rate.

Closed loop algorithms are further divided into two group.

Explicit feedback algorithm

Implicit feedback algorithm

Page 66: Network Layer

Congestion Prevention Policies

Policies that affects congestion are listed below.

Data Link Layer Policies

Retransmission Policy

Out of order caching policy

Acknowledgment policy

Flow control policy

Network Layer Policies

Virtual circuit versus datagram

Packet queueing and service policy

Packet discard policy

Routing algorithm

Packet lifetime management

Transport Layer Policies

Retransmission Policy

Out of order caching policy

Acknowledgment policy

Flow control Policy

Timeout Determination

Page 67: Network Layer

Traffic Shaping

One of main reason of congestion is that the burst of traffic comes suddenly. If hosts are made to transmit at uniform rate, congestion could be avoided.

One of the open loop approach is to forcing the host to send the traffic at predictable and uniform rate. This approach is a called traffic shaping.

For traffic shaping in virtual circuit, agreement between sender and carrier is made regarding traffic rate send by sender.

If sender follows agreement, carrier will deliver all the packet on time.

To keep check on sender, carrier monitor traffic flow, this monitoring is called traffic policing.

For datagram subnet, other approach need to follow.

Page 68: Network Layer

Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with packets.

Page 69: Network Layer

Leaky Bucket Algorithm

Page 70: Network Layer

Leaky Bucket Algorithm

Page 71: Network Layer

Leaky Bucket Algorithm

(a) Input to a leaky bucket.

(b) Output from a leaky bucket.

Page 72: Network Layer

Token Bucket Algorithm

Page 73: Network Layer

Token Bucket Algorithm

Page 74: Network Layer

Token Bucket Algorithm

Time till the data can be sent in burst(means in one bunch) with maximum speed is called burst time.

If token bucket if full, then burst time S can be calculated

S= C/(M-p)

C= bucket capacity in bytes

M= maximum speed of sender

p=restricted speed

• data that send during burst time is = capacity of bucket+ token arrived during burst time

M*S = C bytes+ (p*S) bytes

Page 75: Network Layer

Token Bucket Algorithm

Output from a token bucket with capacities of

(c) 250 KB, (d) 500 KB, (e) 750 KB,

Page 76: Network Layer

Congestion Control in Virtual Circuit Subnet

One of technique to control congestion in virtual subnet is admission control.

In this approach, once congestion is detected, no more virtual circuits are allowed to set up until congestion gets over.

Another approach allows virtual circuit to establish, but it carefully avoids congested path.

Page 77: Network Layer

Congestion Control in Virtual Circuit Subnet

Another strategy in virtual circuit subnet is, when VC is established, sender gives details volume and shape of traffic and other parameter and subnet reserves resources so congestion will unlikely to occur.

Page 78: Network Layer

Choke Packets(for both, VC & datagram subnet)

A choke packet that affects only the source of traffic.

Page 79: Network Layer

Hop by Hop Choke Packets

A choke packet that affects each hop it passes through.

Page 80: Network Layer

Load Shedding

When none of the approach work, finally router stats discarding packet. This Is called load shedding.

Instead of randomly discarding packets, if packets are discarded on base of application, less retransmission will occur.

For example in case of file transfer, old packet worth more so newer should be discarded. While in case of multimedia transfer, new packets worth more.

To implement intelligent dropping policy requires support from sender. Sender will mark packet with priority.

Packets with lower priority will be discarded first.

Page 81: Network Layer

Internetworking

Internet is interconnected network. Using internet host in one network can communicate host in another network.

A computer network is a group of computer systems and other computing hardware devices that are linked together through communication channels to facilitate communication and resource-sharing among a wide range of users.

There are various types of network like LAN, MAN, WAN, ad hoc network, ATM etc.

Different types of network varies from each other mainly due to protocol suite and technology used by network and various other parameters.

Page 82: Network Layer

Internetworking

Some of the many ways networks can differ

Page 83: Network Layer

Internetworking

A collection of interconnected networks.

Page 84: Network Layer

Internetworking

Problem: Networks with different protocol stacks → how to let them talk to each other?

Non solution: Why not enforce all networks to run same protocol stack?

Solution: Construct some gateways that connect different kinds of networks.

Repeaters or hubs at physical layer: operate on bits, do not understand protocols, just regenerate signals.

Bridges or switches at data link layer: operate on frames, examine MAC addresses, do minor protocol translation, e.g. Ethernet to 802.11.

Multiprotocol router at network layer: operate on packets, translate between different packet formats, possibly split up packets.

Page 85: Network Layer

Concatenated Virtual Circuit

Internetworking using concatenated virtual circuits.

Page 86: Network Layer

Connectionless Internetworking

A connectionless internet.

Page 87: Network Layer

Advantage & Disadvantage

Virtual Circuit:

Advantage: resources can be reserved & QoS can be guaranteed.

Disadvantage:

Table space required in each router to store info about VC.

No alternate route to avoid congestion that occurs while circuit is active.

Affected by path failure.

Datagram:

Advantage:

Multiple routes available to avoid congestion.

This approach can be used over the subnet which does not support VC.

Disadvantage:

longer header.

for every packet, route needs to decided.

Page 88: Network Layer

Tunneling

Tunneling a packet from Paris to London.

Page 89: Network Layer

Tunneling

Tunneling a car from France to England.

Page 90: Network Layer

Internetwork Routing

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

Page 91: Network Layer

Internetwork Routing

How routing is performed?

Interior gateway protocol, exterior gateway protocol.

Autonomous System(AS): In the internet, every network works independent of other network, it is called autonomous system.

Difference between Inter-network routing & Intra-network Routing.

quality of service.

rules of some of the countries.

cost of routing

Page 92: Network Layer

Fragmentation

Each network has put limit on maximum packet size due to various reason like hardware, operating system, protocol, international standard etc.

In TCP/IP, IP packet has maximum payload size 65535 bytes.

ATM network has limitation of 53 byte packet.

PROBLEM?

large packet need to pass through network having small packet size.

• Solution: Fragmentation

fragmentation is to break large packet into small packets.

Page 93: Network Layer

Fragmentation

(a) Transparent fragmentation. (b) Non-transparent fragmentation

Page 94: Network Layer

Fragmentation

Transparent Fragmentation Issues:

Exit gateway need to know about all the packets that were part of same big packet.

all the small packets that belongs to same big packet need to travel through same exit gateway.

repeated work of fragment and reassemble.

Non-transparent Fragmentation Issues:

All the host should have capability of reassembly.

Small packets increase overhead because each packet carries header.

Page 95: Network Layer

Fragmentation

Original packet, containing 10 data bytes.

Page 96: Network Layer

FragmentationFragments after passing through a network

with maximum packet size of 8 payload bytes plus header.

Page 97: Network Layer

Fragmentation

Fragments after passing through a size 5 gateway.

Page 98: Network Layer

IPV4Header

The IPv4 (Internet Protocol) header.

Page 99: Network Layer

IPV4Header

Some of the IP options.

Page 100: Network Layer

Classful IP Address

Page 101: Network Layer

Special IP addresses.

Page 102: Network Layer

CIDR(Classless Inter Domain Routing)

Networks are not assigned according to class A,B,C.

Networks are created with varying network bits. For example. If ISP is having one IP address block of 8192 addresses starting at 194.24.0.0.

If university1 requires 2040 address, means host address should be 11 bit long.

So address space will be 194.24.0.0 to 194.24.7.255 with 21 bit network mask. There will be one network consist of 2040 host and 21 bit long network id.

If university2 requires 1012 address, host address requires 10 bit, network address will be of 22 bits.

So address space 194.24.8.0 to 194.24.11.0 with 22 bit subnet mask will be allotted to univetsiry2.

Page 103: Network Layer

NAT(Network Address Translation)

Placement and operation of a NAT box.

Page 104: Network Layer

10.0.0.1

10.0.0.4

10.0.0.3

10.0.0.2

web servera

b

c

NAT

204.x.1.10

Internet

Outgoing PPTP Client Through NAT

Page 105: Network Layer

Internet

10.0.0.1

10.0.0.4

10.0.0.3

10.0.0.2

Web servera

b

c

NAT

204.1.1.10

Connection request to port 80 from ‘c‘ to <web server> source 10.0.0.4, port 1025.

10.0.0.4, port 1025

mapped to

204.1.1.10, port 2000

Connection request from ‘c’ forwarded to <web server> source 204.1.1.10, port 2000.

Request received and accepted.

Outgoing Web Client Through

NAT

Index

Inside IP Inside

Port

Out IP

… … … …

2000 10.0.0.4 1025 204.1.1.10

2001 10.0.0.2 1026 204.1.1.10

Connection request to port 80 from ‘c‘ to <web server> source 10.0.0.2, port 1026.

10.0.0.2, port 1026

mapped to

204.1.1.10, port 2001

Connection request from ‘a’ forwarded to <web server> source 204.1.1.10, port 2001.

Page 106: Network Layer

Internet

10.0.0.1

10.0.0.4

10.0.0.3

10.0.0.2

Web servera

b

c

NAT

Response sent to 204.1.1.10, port 2000.

Translate 204.1.1.10, port 2000 to 10.0.0.4 port 1025

NAT

Index

Inside IP Inside

Port

Out IP

… … … …

2000 10.0.0.4 1025 204.1.1.10

2001 10.0.0.2 1026 204.1.1.10

Response sent to 204.1.1.10, port 2001.

Translate 204.1.1.10, port 2001 to 10.0.0.2 port 1026

Page 107: Network Layer

NAT(Network Address Translation)

Objection against NAT.

NAT violates the rules that every IP address uniquely identifies the machine.

Mapping in NAT is set up by outgoing packet, incoming packet cannot be accepted until after outgoing.

NAT is dependent on header format of TCP, if header format will change it will not able to work.

If source uses any other protocol other than TCP/UDP, then also NAT will fail.

NAT keeps the information about every connection passing through it. This is property of connection oriented, but NAT also keeps the state information of connection less.

Page 108: Network Layer

Internet Control Protocols

ICMP (Internet Control Message Protocol)

Operation of network is monitor by router. When some undesired event occur during packet processing, it is reported to sender by ICMP.

Page 109: Network Layer

Internet Control Protocols

ARP (Address Resolution Protocol)

Sender need have information about Ethernet address to send a packet.

ARP is used to find out Ethernet address of given IP address.

Page 110: Network Layer

Internet Control Protocols

DHCP (Dynamic Host Configuration Protocol)

DHCP is used to assign IP address dynamically to the host.

Whenever computer is started, it has Ethernet address, but no IP address.

To get IP address, computer broadcast request to get IP address, this request is done using DHPC DISCOVER packet.

This packet must reach to DHCP server.

When DHCP server will get a request, it will allocate IP address from pool of IP address.

The packet that DHCP give as reply with IP address is called DHCP OFFERpacket.

Page 111: Network Layer

OSPF(Open Shortest Path First)

Internet is made up of different Autonomous systems. Each of the ASes is operated by different organization, can use different interior gateway protocol.

Original interior gateway protocol was Distance vector protocol but it was not working well for larger AS.

So distance vector was replaced by link state routing protocol, then IETF work on successor, which was OSPF( open shortest path first).

There are some of the requirement that need to be satisfy by OSPF.

• protocol need to support routing according to type of service required, need to support various distance metrics, need to be dynamic, support load balancing, distribute load among multiple lines etc.

Page 112: Network Layer

OSPF(Open Shortest Path First)

OSPF works on graph representation AS. Then it computes shortest path based on arcs weights.

Connection between two routers are shown using two arcs, one in each direction. Connection between network and router are shown using single arc from router to network.

Page 113: Network Layer

OSPF(Open Shortest Path First)

When router boots, it send HELLO packets to its neighbor and on the LAN.

OSPF works by exchanging information between adjacent router. Adjacent here is not neighbor.

One router is selected as designated router(DR) and this is said to be adjacent to all other router in LAN. A backup designated router is also selected to use in case of DR router crash.

During normal operation, each router periodically sends LINK STATE UPDATE packet to adjacent router. These packets are also acknowledge by LINK STATE ACK packet.

There are two more type of packets.

DATABASE DESCRIPTION

LINK STATE REQUEST

Page 114: Network Layer

OSPF(Open Shortest Path First)

If AS is large, it can be divided in number of arears, each area is non overlapping.

Every AS has area 0 (area zero), backbone area. Every other area is connected with backbone area.

Each router in area have same link state database and calculates shortest path to all the other router in the area.

Router that is connected with two or more area will have database of both the area.

During normal operation, three types of routes are required.

1. intra-area 2. inter-area 3. inter AS

In case of inter-area routing, packet will first go from source area to backbone, backbone area to destination area, from there to destination.

Page 115: Network Layer

OSPF(Open Shortest Path First)

Page 116: Network Layer

BGP(Border Gateway Protocol)

Within single autonomous system (AS), interior gateway protocols are used like OSPF.

Between ASes, exterior gateway protocol like BGP is used.

Exterior gateway protocol is used to convey routing information between ASes.

Intra-domain (AS) routing protocol need to look at how packet can be transfer efficiently between source and destination.

Inter-domain (AS) routing protocol need to look at the efficient path between AS and politics.

Examples of routing constraints:

1.No commercial traffic on educational network

2.Never put Iraq on route starting at Pentagon

3.Choose cheaper network

4.Choose better performing network

5.Don’t go from Apple to Google to Apple

Page 117: Network Layer

BGP

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

Page 118: Network Layer

BGP

Pair of BGP router communicate with each other by establishing TCP connection.

Instead of maintaining cost to each destination, each BGP router keeps track of exact path used.

After all the paths come in from the neighbor to F, it examines all the path, choses the best.

BGP solves count to infinity problem. If router G crashes, F receives paths from all the neighbor are BCD, IFGCD, EFGCD.

Here F can see that remaining two path pass through G, so it will choose BCD.

Page 119: Network Layer

BGP

From point of BGP router, networks are divided into three categories.

stub network: which have only one connection to BGP graph.

multi-connected network: which have multiple connection which BGP graph. This network may be used as transit network if it allows.

Transit network: such a backbone network. These type of network are willing to handle third party packets.

Page 120: Network Layer

BGP

AS 1 and AS 5 are stub networks AS 2 is a multi-connected networkAS 3 and AS 4 are transit networks