60
Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Embed Size (px)

Citation preview

Page 1: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Fall 2005By: H. Veisi

Computer networks course

Olum-fonoon Babol

Chapter 5

The Network Layer

Page 2: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 2

Overview

Functions: Routing issues

determine “good” path (sequence of routers) thru network from source to dest.

Congestion (Not Contention!) More packets enter an area than can be processed

Internetworking connecting different

network technologies together

Network layer protocols in every host, router

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

Page 3: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 3

Network Layer Design Issues

Services Provided to the Transport Layer The network layer should shield the transport layer from

having to know details of the underlying subnet

Network Layer Services Can: Connection-Oriented: Provides Virtual Circuit (VC) subnet,

source-to-destination path behaves much like telephone circuit, Avoids choosing a new route for each packet.

A virtual circuit remembers how to send a packet from source to destination.

Connection-less: Provides Datagram subnet, Each packet sent is routed independently of its predecessors

Page 4: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 4

1. Send Data

2. Receive Data

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

No call setup at network layer Packets forwarded using destination host address

packets between same source-dest. pair may take different paths

Use in Internet

Connectionless: Datagram (1)

Page 5: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 5

Connectionless: Datagram (2)

Routing within a diagram subnet:

The table of router A is changed because of some

reasons!

Management and update Management and update this tables for routing = this tables for routing =

Routing algorithmRouting algorithm

Store-and-Forward packet

Subnet

Routing tables

Page 6: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 6

Call setup, do for each call before data can flow Each packet carries VC identifier Used in ATM, frame-relay, X.25

1. Initiate call

2. Incoming call3. Accept call

4. Call connected5. Data flow begins

6. Receive data

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Virtual Circuits (1)

Page 7: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 7

Virtual Circuits (2)

Routing within a virtual-circuit subnet:

Page 8: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 8

ATM (1)

ATM (Asynchronous Transfer Mode) Is underlying mechanism. Transmits in small

fixed-size cells. A connection-oriented network Use virtual circuits and small, fixed-size

packets (Cells)

Page 9: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 9

ATM (2)

Packet (cell) switching is dramatic change for phone companies.

ATM is connection oriented; make connecting request first; then all cells follow the same path.

Target is 155 Mbps and 622 Mbps. Allows TV transmission.

Page 10: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 10

ATM (3)

ATM Reference Model: 3 layers:

1- Physical layer :Physical medium (voltage, bit timing, ….)

2- ATM layer : deal with cells and transports it + establish/release

virtual circuits + congestion control

3- ATM adaptive layer : Segment large cells and resemble after transmission

Page 11: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 11

ATM (4)

ATM Reference Model:

Page 12: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 12

ATM (5)

Comparisons to other models:

Page 13: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 13

Comparison of Virtual-Circuit and Datagram

Internet ATM

Page 14: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 14

Quality of Service: QoS (1)

Factors: Timing

Connection Establishment DelayEnd-To-End Delay

Connection Establishment Failure Probability Throughput or Bandwidth Guarantee Ordering Preservation Congestion Control Bit-Error rate or Packet-Loss Rate Control Protection Priority …

Page 15: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 15

Quality of Service: QoS (2)

Requirements: Reliability, Delay, Jitter, Bandwidth

How stringent the quality-of-service requirements are:

Page 16: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 16

Routing (1)

The network layer is responsible for routing packets from the source to destination.

The routing algorithm is the piece of software that decides where a packet goes next (e.g., which output line, or which node on a broadcast channel).

For connectionless networks, the routing decision is made for each datagram. For connection-oriented networks, the decision is made once, at circuit setup time.

The routing algorithm must deal with the following issues: Correctness, simplicity, stability, fairness and optimality Mimizing mean packet delay or maximizing total network

throughput

Routing is different from Forwarding!: Forwarding: Select the output path using routing table Routing: Management and updating the routing tables

Page 17: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 17

Routing (2)

There are two types: Static (Non-Adaptive)

routes never update or update slowly over time Examples: Dijkstra, Flooding algorithm

Dynamic (Adaptive) routes update more quickly use dynamic information of

current topology such as load, delay, … Examples: Distance Vector, Link State Routing

From another view: Global: all routers have complete topology, link cost info Decentralized: router knows physically-connected

neighbors

Page 18: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 18

Dijkstra Algorithm (1)

Net topology, link costs known to all nodes Global algorithm Cost of a link is a function of :

Number of HopHops, Distance, Average traffic, Delay, …

Computes least cost paths (Minimum path) from one node (‘source”) to all other nodes gives routing table for that node

Iterative: after k iterations, know least cost path to k dest.’s

Non-Adaptive Algorithm

Page 19: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 19

Dijkstra Algorithm (2)

Notation: N: set of nodes whose least

cost path definitively known

c(i,j): link cost from node i to j. cost infinite if not direct neighbors

p(v): nodes along path from source to v

D(v): current value of cost of path from source to dest. V

N: A, B, C, D, E, F

C(A,C)=5; C(C,A)=5C(B,D)=2; C(D,B)=3…

Source=Ap(F): A-D-E-FD(F)=4

A F

D

C

E

B

1

1

1

2

2

2

53

53

5

3

Example:

Page 20: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 20

1 Initialization: 2 N = {A} 3 For all nodes v 4 If v adjacent to A then5 D(v) = c(A,v) 6 Else D(v) = infinity

8 Loop 9 Find w not in N such that D(w) is a minimum 10 Add w to N 11 Update D(v) for all v adjacent to w and not in N: 12 D(v) = min( D(v), D(w) + c(w,v) ) /* new cost to v is either old cost to v or known shortest path cost to w plus cost from w to v */

13 until all nodes in N

v

w

D(v) c(w,v)

D(w)

A

Dijkstra Algorithm (3)

C version of this algorithm is available in book

Page 21: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 21

Example: computes least cost paths from node A to all other nodes

Step012345

start NA

ADADE

ADEBADEBC

ADEBCFADEBCF

D(B),p(B)2,A-B2,A-B2,A-B2,A-B2,A-B2,A-B

D(C),p(C)5,A-C

4,A-D-C3,A-D-E-C3,A-D-E-C3,A-D-E-C3,A-D-E-C

D(D),p(D)1,A-D1,A-D1,A-D1,A-D1,A-D1,A-D

D(E),p(E)infinity

2,A-D-E2,A-D-E2,A-D-E2,A-D-E2,A-D-E

D(F),p(F)infinityinfinity

4,A-D-E-F4,A-D-E-F4,A-D-E-F4,A-D-E-F

A F

D

C

E

B

1

1

1

2

2

2

53

53

D(v): Distance (cost) of A to v.P(v): nodes along path fromA to v.

Dijkstra Algorithm (4)

Page 22: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 22

Discussion: Algorithm complexity:

Suppose there are n nodes, except source First iteration: Search through all n nodes to determine the node,

w, not in N that has the minimum cost. Second iteration: Check n-1 nodes to determine minimum cost. Third iteration: n-2 nodes, and so on.

Total number of nodes searched: n(n+1)/2 The implementation of the algorithm has worst-case

complexity of order n squared: O(n2). A more sophisticated implementation of this algorithm, using a

data structure known as a heap, can reducing the complexity to O( nlog(n) )

Dijkstra Algorithm (5)

Page 23: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 23

Flooding algorithm (1)

Flooding does not select a specific route. When a router receives a packet, it sends a copy of the packet out on each line (except the one on which it arrived)

To reduce looping even further: Using Hop Counter:

Each router decrements a hop count contained in the packet header. Whenever the hop count decrements to zero, the router discards the packet.

Keep track of which packet have been flood Add a sequence number to each packet's header. Each router maintains a private sequence number. When it sends

a new packet, it copies the sequence number into the packet, and increments its private sequence number.

Keeps track of the highest sequence number seen from S. Whenever it receives a packet from S containing a

sequence number lower than the one stored in its table, it discards the packet. Otherwise, it updates the entry for S and forwards the packet on

Non-Adaptive Algorithm

Page 24: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 24

Flooding algorithm (2)

Another variation of flooding is Selective Flooding: Don’t send incoming packets to ALL output lines Just forward on that lines which are going

approximately in right direction

Uses: In military applications, the network must remain

robust in the face of (extreme) hostility Sending routing updates, because updates can't rely

on the correctness of a router's routing table. Theoretical-chooses all possible paths, so it chooses

the shortest one

Page 25: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 25

Distance Vector Routing (1)

Each router maintains a table (vector) giving the best known

distance to a destination and the line to use for sending there.

Tables are updated by exchanging information with neighbors.

Each router knows the distance (cost) of reaching its neighbors (e.g. send echo requests).

Routers periodically exchange routing tables with each of their neighbors.

This algorithm was used in the original ARPANET

Adaptive Algorithm

Page 26: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 26

Bw

=

2

D

CB

A

E1

7

1

8

2source

ABCD

A

1764

B

1489

11

D

5542

c(E,B) + min {D (A,w)}=8 + 6 = 14

ED (A,B)=

A

E B

D (A,C)B

AC

…c(E,B)

E’s neighborB’s neighbor

neighbor: j

dest

inat

ion:

i

D(i, j)E

Distance table:

Distance Vector Routing (2)

node E, for dest. A via neighbor B: DE(A,B)

Page 27: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 27

Distance Vector Routing (3)

Distance table for J

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

DJ (G,?)=

c(J,H)+minw{DH(G,w)}=

6+12=18

Page 28: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 28

Distance Vector Routing (4)

Problem: Convergence is slow! Good news travels quickly, bad news travels slowly

(count-to-infinity) problem

Example: Propagation of good news Initially A is down and all other routers know

this

Table for dest.=A

There is no path to A

In a subnet with longest subnet path=N, after N exchanges everyone will know

Page 29: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 29

Distance Vector Routing (5)

Example: Propagation of good news The count-to-infinity problem A goes down after initially

After this A goes down

B thinks that there is a path to A thru C but C itself go to A via B!

Counting will continuous to infinity

If the metric is “Number of Hop”, Infinite can define as longest path+1 If the metric is “delay”, there is no well-defined upper bound

Page 30: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 30

Link State Routing (1)

The DVR Arpanet routing algorithm was replaced in 1979. Problems with old algorithm included:

Network was too slow in adapting to congestion, too fast to react to minor changes.

Average queue length was used to estimate delayThis works only if all lines have the same capacity and

propagation delay.Doesn't take into account that packets have varying

sizes. Didn’t take line bandwidth into account when choosing

routes Because all the line have same capacity, 56 Kbps

Adaptive Algorithm

Page 31: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 31

Link State Routing (2)

Each router must do the following: Discover its neighbors, learn their network address.

Sends ‘hello' message on booting.

Measure the delay or cost to each of its neighbors. Delay= (Send ‘Echo’ message + Receive its reply)/2

Construct a packet telling all it has just learned. Construct Link State (LS) packet, it contains:

Source Add., Seq. No., Age No., List of neighbors + their delay

Send this packet to all other routers. Forwards link state packets to all other routers using Flooding algorithm.

Compute the shortest path to every other router. Each router uses an Dijkstra algorithm to calculate shortest paths

based on the current values in its database.

Page 32: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 32

Link State Routing (3)

The link state packets for this subnet.

The packet buffer for router B, Used in step

Page 33: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 33

Hierarchical Routing (1)

As a network becomes larger, the amount of information that must be propagated increases, and the routing calculation becomes increasingly expensive. (Increase the memory amount and calculation)

Hierarchical routing: Divide the network into regions, with a router only knowing

the details of how to route to other routers in its region. Hides information from far-away nodes, reducing the amount

of information a given router needs to perform routing Router don’t know about the internal topology of other regions. Gateway is a router that knows about other regions

Page 34: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 34

Host2

C

A

B

Intra-AS routingwithin AS A

Intra-AS routingwithin AS B

Host1

ab

ad

bc

ac

b

C.b

A.a

B.aInter-A

S routin

g

between A and

BA.c

Hierarchical Routing (2)

Page 35: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 35

Hierarchical Routing (3)

Advantage: Scaling. Each router needs less information

In Ex. Distance table reduce from 17 entries to 7

Disadvantage: Sub optimal routes. The average path length increases

Optimal path for 1A to 5C is thru region 2 while in hierarchical is thru

region 3

Page 36: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 36

The Network Layer in the Internet (1)

TCP/IP use the Internet Protocol (IP) in network layer. Provides connectionless, datagram service: unreliable

The IPv4 header:

Using Big Endian: store/transmit the most significant byte of a bit stream in the lowest memory address/first (e.g. to the left). Machines such as IBM and Sun-3 computers use this

mechanism Intel use Little Endian

Page 37: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 37

The Network Layer in the Internet (2)

Version number (4-bits): Including a version number allows a future version of IP be used

along side the current version, facilitating migration to new protocols.

Header length (4-bits): Length of the datagram header (excluding data) in 32-bit words. The minimum length is 5 words = 20 bytes, but can be up to 15

words if options are used. Max. length of Option data=40 bytes Max for IHL=15

Type-of-service (8-bits): A hint to the routing algorithms as to what type of service we

desire. Precedence (3-bits): A priority indication, where 0 is the lowest and

means normal service, while 7 is highest Delay, Throughput, Reliability bits

Page 38: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 38

The Network Layer in the Internet (3)

Total length (16-bits): Total length of the IP datagram (in bytes). Max. length of a packet is 216=65K bytes

Identification (16-bits), DF (Don’t fragment), MF (More fragment), Fragment offset (13-bits): These three fields are used for fragmentation and

reassembly. Gateways along a path are free to fragment datagrams as

needed; hosts are required to reassemble fragments before passing complete datagrams to the higher layer protocols.

Each fragment contains a complete copy of the original datagram header plus some portion of the data.

All fragments of a datagram will have the same source and destination IP address.

Page 39: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 39

The Network Layer in the Internet (4)

Identification: determine the IP Datagram DF: Don’t fragment this datagram MF:1 means that the fragmentation is continued, 0 Just for last packet Fragmented Offset: Determine the position of current packet in datagram,

13 bits Max. No. of packets in each datagram=8192

Time-to-live: TTL (8-bits): It guarantees that packets don't stay in the network for longer

than 255 seconds, a property needed by higher layer protocols that reuse sequence numbers.

A counter that is decremented by each gateway. Should this hopcount reach 0, discard the datagram.

Protocol (8-bits): What type of data the IP datagram carries (e.g., TCP, UDP, etc.). Needed by the receiving IP to know the higher level service that

will next handle the data.

Page 40: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 40

The Network Layer in the Internet (5)

Header Checksum (16-bits): A checksum of the IP header (excluding data) use checksum

method for error detection The header must be recalculated at every router since the TTL

field is decremented.

Source address (32-bits): Original sender's address. This is an IP address, not a MAC

address.

Destination address (32-bits): Datagram's ultimate destination.

IP Options: IP datagrams allow the inclusion of optional, varying length

fields that need not appear in every datagram. Some defined options: Security, Strict source routing, Loose

source routing, Record route, Timestamp

Page 41: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 41

Network links have MTU (max.transfer size) - largest possible link-level frame. different link types,

different MTUs Large IP datagram divided

(“fragmented”) within net one datagram becomes

several datagrams “reassembled” only at

final destination IP header bits used to

identify, order related fragments

reassembly

fragmentation: in: one large datagramout: 3 smaller datagrams

IP Fragmentation and Reassembly (1)

Page 42: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 42

ID=x

offset=0

fragflag=0

length=4000

ID=x

offset=0

fragflag=1

length=1500

ID=x

offset=1480

fragflag=1

length=1500

ID=x

offset=2960

fragflag=0

length=1040

One large datagram becomes3 smaller datagrams.

Example 4000 byte

datagram MTU = 1500 bytes

0……….3979data

20 Byte

4000 Bytes

0……….1479

1480…2959

IP Fragmentation and Reassembly (2)

Page 43: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 43

IP Addresses (1)

IP address: 32-bit identifier for host, router interface

interface: connection between host/router and physical link router’s typically have

multiple interfaces host may have

multiple interfaces IP addresses

associated with each interface

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 44: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 44

IP address: network part (high

order bits) host part (low order

bits) What’s a network ? (from IP

address perspective) device interfaces with

same network part of IP address

can physically reach each other without intervening router

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

network consisting of 3 IP networks

LAN

IP Addresses (2)

Page 45: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 45

ICANN: Internet Corporation for Assigned Names and

Numbers allocates addresses

223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Interconnected system consistingof six networks.

IP Addresses (3)

Page 46: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 46

0 network host

110 network host

A

10 network hostB

C

D

class1.0.0.0 to127.255.255.255

128.0.0.0 to191.255.255.255

192.0.0.0 to223.255.255.255

224.0.0.0 to239.255.255.255

32 bits

1110 multicast address

class-full addressing:

65K Hosts16K Networks

254 Hosts4M Networks

16M Hosts126 Networks

IP Addresses (4)

Page 47: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 47

Special Cases 0.0.0.0 :Source IP Addr. Just after Boot network part of dest. Addr.= 0 :Source and

Destination are in same network. Dest. Addr.=255.255.255.255 :Broadcast in

Sender’s network. host part of Dest.=111… : Broadcast in

destination network. Dest. Addr. = 127.anything : Loop Back

class code network host

IP Addresses (5)

Page 48: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 48

IP Addresses (6)

Subnets (1): A large organization or campus might have 30 or more

LANs (one for each department). And will probably have only a single connection to the rest of the Internet. inefficient use of address space, address space exhaustion

e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network

In order for every local host to be able to communicate with other Internet machines, routing entries for each of the 30 networks must exist in the core gateways.

Wouldn't it be nice if we only needed to advertise a single network number for allsingle network number for all 30 networks?

Page 49: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 49

IP Addresses (7)

Subnets (2): We want to be able to reduce the number of networks

seen by the outside world; simplify the management of those many networks within the organization;

Using Subnet addressing: IP addresses have a well-defined structure that allows a gateway to extract the network portion of an address by simply looking at its class and an optional Subnet mask.

Page 50: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 50

IP Addresses (8)

CIDR: Classless Inter Domain Routing (RFC1519) network portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in network

portion of address Ex.: A class B network subnetted into 64 subnets:

MASK=255.255.252.0 or IP Add./22

Page 51: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 51

IP Addresses (9)

Subnet: The subnet mask ANDed with the interface address

yields the network number of the interface. If ( ( port_interface_address & subnet_mask ) ==

( DEST & subnet_mask ) ), direct routing with this port can be used.

Page 52: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 52

IP datagram:

miscfields

sourceIP addr

destIP addr data

datagram remains unchanged, as it travels source to destination

addr fields of interest here

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

EB

Dest. Net. Next Router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

forwarding table in A

Getting a datagram from source to dest. (1)

Page 53: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 53

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27 EB

Starting at A, send IP datagram addressed to B:

look up net. address of B in forwarding table

find B is on same net. as A link layer will send datagram

directly to B inside link-layer frame B and A are directly

connected

Dest. Net. Next Router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

miscfields223.1.1.1223.1.1.3data

forwarding table in A

A

Getting a datagram from source to dest. (2)

Page 54: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 54

Dest. Net. Next Router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

Starting at A, dest. E: look up network address of E in

forwarding table E on different network

A, E not directly attached

routing table: next hop router to E is 223.1.1.4

link layer sends datagram to router 223.1.1.4 inside link-layer frame

datagram arrives at 223.1.1.4 continued…..

miscfields223.1.1.1223.1.2.3 data

forwarding table in A

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27 E

A

B

Getting a datagram from source to dest. (3)

Page 55: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 55

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

EB

Arriving at 223.1.4, destined for 223.1.2.2

look up network address of E in router’s forwarding table

E on same network as router’s

interface 223.1.2.9 router, E directly

attached link layer sends datagram to

223.1.2.2 inside link-layer frame via

interface 223.1.2.9 datagram arrives at 223.1.2.2

miscfields223.1.1.1223.1.2.3 data Dest. Net Router Nhops Interface

223.1.1 - 1 223.1.1.4 223.1.2 - 1 223.1.2.9

223.1.3 - 1 223.1.3.27

forwarding table in router

Getting a datagram from source to dest. (4)

Page 56: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 56

Host, Router network-layer-functions:

forwardingtable

Routing protocols•path selection• OSPF, BGP

IP protocol•addressing conventions•datagram format•packet handling conventions

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Netw

ork

la

yer

OSPF: Open Shortest Path First, RFC2328 BGP: Border Gateway Protocol, RFC1771

ICMP: Internet Control Message Protocol, RFC792

The Internet Network layer

Page 57: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 57

How does host get IP address? IP addr. is configures into host by admin. in a file

Windows: control-panel->network->configuration->tcp/ip->properties

DHCP: Dynamic Host Configuration Protocol (RFC2131): dynamically get address from as server“plug-and-play” Allows reuse of addresses (only hold address while

connected an “on” Support for mobile users who want to join network (more

shortly) DHCP overview:

host broadcasts “DHCP discover” msgDHCP server responds with “DHCP offer” msghost requests IP address: “DHCP request” msgDHCP server sends address: “DHCP ack” msg

IP addresses: how to get one?

Page 58: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 58

The Internet Network layer protocols (1)

ICMP (Internet Control Message Protocol): Allows gateways and hosts to send network

control information to each other. Two general types of ICMP messages:

Information messages, where a sender sends a query to another machine (either

host or gateway) and expects an answer. For example, a host might want to know if a gateway is alive.

Error indication messages, where the IP software on a host or gateway has

encountered a problem processing an IP datagram. For example, it may be unable to route a datagram to its destination, or it may have had to drop a frame.

Page 59: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 59

The Internet Network layer protocols (2)

The principal ICMP message types.

Page 60: Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 5 The Network Layer

Computer networking, Olum-Fonoon Babol H. VeisiH. Veisi Fall 2005 Page 60

The Internet Network layer protocols (3)

ARP (Address Resolution Protocol): Map IP add. to MAC add. Using broadcasting

RARP (Reverse Address Resolution Protocol): Map MAC add. to IP add. Used in diskettes booting

OSPF (Open Shortest Path First): Routing for inter-AS (Autonomous system)

Using Link State routing

BGP (Border Gateway Protocol): Routing for intra-AS Distance vector protocol, but not only does it account for

distance, but also for specific route criteria.