internet network layer: overview - ntut.edu.tkwke/cn/nlp.pdf · routing algorithms and internet...

33
Network Layer 1 Goals: Understand principles behind Network layer services Instantiation and implementation in the Internet How the network layer moves a segment from the transport layer of an origin host to the transport layer of the destination host ? Network Layer 2 Internet Network Layer: Overview Network layer services IP Internet Protocols: Format and Addressing schemes How Does Internet works? Whats inside a router? IP Subnetworking and routing ARP/DNS/NAT/DHCP/CIDR ICMP for error control/report Routing principle: Hierarchical routing and path selection* Routing Algorithms and Internet Routing Protocols IPv6 Protocol header, addressing (a brief), migration Network Layer 3 Network Layer Functions Transport packet from sending to receiving hosts via internet Network layer protocols exist in every host and router Three important functions: path determination: route taken by packets from source to destination (Routing algorithms) forwarding: move packets from a routers input to a appropriate routers output call setup: some networks require router call setup along path before data flows (e.g., MPLS) application transport network data link physical application transport network data link physical router router router End system Host #2 End system Host #1 network data link physical network data link physical network data link physical network data link physical network data link physical Network Layer 4 Network Service Model Network Service Model Q: Whats service model for channel transporting packets from sender to receiver? guaranteed bandwidth? preservation of inter-packet timing (no jitter )? loss-free delivery? in-order delivery? congestion feedback to sender? (protective CC) ? ? virtual circuit or Datagram ? The most important abstraction provided by network layer. Service Abstraction (properties) Connecting transport layers in sending and receiving hosts Network-level Service model Determines end-to-end Characteristics of transporting Data between network edges Variants ( ) of delays

Upload: lequynh

Post on 06-Apr-2018

220 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 1

Goals:

Understand principles behind Network layer services

Instantiation and implementation in the Internet

How the network layer moves a segment from the transport layer of an origin host to the transport layer of the destination host ?

Network Layer 2

Internet Network Layer: Overview

Network layer services

IP – Internet Protocols: Format and Addressing schemes

How Does Internet works? What’s inside a router?

IP Subnetworking and routing

ARP/DNS/NAT/DHCP/CIDR

ICMP – for error control/report

Routing principle: Hierarchical routing and path

selection*

Routing Algorithms and Internet Routing Protocols

IPv6 Protocol – header, addressing (a brief), migration

Network Layer 3

Network Layer Functions

Transport packet from sending to receiving hosts via internetNetwork layer protocols exist inevery host and routerThree important functions:

path determination: route takenby packets from source to destination(Routing algorithms)forwarding: move packets from a router’s input to a appropriate router’soutputcall setup: some networks require router call setup along path before data flows (e.g., MPLS)

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

router

router

router

End systemHost #2

End systemHost #1

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

Network Layer 4

Network Service ModelNetwork Service Model

Q: What’s service model for “channel” transporting

packets from sender to receiver?

guaranteed bandwidth?

preservation of inter-packet timing (no jitter)?

loss-free delivery?

in-order delivery?

congestion feedback to sender? (protective CC)

? ?

virtualcircuit

orDatagram

?

The most importantabstraction provided

by network layer.

ServiceAbstraction(properties)

Connecting transport layers insending and receiving hosts

Network-levelService model

Determines end-to-endCharacteristics of transporting

Data between network edges

Variants ( ) of delays

Page 2: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 5

(a review)Virtual Circuit Networks

“source-to-destination path” behaves much like “telephone circuit”performance-wise

network actions along source-to-destination pathpath

from VC to VC

call setup for each call before data can flow

each packet carries VC identifier (not destination host OD)

every router on source-destination path maintains “state” for each

passing (undergoing) connection (through it)

transport-layer connection only involved two end systems

Link and router resources (bandwidth, buffers) may be allocated to VC

to get (real) circuit-like performance (reserved)Network Layer 6

Virtual Circuits: via signaling protocols

Protocols used to exchange signaling messages

– setup, maintain (“initiation” mostly), and teardown VC

Ex: ATM, frame-relay, X.25 VC-based networks (see chp.5)

But . . . not used in today’s Internet

1. Initiate call 2. incoming call3. Accept call4. Call connected

6. Receive data5. Data flow beginsapplicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

VC setup at NL connection setup at TL

Network Layer 7

Datagram Networks: the Internet Model

no call setup at network layer

routers: no state about end-to-end connections

no network-level concept of “connection” out-of-order

packets typically routed using destination host ID

packets between same source-dest pair may take differentpaths

(review)

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

Network Layer 8

Internet Architecture: TCP/IP Protocol suiteInternet Architecture: TCP/IP Protocol suite(review)

DATA LINK (e.g., Ethernet)

Medium (Frames)Ntwk Access Layer

Frame+

Bits

RARPARP

ICMPIP

IGMP

Network LayerPacket

(Daragram)

TCP UTPTP LayerSegment

orDatagram

Based onProtocol number

Based onprotocol type

Based onport #

(Interface,so-called SAP)

SMTP FTPTELNETPING

AP LayerDNSSNMP BOOTP NTP

TRACEROUTE

Page 3: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 9

More on Internet Network (IP) layer

Network layer for host and router: datagram-oriented functions

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

routingtable

2.Routing protocols• path selection• Ex:RIP, OSPF, BGP

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

3.ICMP protocol• error reporting• router “signaling”

Build up

Network Layer 10

IP Overview - I

• IP is designed to interconnect packet switched(datagram)communication networks to form an internet.

• It transmits blocks of data known as datagramsreceived from IP’s upper-layer software to and from hosts.

• IP provides best-effort or connectionless delivery.

• IP is responsible for addressing.

• Two versions of IP: version 4 (RFC 791, currently) and version 6 (RFC2373, 2460)

* Network information is distributed viarouting protocols.

Network Layer 11

IP Overview - II

• IP’s main function is to provide for the interconnection of subnetworks to form an internet in order to pass data.

• Summary of IP functions :– Basic unit for data transfer (format, encapsulation)

– Addressing

– Routing (supporting packet forwarding)

– Fragmentation of packets/datagrams

Network Layer 12

IP Packet/datagram FormatBit0 4 8 16 31

Version IHL Type-of-service Total lengthIdentification Flags Fragment offset

Time-to-live Protocol Header checksumSource Address

Destination AddressIP Option IF any Padding

Data (from TP layer)

20 b

ytes

(IH

L =

5)

Source IP addressSource IP addressDestination IP addressDestination IP address

Ethernet frameDest MAC

6 bytesSRC MAC

6 bytesTYPE2 bytes

IP Header + Data46~1500 bytes

CRC4 bytes

IP over Ethernet

(MAC Address)64(min) ~ 1518(max) bytes

Page 4: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 13

IP datagram format IP datagram format –– an Overviewan Overview

ver length

data(variable length,typically a TCP

or UDP segment)

16-bit identifierInternetchecksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length(bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgs fragmentoffset

upperlayer

32 bit destination IP address

Options (if any)

32 bits

E.g. timestamp,record routetaken, specifylist of routersto visit.

Network Layer 14

IPv4 Header - TTL

HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

Time to LiveTime to Live ProtocolProtocol Header ChecksumHeader Checksum

VERSVERS

Time to LiveTime to Live

Time-to-live — Indicating the amount of time (in second) thata datagram is allowed to stay on the network.(A 8-bit field, Max TTL = 255.)

• A datagram or some of its fragments may loop indefinitelythrough the internet when dynamic or alternate routing is used

• The lifetime should be a true measure of time. This requiressome global clocking mechanism - estimating exact time is difficult.

• A simple way to implement lifetime is to use a hop count.The initial is set by the packet originator and it varies.

Network Layer 15

Time to Live (TTL)

• IP header maintains a counter that gradually decrementsdown to zero, at which point the datagram is discarded. This keeps packets from looping endlessly.

• Rules:- Whenever a host injects a datagram into the internet, it

sets a maximum time that the datagram should survive

- Router decrements TTL by 1 when processes the datagram

- Router decrements TTL by the seconds when the datagram

remained inside the router waiting for service

- Router discard the datagram (remove it from the internet) and

sends error message (ICMP) back to the source whenever

TTL = 0 ( the packet/datagram expired)Network Layer 16

IPv4 Header ChecksumIPv4 Header Checksum

HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

Time to LiveTime to Live ProtocolProtocol Header ChecksumHeader Checksum

VERSVERS

Header ChecksumHeader Checksum

• Checksum ~ to ensure the integrity of the IP header (RFC 1071)

• Calculated over IP header only ((5 ~ 15) x 32-bit in total

since HLEN = 4-bit long. Can you see it ? )

• Each router will recompute the checksum while forwarding a DG.

Why ? Because TTL is changed by each router the DG traverses.

How ? (refer to : RFC 1141)

Page 5: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 17

Checksum (CKS) Computing

• In sending station :

- CKS = 0 initially for an outgoing DG- Calculate the 16-bit one’s complement sum of the header

(i.e., the entire header is considered a sequence of 16-bit words)and store the 16-bit one’s complement of the sum in CKS field

• Example (downsize to 8-bit)

CKS = 00000000 (initial)

Header = 10010110 11001000 01000010 00010110 . . .

CKS = (01101001 + 00110111 + 10111101 + 11101001)’

= . . .

= 11110101

Network Layer 18

Error Checking by Checksum (CKS)

• In receiving station :- When an IP DG is received, the 16-bit one’s complement sum

of the header is re-calculated- CKS all 1’s, if no error (since the receiver’s CKS calculation

contains the CKS stored by the sender)- Declare checksum error if CKS all 1’s, and IP discards the

received DG (No error message is generated upon error detected. It is up to the higher layers to somehow detect the missingdatagram and retransmit it.)

• Example (cont’d) – if no error

CKS_new = ((data_1)’ + (data_2)’ + . . . + (CKS_old)’)’

= . . .

= 11111111

Network Layer 19

IP AddressingIP Addressing

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

Interface addressesIP address: 32-bit identifier forhost and router’s interface

interface: connection between host, router and physical link

Routers - typically havemultiple interfaces

Host - may have multipleinterfaces

IP addresses associatedwith interface(s), not

host or router

223.1.1.1

223.1.3.2223.1.3.1

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11• IP address Structure- Divided 32-bit into 4 octets of binary- Use Dotted-decimal representation Network Layer 20

A Note on IP Address

• Examples

• An IP address does not identify a specific computer.

Instead, each IP address identifies a connection between a

computer and a network. A computer with multiple

network connections (e.g., a router) must be assigned one

IP address for each connection.

• Global authority (IANA) assigns unique prefix to network• Local administrator assigns unique suffix to host (interface)

NetID

HostID

Page 6: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 21

IP Addressing (contIP Addressing (cont’’d)d)Network addresses

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 IPaddress

can physically reacheach other withoutintervening 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

LAN

223.1.1.0/24

223.1.2.0/24

223.1.3.0/24

A network consisting of 3 IPnetworks (for IP addressesstarting with 223, first 24 bits are network address)

Network Layer 22

Routers Interconnect Networks

How to find the How to find the networksnetworks??

Detach each interface fromrouters and hosts

create “islands” of

isolated networks

call each a “network”

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

Interconnectedsystem consistingof six networks.

island

Network Layer 23

Classful addressing (RFC 791)Fixed number of bits for network and host portionsinefficient use (giving out) of address space (IP address exhaustion)

• e.g., class B net allocated enough addresses for 65K hosts,

even if only 2K hosts in that network waste address space

CIDR: Classless InterDomain Routing (RFC 1519)network portion of address of arbitrary length

address format: a.b.c.d/x , where x is the number of leading bits in network portion of address

IP Addressing: Classful and ClasslessIP Addressing: Classful and Classless

11001000 00010111 00010000 00000000

networkPart: x-bit

hostpart

200.23.16.0/23 (32 – x)-bit identifiesthe specific hosts

Network Layer 24

Classes of Original IP Address

• Primary IP Classes : Class A, B, and C

00 77--bit network addressbit network address 2424 bits of host addressbits of host address

First byteFirst byte Last three bytesLast three bytes

Class AClass A

Class A : 0.0.0.0 ~ 127.255.255.255

– Networks (Max) : 1.0.0.0 ~ 126.0.0.0 (128 - 2)

– Max Hosts/network : 16,777,216 - 2

(0000000) = 0 ~ (1111111) = 27 – 1

(224 – 1)

Page 7: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 25

Classes of Original IP Address (cont’d)

1100 1414--bit network addressbit network address 1616 bits of host addressbits of host addressClass BClass B

First two bytesFirst two bytes Last two bytesLast two bytes

• Class B : 128.0.0.0 ~ 191.255.255.255

– Networks (Max) : 128.1.0.0 ~ 191.254.0.0 (16386 - 2)

– Max Hosts/network : 65,536 - 2

• The most popular IP address assignment• 20% of class B were assigned by July 1990 and DOUBLING

every 14 months will be exhausted by Early 1994 (Not so bad) (projection on March, 1994) May you find the up-to-date info ?

Network Layer 26

Classes of Original IP Address (cont’d)

First three bytesFirst three bytes Last byteLast byte

111010 2121--bit network addressbit network address 88 bits of host addressbits of host address

Class CClass C

• Class C : 192.0.0.0 ~ 223.255.255.255

– Networks (Max) : 192.0.1.0 ~ 223.255.254.0 (2097154 - 2)

– Max Hosts /network : 256 - 2

Network Layer 27

Classes of Original IP Address (cont’d)

11110110 Multicast address (group ID)Multicast address (group ID)Class DClass D

• Class D : 224.0.0.0 ~ 239.255.255.255 (Multicasting)

- mapped to a physical address (assigned in the NIC)

1111101110 Reserved for future useReserved for future useClass EClass E

• Class E : 240.0.0.0 ~ 247.255.255.255 (Reserved)

Network Layer 28

Classful IP Addresses Summary

given notion of “network”, let’s re-examine IP addresses:

• Called “classful” addressing:class

1.0.0.0 to127.255.255.255

A 0network host

128.0.0.0 to191.255.255.255

B 10 network host

192.0.0.0 to223.255.255.255C 110 network host

224.0.0.0 to239.255.255.2551110 multicast addressD

32 bits

Page 8: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 29

Special IP Special IP AddressesAddresses

• Hostid = all 0 This network

• Netid = all 0 & Hostid = any Specified host on this Net

• Netid = all 0 & Hostid = all 0 The host on this Net

• Hostid = all 1 Broadcast on the specified network

(directed broadcast, getting through Router)

• Netid = all 1 & Hostid = all 1 LAN broadcast address

(limited broadcast, w/o getting through a Router)

• 127.x.x.x loop back address ~ for internal testing

(packets would not be sent onto network)

* Mostly, use 127.0.0.1 (Try: ping 127.0.0.1 under MS-DOS window)

* Those SIPs are applicable to the networks with subnetting

• Hostid = all 0 This network

• Netid = all 0 & Hostid = any Specified host on this Net

• Netid = all 0 & Hostid = all 0 The host on this Net

• Hostid = all 1 Broadcast on the specified network

(directed broadcast, getting through Router)

• Netid = all 1 & Hostid = all 1 LAN broadcast address

(limited broadcast, w/o getting through a Router)

• 127.x.x.x loop back address ~ for internal testing

(packets would not be sent onto network)

* Mostly, use 127.0.0.1 (Try: ping 127.0.0.1 under MS-DOS window)

* Those SIPs are applicable to the networks with subnetting

Network Layer 30

Private IP Addresses

• For local use only (allowing duplication among different LANs)

• A legal IP address only in a LAN (private use) but would not

be recognized by Internet (eg., routers)

• Three PIP’s range (RFC 1918) :

(reusable)

IP range Mask

10.0.0.0 ~ 10.255.255.255 255.0.0.0

172.16.0.0 ~ 172.31.255.255 255.240.0.0

192.168.0.0 ~ 192.168.255.255 255.255.255.0Note on PIP

Network Layer 31

A Note on Private IP AddressA Note on Private IP Address

IP IP addressRFC1918 Private IP address IP

IP Address ( )Private IP

Address Routing information

Private IP AddressPrivate IP Address

IP LAN InternetLAN IP IP

IP LAN IP(private network)

Network Layer 32

IP Fragmentation and Reassembly

network links have MTU (max.transfer size) - largestpossible link-level frame.

different link types, different MTUs

large IP datagram divided (“fragmented”) within net

one datagram becomesseveral datagrams

“reassembled” only at final destination

IP header bits used to identify, order related fragments

fragmentation:in:

one large datagramout:

3 smaller datagrams

reassembly

Page 9: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 33

How Does IP Handle Fragmentations ?How Does IP Handle Fragmentations ?

HLENHLEN Service TypeService Type Total LengthTotal Length

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

Time to LiveTime to Live ProtocolProtocol Header ChecksumHeader Checksum

VERSVERS

IdentificationIdentification FlagsFlags Fragment OffsetFragment Offset

• Different media allows for different-sized datagrams to be transmitted and received.

• Fragmentation allows a datagram that is too large to be forwarded to the next LAN segment to be broken up into smaller segments to be reassembled at the destination.

• The fragmentation occurs at the router that cannot forward

packet to the next interface directly.

• Applications should use path MTU discovery (RFC 1191)

to find the smallest datagram size. Send 576 if no information.Network Layer 34

Fragmentation Control in the IP Header

• Identification — Contains an integer that identifies the currentdatagram. The receiving IP layer use this field and source IP address to help piece togetherdatagram fragments. (16-bit)

• Flags — A 3-bit field of which the low-order 2 bits control fragmentation. One bit specifies whether the packet can be fragmented; the second bit specifies whether the packet is the last fragment in a series of fragmentedpackets.

• Fragmentation offset — Indicating the offset (in bytes) from theprevious datagram that continues the complete datagram.

• Fragments’ header duplicate most of the original datagram header.

Network Layer 35

Disadvantages:

- Larger buffers are required at intermediate gateways- All fragments of a datagram may be forced to pass throughthe same gateway. This inhibits the use of dynamic routing.

Router

NetworkMTU = 500

Router

Ethernet 1MTU = 1500

Ethernet 2MTU = 1500

Host A Host BFragment. . . . . .

BA

• Example

IP Fragmentation and Reassembly

MTU examples: FDDI ~ 4352; X.25 ~ 576; PPP ~ 296 bytes

(Done by routers in today’s Internet) Network Layer 36

IP FAR (cont’d)

• Flag0 DF MF0 1 2

MF: More Fragments0 ~ Last Fragment1 ~ More Fragment

DF: Don’t Fragment0 ~ May Fragment1 ~ Don't Fragment

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 becomesseveral smaller datagrams

IN: 3980 data bytes;IP header = 20 bytes

• IP reconstructing ~ by total length

and offset

Page 10: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 37

IP Addressing: the Last Word

Q: How does an ISP get block of addresses?

A: ICANN: Internet (Corporation for) Assigned Names and Numbers (RFC 2050)

allocates addresses by three regional Internet registries

• American Registry for Internet Number (ARIN)– handles registrations for North and South America, as well as

parts of Africa

• Reseaux IP Europeans (RIPE)– covers Europe and nearby countries

• Asia Pacific Network Information Center (APNIC)

manages DNS (root DNS servers)

assigns domain names, resolves disputes

reseau ~IP problems ? Network Layer 38

IP Routing - Getting a Datagram from Src to DestIP Routing IP Routing -- Getting a Datagram fromGetting a Datagram from SrcSrc toto DestDest

IP packet/datagram:

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

BE

Misc.fields

sourceIP addr.

destIP addr. data

• datagram remainsunchanged, as it travels along routers (from source to destination)

• address fields of

interest here

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

Internal Routing table in A

router

(a preview)

?

?

Note: 223.1.1 223.1.1.0/24

Network Layer 39

Forwarding a datagram – Scenario 1Forwarding a datagram Forwarding a datagram –– Scenario 1Scenario 1

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

BE

Starting at A, given IP datagram addressed to B:

• look up net. address of B first

• find B is on same network as A

– By consulting its IRT

• link layer will send datagramdirectly to B inside link-layer frame (discussed later)

B and A are directly/physicalconnected

Dest. Net. next router Nhops

223.1.1 route directly 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

Misc.fields 223.1.1.1 223.1.1.3 data

A B

Here, 223.1.1 223.1.1.0/24

Internal Routing Table in A

Network Layer 40

Forwarding a datagram – Scenario 2Forwarding a datagram Forwarding a datagram –– Scenario 2Scenario 2

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

BE

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

miscfields 223.1.1.1 223.1.2.3 data

A E

(next hop)

Starting at A, dest. E:

• look up network address of E

• E on different network (sinceNhop=2)

A, E are not directly connected

• 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…..)

Page 11: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 41

Forwarding a datagram – router’s actionForwarding a datagram Forwarding a datagram –– routerrouter’’s actions action

miscfields 223.1.1.1 223.1.2.3 data

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.3.2

223.1.2.1

223.1.2.2

223.1.3.1

223.1.3.27

A

BE

network router Nhops interface

223.1.1 - 1 223.1.1.4223.1.2 - 1 223.1.2.9

223.1.3 - 1 223.1.3.27

Dest. next

A E

??Arriving at 223.1.1.4, destined

for 223.1.2.2

• look up network address of E

• 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!!! (hooray!)

Network Layer 42

List of ReachableNetworks

Packet PacketIn Out

Switchmechanism

Packet Packet

Frames Frames

RouterRouter -- the Internet Packet Forwarding Devicethe Internet Packet Forwarding Device

• Routing is an overhead activity (store-and-forward)

• Performance is derived from switching mechanism (forwarding rate in PPS)

• Capability depends upon the protocols (e.g., IP, IPX) and interfaces (ports)

[e.g., E, FE, ATM(25,155.5,622.02 Mbps or more), T1/E1, T3] it can support

• Separate networks from broadcast and independent of OS and networks

Network Layer 43

Actions Taken by a Router upon Receiving a Packet

Header andchecksum valid?

Decrement TTL;TTL >= 0?

If route is available,search for MACaddress in ARP

cache

Build new packet withMAC address and

route packet throughport found in routing

table.

Received ARP reply,insert MAC and IP

address intoARP table

NO

YES YES

YES

NO

NO

Packet ReceivedPacket Received

Routefound?

Default routeavailable?

Discard originalpacket

Send ICMPerror messageto originator

YES

NOMAC address

found?

Route Table lookupbased on

destination address

Send ARP requestand wait for a

response

ReceivedARP

Reply?

YES

NO

YESNO

Network Layer 44

IP Packet Forwarding over InternetIP Packet Forwarding over Internet

HostHost -- 129.1.1.1129.1.1.1

BB

CC

EE

129.2.1.1129.2.1.1

RouterRouter

AA

DD

HostHost -- 129.1.1.2129.1.1.2What if the MAC address is unknown

DADA SASA TF DataTF Data CRCCRC

129.1.1.3129.1.1.3 IP HeaderIP Header

DD CC 08000800 129.2.1.2129.2.1.2 129.1.1.2129.1.1.2 IP DataIP Data CRCCRC

IP HeaderIP Header

BB AA 08000800 129.2.1.2129.2.1.2 129.1.1.2129.1.1.2 IP Data CRCIP Data CRC129.2.1.2129.2.1.2

Page 12: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 45

Some a prior information are needed

before sending out a Packet

• What if the MAC address of a destination is unknown giving IP address ?

Calls for ARPARP to find it out

• What if the IP address is unknown giving host nameonly?

Calls for DNS lookupDNS lookup

Network Layer 46

Address Resolution Protocol (ARP)Address Resolution Protocol (ARP)Address Resolution Protocol (ARP)

• RFC 826.

• TCP/IP addresses are 32 bits and represent a network, subnet, and host ID.

• Addresses on LANs are represented by physical (MAC) layer addresses and they are 48 bits in length.

• ARP provides the mapping between a host’s 32-bit IP address and its 48-bit MAC address.

• ARP works only on the local subnet (it cannot traverse routers).

• ARP builds a table of IP/MAC addresses to properly format a source and destination address field in a packet (ARP cache).

Oops

Network Layer 47

ARP Operations : Request and ReplyARP Operations : Request and ReplyARP Operations : Request and Reply

~ IP address (4-byte) MAC address (6-byte) service

• ARP request (via broadcasting) :

A asks MAC address of B (with IP address given) = ?

• ARP reply :B (only) replies its MAC address; others keep silent

A

B

routerAn LAN segment

A

B

routerAn LAN segment

(ARP ignored)

Network Layer 48

ARP Packet FormatARP Packet Format

DADA SASA TFTF CRCCRCDataData

Protocol address of the destination stationProtocol address of the destination station

Hardware address of the destination stationHardware address of the destination station

Protocol address of the source stationProtocol address of the source station

Hardware address of the source stationHardware address of the source station

OperationOperation

Length of protocol addressLength of protocol addressLength of headerLength of header

Type of protocol addressType of protocol address

Type of hardware addressType of hardware address

(ARP over Ethernet directly)

HA type = 1 (for Ethernet) ; PA type = 0x0800 (w/ IP)Operation = 1 (request) or 2 (response)

Page 13: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 49

ARP : Sending, Identifying, and CachingARP : Sending, Identifying, and CachingARP : Sending, Identifying, and Caching

• Transmit ARP in a frame

• Identifying ARP frame

• ARP software maintains a small table of bindings(IP MAC address) in memory – called ARP cache~ to reduce network traffic (but not last for too long)

Network Layer 50

ARP : Local and RemoteARP : Local and RemoteARP : Local and Remote

• Router replies its MAC address if B is located out of the segment

Subnet mask

local

remote ARP broadcast packet ~ Get router’s MAC address

ARP broadcast packet~ Get local destination’s

MAC addressTo find B’s MAC addr

• To see the ARP cache (maintained by the station for a short period)- arp –a (empty, when you just open it)- arp –a (check arp cache after a few connections)

• RARP (Reverse ARP) ~ In contrast to ARP~ MAC address IP address mapping services~ For diskless devices (a way of managing IP address)

Network Layer 51

Domain Name Service (DNS)Domain Name Service (DNS)Domain Name Service (DNS)

• Domain ( ) ~ the coverage of a Netid (network)

• DNS ~ Hierarchical ( ) naming rules in internet

– Example: Host name -- en.ntut.edu.tw, www.edu.tw

www.epson.com.tw

• Domain Name System Server (DNS server)~ containing a database (look-up table) for host name to

IP address mapping

– Example: Host nameen.ntut.edu.tw IP address = 140.124.70.26

Network Layer 52

DNS Naming RuleDNS Naming RuleDNS Naming Rule

Example: Naming hierarchy in internet

* Note: root is generally unnamed

root* (use country/area, tw)

edu

ntu

sun

ntutnctu

en

ftp

cc

Top-level domains

formingorder

sun.cc.ntut.edu.tw

Host name:en.ntut.edu.tw

(Enterprise 3000)

(Ultra 5)

second-level domains

govcom

Page 14: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 53

• Links among DNS servers

- All DNS servers are linked together to form a unified system

- Each server knows how to reach a root server and servers thatare authorized by itself (the further down the hierarchy)

DNS (cont’d)

Question: How does a DNS server know which other DNS server is the authority for a given name ?

Answer: It does not know. Gee!

• Resolving a name (machine)

- The DNS server know where is the root DNS server and resolve the name from there

- the resolver acts as a client by sending DNS request toother DNS servers for name resolving (call for help)

Network Layer 54

Name Resolving OperationName Resolving OperationName Resolving OperationExample: (iterative resolution - one of query methods)

A remote site (say, syl.ntu.edu.tw) sends a request to its local DNS server

‘ntu.edu.tw’ for resolving the name “ kwk.en.ntut.edu.tw ”

edu

tw

ntu

sun

ntutncu

en

ftp

cc

server forntut.edu.tw

Ftp kwk.en.ntut.edu.tw2

3. Reply ntut.edu.tw’s IP

kwk wkc

4

5

7. Reply kwk.en.ntut.edu.tw’s IP

67

??

8root serveredu.tw - 140.111.1.2

syl.ntu.edu.tw1

5. Reply en.ntut.edu.tw’s IP

The authority server of“ x.en.ntut.edu.tw ”

Network Layer 55

URL (Uniform Resource Locator)URL (Uniform Resource Locator)URL (Uniform Resource Locator)

• URL ( )

~ providing a uniform way to access resources in the Web

• Format– “protocol”:// “host name” “port” “path”

– Examples:

1. http://www.news.edu.tw :8080 /path/file/index.html

=/or server’s IP address port # (default = 80 for httpserver)

* Server’s address: www .news. edu. tw

2. file:///C:/ProgramFiles/Netscape/kwk/bookmark.htm

• URL ( )

~ providing a uniform way to access resources in the Web

• Format– “protocol”:// “host name” “port” “path”

– Examples:

1. http://www.news.edu.tw :8080 /path/file/index.html

=/or server’s IP address port # (default = 80 for httpserver)

* Server’s address: www .news. edu. tw

2. file:///C:/ProgramFiles/Netscape/kwk/bookmark.htm

Domain(machine name)

Network Layer 56

URL Examples

1. Gopher://mitdir.mit.edu:1052. Mailto:[email protected]. News:com.dcom.cell-relay

Page 15: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 57

Summary of IP Transfer over InternetSummary of IP Transfer over InternetSummary of IP Transfer over Internet

TokenRing

Router

C

B

RouterA

Internet

• Case 1: A B ~ direct (no router involved)

• Case 2: A C ~ indirect (via default router first)Be referring tosubnet/net mask

all the timeDest & Src MAC addr altered hop-by-hop,but IP addresses keep unchanged through.

DestinationMAC addr

SourceMAC addr

Type0800H

IP header:

SRC IP DEST IP

IP dataarea CRC

(via DNS if any)

IP packetEthernet Header

(via ARP if any)Example

Network Layer 58

IP Addresses: How to get one?IP Addresses: How to get one?IP Addresses: How to get one?

Hosts (host portion):• Manual configuration:

– hard-coded by system administrator into the host (in a file)

• DHCP: Dynamic Host Configuration Protocol: (RFC 2131)

(dynamically get address: “plug-and-play”)

DHCP Protocol’s Four-step process:

– 1. “DHCP server discovery”– 2. “DHC server offer(s)”– 3. “DHCP request”– 4. “DHCP ack”

DHCP is an extension of BOOTP (RFC1542) and is used extensively in LANs and in residential Internet access.

~

~ IP

(explained later)

Network Layer 59

Immediate IPv4 Problems

• Running out of network ID’s . . .• Solution:

Subnetworking (subnetting)

• Running out of IP addresses . . .• Solutions:

DHCPNATCIDR

Network Layer 60

• What is a Subnet ?~ A network segment (with different network ID in their

IP address) separated by routers.Customer SiteCustomer Site

130.1130.1.0.0.0.0130.1.130.1.11.0.0130.1.130.1.22.0.0130.1.130.1.33.0.0. . . . . . .. . . . . . .

130.1.130.1.255255.0.0

InternetInternet

Class B Invisible to Internet

SubnettingSubnetting –– Dividing the Network LocallyDividing the Network Locally

• Why need a subnet ?

~ to create more networks ID (by reducing host ID)

~ to help conserve the IP address space

Page 16: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 61

Subnetting by Subnet MaskSubnettingSubnetting byby Subnet MaskSubnet Mask

• How to do it ?~ One network assigned to a site and it is allowed to

“chop” up that network number to create subnets.

~ by “subnet mask” that divides the IP address into subnets

(RFC 950)

Net ID Host ID

Network Layer 62

3 5

Defining a Subnet MaskDefining a Subnet MaskDefining a Subnet Mask

1 1 1 1 1 1 1 11 1 1 1 1 1 1 1

128128128192192192

224224224240240240

248248248252252252

254254254255255255

128 64 32 16 8 4 2 1128 64 32 16 8 4 2 1128 64 32 16 8 4 2 1

Subnet mask = 255.255.255.224

OriginalHost field

Static subnetting

• Example – Define a subnet mask

Network Layer 63

SubnettingSubnetting ExampleExample

• IP address assignment 150.5.0.0.• Requirements of 75 subnets and 75 hosts per subnet.• First set is to find out how many bits are needed for 75 subnets ?

– 25 = 32, 26 = 64 and 27 = 128 > 75 therefore we needn = 7 bits to subnet for 75 subnets

– This leaves 9 bits for host assignment (16 - 7) which allowsfor 510 hosts

• Subnets are masked starting from the left and hosts are configuredstarting from the right.

nsubnetsofno 2

with respect to “old Host ID field”

Result: 150 . 5 . X X X X X X X150 . 5 . X X X X X X X X . X X X X X X X XX . X X X X X X X X

Subnet MaskSubnet Mask Host AddressHost Address255.255.254.0255.255.254.0

Network Layer 64

Subnetting ExerciseSubnettingSubnetting ExerciseExercise

A Class C IP address = 203.54.48.0 ~ 256 nodes max.

Wanted: Subnetting it to FOUR subnets .

Require to set Subnet Mask = 255.255.255. xxx

11111111.11111111.11111111.xxxxxxxx

• The resulting subnet IP addresses:

IP address for subnet #1 = 203.54.48. ~ 203.54.48. x

IP address for subnet #2 = 203.54.48. ~ 203.54.48. x

IP address for subnet #3 = 203.54.48. ~ 203.54.48. x

IP address for subnet #4 = 203.54.48. ~ 203.54.48. x

• What is the broadcast addresses for each subnet ?

Cont’d . . . on IP RoutingStatic subnet

Page 17: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 65

DHCP: Dynamic Host Configuration ProtocolDHCP: Dynamic Host Configuration ProtocolDHCP: Dynamic Host Configuration Protocol

* Obtaining a host address automatically, Method - I:

Goal:- Allow host to dynamically obtain its IP address from network

server when it joins network- Can renew its lease on address in use- Allows reuse of addresses (only hold address while connected an

“on” )- Support for mobile users who want to join network (more shortly)

• DHCP operations:– host broadcasts “DHCP discover” msg– DHCP server responds with “DHCP offer” msg– host requests IP address: “DHCP request” msg– DHCP server sends address: “DHCP ack” msg

Network Layer 66

DHCP ClientDHCP Client--Server ScenarioServer Scenario

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

B

E

DHCP

server

arriving DHCPclient needsaddress in thisnetwork

223.1.2.5

May I have an IP address?

Double click

Network Layer 67

DHCP client-server scenario (explained)DHCP clientDHCP client--server scenario (explained)server scenario (explained)

arrivingclient

time

DHCP discover

src : 0.0.0.0, 68 ( BOOTP client port)dest.: 255.255.255.255,67 (server port)Your inet addr: 0.0.0.0transaction ID: 654

DHCP offer

src: 223.1.2.5, 67dest: 255.255.255.255, 68Your inet addr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs

DHCP request

src: 0.0.0.0, 68 dest:: 255.255.255.255, 67Your inet addr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs

(if choosing)

Echo back

DHCP server: 223.1.2.5

src: 223.1.2.5, 67dest: 255.255.255.255, 68Your inet addr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs(yiaddr – addr allocated to the new client)

DHCP ACK

renewNetwork Layer 68

NAT: Network Address TranslationNAT: Network Address TranslationNAT: Network Address Translation

* Obtaining a host address automatically, Method - II:

10.0.0.1

10.0.0.2

10.0.0.3

10.0.0.4

138.76.29.7

Local/private network(e.g., home network)

10.0.0/24

Datagrams with source ordestination in this networkhave 10.0.0/24 address for source, destination (as usual)

All datagrams leaving localnetwork have same single source NAT IP address: 138.76.29.7,different source port numbers

NAT-enabled

rest ofInternet

Page 18: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 69

NAT (cont’d)NAT (contNAT (cont’’d)d)

• Motivation: local/private network uses just one IP address as

far as outside word is concerned:

– no need to be allocated range of addresses from ISP: - just

one (or more ?) IP address is used for all devices

– can change addresses of devices in local network without

notifying outside world (but this violates ene-to-end argument in

Internet)

– can change ISP without changing addresses of devices in

local network

– devices inside local net are not explicitly addressable and

visible by outside world (a security plus).Network Layer 70

NAT (cont’d)NAT (contNAT (cont’’d)d)

• Implementation: NAT router must (do for)– outgoing datagrams: replace (source IP address, port #) of

every outgoing datagram to (NAT IP address, new port #)

. . . remote clients/servers will respond using (NAT IP address, new

port #) as destination addr.

– remember (in NAT translation table) every (source IP

address, port #) to (NAT IP address, new port #) translation

pair

– incoming datagrams: replace (NAT IP address, new port #)

in dest fields of every incoming datagram with

corresponding (source IP address, port #) stored in NAT

table

Network Layer 71

NAT ExampleNAT Example

10.0.0.1

10.0.0.2

10.0.0.3

S: 10.0.0.1, 3345D: 128.119.40.186, 80

110.0.0.4

138.76.29.7

1: host 10.0.0.1sends datagram to 128.119.40, 80

NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…… ……

S: 128.119.40.186, 80D: 10.0.0.1, 3345 4

S: 138.76.29.7, 5001D: 128.119.40.186, 802

2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table

S: 128.119.40.186, 80D: 138.76.29.7, 5001 3

3: Reply arrivesdest. address:138.76.29.7, 5001

4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345

Network Layer 72

NAT (cont’d)NAT (contNAT (cont’’d)d)

• 16-bit port-number field: – 60,000 simultaneous connections with a single LAN-

side address!

• NAT is controversial:– routers should only process up to layer 3

– violates end-to-end argument• NAT possibility must be taken into account by app designers,

eg, P2P applications

– address shortage should instead be solved by IPv6

– NAT is a stopgap solution Ipv6 enthusiastic person’scomplaint( )

Page 19: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 73

What’s Wrong with the IP Addressing ?WhatWhat’’s Wrong with the IP Addressing ?s Wrong with the IP Addressing ?

• 32-bit IP address

~ Allows for 4,294,967,296 unique addresses

- Addresses are grouped in a class (group), most of whichare wasted .

• Addresses were arbitrarily handed out without regard to geographic location :

- Class A stopped being handed out (running out).- Class B was near depletion (ex., 3000 out-of-65534 left)- Class C addresses were overtaxing the Internet routing

tables.

• RFC 1338 introduced supernetting for fixing.

(May, 1996)

Network Layer 74

Problem with Class C IP Address AssignmentProblem with Class C IP Address AssignmentProblem with Class C IP Address Assignment

• Subnetting (RFC 950) – provides better address spacegranularity within each network

Solves problem - “running out of class B Address”

• However, it introduces another problem . . .

~ more than 50 percent of the businesses were small

and medium-sized. Class C addresses were needed.

Every class C address requires a routing table entry

Internet routing tables explosionInternet routing tables explosion

• How to prevent this ?

Solution Using “Classless Inter-Domain Routing”

Network Layer 75

Flexible and Efficient IP Address AssignmentsFlexible and Efficient IP Address AssignmentsFlexible and Efficient IP Address Assignments

• Variable Length Subnet Masks (VLSM)~ placing a variable-length subnet mask on a single IP

network number. -- the first thought

• Terminology:

- Supernetting ~ applying a mask to an IP address that is

shorter than its natural (default) mask.

- Address aggregation ~ summarizing contiguous blocks of

IP networks as one advertisement.(Route)

Subnetting … longer than …

• Classless Inter-Domain Routing (CIDR)

~ An advertisement mechanism that allows for advertising

routes without regard to Class assignment. The route could

be identified by a supernet or by an extended subnet mask.Network Layer 76

Classless InterDomain Routing : A ISP’s Partition of IP addresses

ClasslessClassless InterDomainInterDomain Routing : A Routing : A ISPISP’’s Partition of IP addressess Partition of IP addresses

Network (network portion):

• get allocated portion of ISP’s address space:

ISP allocated the block andgive those smaller blocks out

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23

Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23

Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23... ….. …. ….

Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

(divide into 8 blocks)

* CIDR facilitates hierarchical routing

Page 20: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 77

Hierarchical addressing: route aggregationHierarchicalHierarchical addressing:addressing: route aggregationroute aggregation(route summarization)

• Hierarchical addressing allows efficient advertisementof routing information – use a single network prefix toadvertise multiple networks route aggregation

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

ISP - A

Organization 0

Organization 7

Organization 1

ISP - B“Send me anythingwith addresses beginning 199.31.0.0/16”

200.23.20.0/23Organization 2

...

...

Advertises to outside world . . .

“Send me anythingwith addresses beginning200.23.16.0/20”

The rest of the world need not know that within the address block 200.23.16.0/20there are 8 other organizations/networks.

Internet

Network Layer 78

Longest Prefix Matching: more specific routesLongestLongest PrefixPrefix MatchingMatching: more specific routes: more specific routes( more specific address prefix)

• ISP-B has a more specific route to Organization 1

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

ISP - A

Organization 0

Organization 7 Internet

Organization 1ISP - B “Send me anything

with addresses beginning 199.31.0.0/16or 200.23.18.0/23”

200.23.20.0/23Organization 2

...

...

(moved but keep the IP address unchanged)

“Send me anythingwith addresses beginning200.23.16.0/20”

Renumbering IP? No!

200.23.18.0/23

Router’s operation

Network Layer 79

Internet Control Message Protocol (ICMP)Internet Control Message Protocol (ICMP)Internet Control Message Protocol (ICMP)

• The internetworking facility does not guarantee successfuldelivery of every datagram

• Datagram may be discarded for a number of reasons :

– lifetime expiration (in TTL field)

– congestion (in Network)

– bit error (being detected)

• Internet flow control allows gateways or receiving stations, or both, to limit the rate at which they receive data.

• The best approach would seem to be to send flow control packets. This can be done using the ICMP protocol (RFC 792)

• ICMP provides feedback about problems in the communicationenvironment that require attention.

Network Layer 80

ICMP Packet Format 0 8 15 31

IP Header (20 bytes)

Type Code Checksum

Contents depends on type and code

ParametersICMPmessage

64-bit ICMPheader

• Type ~ specify the ICMP message is a query or an error(e.g., type = 3, 4, 5, 11, 12)

• Code ~ distinct type of error or queryEx: type & code = 3 & 3 port unreachable

• Checksum ~ covers the entire ICMP message (required)

• An ICMP error message is never generated in response to an ICMP error message.

Page 21: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 81

ICMP Message FormatsICMP Message FormatsICMP Message Formats

Network Layer 82

ICMP Message Types ICMP Message Types –– Currently UsedCurrently Used

• Destination Unreachable (network, host, protocol, port)• Time Exceeded (TTL = 0 during transit, in Traceroute)• Parameter Problem (bad IP header, e.g., improper options)

• Source Quench (elementary Flow control, reduce the transmission rate of sending-end)

• Redirect (Migrate to a better path for network or host)• Echo Request Testing the communication path,• Echo Reply e.g., used in ping program• Timestamp Request (Sampling the delay characteristics

of the internet)• Timestamp Reply

Network Layer 83

ICMP message Transport ICMP message Transport ICMP message Transport

• Error messages go back to original source (may cross internet)

• Message carried in IP (specified by IP type)

• Although ICMP is at the same level as IP (a part of the IP

layer), it is a user of IP.

• No error messages about ICMP error messagesNetwork Layer 84

Protocol Number (type) in IP PacketProtocol Number (type) in IP Packet

0 Reserved1 Internet Control Message Protocol (ICMP)2 Internet Group Management Protocol (IGMP)3 Gateway-to-Gateway Protocol (GGP)4 IP (IP encapsulation)5 Stream6 Transmission Control Protocol (TCP)8 Exterior Gateway Protocol (EGP)9 Private Interior Routing Protocol17 User Datagram Protocol (UDP)41 IP Version 6 (IPv6)50 Encap Security Payload for IPv6 (ESP)51 Authentication Header for IPv6 (AH)89 Open Shortest Path FirstReference: Internet STD 2 — Assigned Internet Numbers.

(or RFC 1700)

Page 22: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 85

ExampleExample –– Echo Request/Reply Echo Request/Reply

192.1.1.1192.1.1.1 192.1.1.2192.1.1.2

192.1.2.1192.1.2.1192.1.2.2192.1.2.2Echo RequestEcho Request

Echo ReplyEcho Reply

router

192.1.1.2192.1.1.2

• Sender: record the txing time in ICMP data field and subtract it fromthe current time when receiving the returned ICMP packet

• Used in “ping” or “TCP delay estimation”Network Layer 86

Ping - Packet INternet GroperPingPing -- PPacketacket ININternetternet GGroperroper

- Ping uses the ICMP Echo and Echo Reply messages

to determine whether a host is reachable.

• ping loopback-address* (Ex: 127.0.0.1)

~ verifies the operation of NIC and base TCP/IP software

• ping a-Host’s-IP-address (self & a subnet neighbor)

~ verifies whether the physical network device can be

addressed. (still be ok even without a router/gateway)

• ping gateway’s-IP-address

~ verifies whether the gateway (your LAN’s router) works

• ping a-remote-host-name (or DNS server’s IP directly)

~ verifies the operation of the name server

Network Layer 87

Routing PrincipleRouting Principle

Graph abstraction for routing algorithms:

graph nodes are routers

graph edges are physical links

Goal: determine “good” path(sequence of routers) thru

network from source to DEST.

Routing protocol

“Good” path:

typically means minimumcostcost path

Cost hops/links/delay

• link cost: delay, $ cost, or congestion level

(other definitions are possible)

F

A

ED

CB

F2

21

3

1

1

2

53

5Ex:

17 paths possible!

Network Layer 88

Routing Algorithm Classifications

GlobalGlobal oror decentralizeddecentralizedinformation?information?

Global:Global:All routers have completetopology (connectivity) andlink cost infoKnown as link state algorithms

Decentralized:Decentralized:Router only knows physically-connected neighbors and link costs to neighborsIterative process of computation, exchange of info with neighborsKnown as distance vectoralgorithm

StaticStatic oror dynamic?dynamic?

Static:Static:

Routes (routing information) change slowly over time

DynamicDynamic:

Routes change morequickly

• periodic update, or

• in response to link cost changes

Page 23: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 89

A LinkA Link--State Routing AlgorithmState Routing Algorithm

DijkstraDijkstra’’ss algorithmalgorithmNet topology and link costs are known to all nodes

accomplished via “link state broadcast”all nodes have same info

Computes least cost paths fromone node (‘source”) to all othernodes (candidate destinations)

gives routing table for thatnode

Iterative: after k iterations, know least cost path to k destinations

Notation:

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

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

p(v): predecessor node alongpath from source to v, that is next v

N: set of nodes whose least cost path definitively known

Network Layer 90

Dijsktra’s AlgorithmDijsktra’s Algorithm

1 Initialization (step 0):2 N = {A}3 for all nodes v 4 if v adjacent to A /* directly attached */5 then D(v) = c(A,v)6 else D(v) = infinity78 Loop:9 find w not in N such that D(w) is a minimum10 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) )

13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */15 until all nodes in N

Network Layer 91

DijkstraDijkstra’’ss AlgorithmAlgorithm -- ExampleExample

Step012345

start NA

ADADE

ADEBADEBC

ADEBCF

D(B),p(B)2, A2, A2, A

D(C),p(C)5, A4, D3, E3, E

D(D),p(D)1, A

D(E),p(E)infinity2, D

D(F),p(F)infinityinfinity4, E4, E4, E

A

ED

CB

F2

21

3

1

1

2

53

5 • For each node, we got its predecessor along the least-cost path from the src, and so forth for each predecessor.

• Then the source node constructs its next-hop node to the given destination.

V = {A, B, C, D, E, F} Network Layer 92

FYI

DijkstraDijkstra’’ss AlgorithmAlgorithm’’s Complexitys Complexity

Algorithm complexity: suppose n nodes (excluding the source node)

each iteration: need to check all nodes, w, not in N

Need n(n+1)/2 comparisons: O(n**2)

Calls for more efficient implementations O(n·logn) (A

more sophisticated implementation of this algorithm,

using a data structure known as a heap, can find the

minimum in line 9 in logarithmic rather than linear time,

thus reducing the complexity.

Page 24: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 93

FYIDijkstraDijkstra’’ss AlgorithmAlgorithm’’s Instabilitys Instability

Oscillations for asymmetry links

Ex: link cost amount of carried traffic (e.g., delay)

A

D

C

B2+e 0

001+e 1

e

1 1

(b) B, C deteectbetter path to A, CW

A

D

C

B1 1+e

e00 0

trafficoriginated

B A

D A

C A

(a) Initial routing

e

1 1

(c) B,C,D detect betterpath to A, CCW A

D

C

B0 2+e

1+e10 0

e

1 1

A

D

C

B2+e 0

e01+e 1

e

1 1

(d) B,C,D detect betterpath to A, CW

Network Layer 94

Distance Vector Routing AlgorithmDistance Vector Routing AlgorithmDV is . . . DV is . . .

distributed:distributed:

each node communicatesonly with directly-attached neighbors

Iterative:Iterative:

continues until no infoexchanged between neighbors (self-terminating:no “signal” to stop)

asynchronous:asynchronous:

nodes need not exchangeinfo/iterate in lock step w/ each other

Distance Table data Distance Table data structurestructure

each node has its own tableone row for each possible destinationcolumn for each directly-attached neighbor to nodeexample: in node X, for dest. Y via neighbor Z:

Network Layer 95

Distance Table: an ExampleDistance Table: an Example

D (Y,Z)X distance from X to

Y, via Z as next hop

c(X,Z) + min {D (Y,w)}Z

w

=

=

Distance:

A

E D

CB7

81

2

1

2

D ()

A

B

C

D

A

1

7

6

4

B

14

8

9

11

D

5

5

4

2

Ecost to destination via

dest

inat

ion

D.T. for E

D (C,D)E

c(E,D) + min {D (C,w)}D

w== 2+2 = 4

D (A,D)E

c(E,D) + min {D (A,w)}D

w== 2+3 = 5

D (A,B)E

c(E,B) + min {D (A,w)}B

w=

= 8+6 = 14

Loop back!

Loop back!Network Layer 96

Routing Table – from Distance Table

D ()

A

B

C

D

A

1

7

6

4

B

14

8

9

11

D

5

5

4

2

Ecost to destination via

dest

inat

ion

A

B

C

D

A,1

D,5

D,4

D,2

Outgoing linkto use, cost

dest

inat

ion

Routing tableDistance table

Page 25: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 97

Distance Vector Routing: OverviewDistance Vector Routing: Overview

wait for (change in locallink cost of msg fromneighbor)

recompute distance table

if least cost path to anydest has changed, notifyneighbors

Each node:Iterative, asynchronous: eachlocal iteration caused by:

local link cost change

message from neighbor: its least cost path change fromneighbor

Distributed:

each node notifiesneighbors only when its least cost path to any destination changes

neighbors then notify their neighbors if necessary

Network Layer 98

BellmanBellman--Ford AlgorithmFord Algorithm

At all nodes, X:At all nodes, X:

1 Initialization:2 for all adjacent nodes v: 3 D (*,v) = infinity

/* the “ * ” operator means "for all rows" */ 4 D (v,v) = c(X,v)

5 for all destinations, y

6 send min D (y,w) to each neighbor /* w over all X's neighbors */

7

X

X

W

X

Network Layer 99

BellmanBellman--FordFord Algorithm (cont.)Algorithm (cont.)8 loop9 wait (until it sees a link cost change to neighbor V 10 or until it receives an update from neighbor V)1112 if ( c(X,V) changes by an amount of d)13 /* change cost to all dest's via neighbor v by d */14 /* note: d could be positive or negative */

15 for all destinations y: D (y,V) = D (y,V) + d1617 else if ( update received from V w.r.t. destination Y)18 /* shortest path from V to some Y has changed */

19 /* V has sent a new value for its min D (Y,w) */

20 /* call this received new value is "newval" */

21 for the single destination y: D (Y,V) = c(X,V) + newval2223 if we have a new min D (Y,w) for any destination Y

24 send new value of min D (Y,w) to all neighbors25 forever

w

XX

X

X

X

w

w

v

(at each node X)

recomp.

recomp.

Network Layer 100

Distance Vector Algorithm: an Example

X Z12

7

Y

~ current minimum path cost to a destination~ a new minimum cost has been computed

Page 26: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 101

Distance Vector Algorithm: example• update received from V w.r.t. destination Y

X Z12

7

Y

need to be recomputed(B-F algorithm line 21)

D (Y,Z)X

c(X,Z) + min {D (Y,w)}w=

= 7 + 1 = 8

Z

Triggered by Z:

D (Z,Y)X

c(X,Y) + min {D (Z,w)}w=

= 2 + 1 = 3

Y

Triggered by Y:newval

Network Layer 102

Comparison of LS and DV algorithmsComparison of LS and DV algorithms

1. Message complexity1. Message complexityLS: with n nodes, E links, O(nE) msgs sent each DV: exchange between neighbors only

convergence time varies

3. Speed of Convergence3. Speed of ConvergenceLS: O(n**2) algorithmrequires O(nE) msgs

may have oscillationsDV: convergence time varies

may be routing loopscount-to-infinity problem

2. Robustness2. Robustness:~ what happens if router

malfunctions?LS:

node can advertise incorrect link costeach node computes only its own table

DV:DV node can advertise incorrect path costeach node’s table used byothers• error propagate thru

network indirectly

Network Layer 103

Realistic Routing Issues in InternetRealistic Routing Issues in Internet

Our routing study thus far - idealization

all routers identical

Network structure is “flat”… Noooooo! It is not true in practice.

scalescale:with more than 50 milliondestinations and routers:

can’t store all dest’s in routing tables!routing table exchange by LS or DV would swamp links No more BW left for sending data packets

administrative autonomyadministrative autonomy::

internet = network of networks

each network administratormay want to control routing in its own network

Network Layer 104

Hierarchical RoutingSolution: aggregate routersinto regions “autonomoussystems” (AS)

Routers in same AS run same routing protocol (DV or LS)

“intra-AS” routingprotocol

Routers in different ASs canrun different intra-AS routing protocols via gateway routers

Special routers in ASRun intra-ASrouting protocol with all other routers in AS

Also responsible for routing to destinations outside AS

run inter-AS routingprotocol with other gateway routers

gateway routers

(Idea: next page)

Page 27: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 105

Hierarchical - Intra-AS and Inter-AS RP

a

b

b

aaC

A

Bd

A.aA.c

C.b B.a

cb

Host h2

Inter-ASrouting

betweenA and B

Intra-AS routingwithin AS B

c

Gateway

Host h1

Intra-AS routingwithin AS A

inter-AS, intra-ASrouting in gateway A.c

Network Layer 106

Routing in the TodayRouting in the Today’’s Internets Internet

The Global Internet consists of Autonomous Systems (AS)interconnected with each other:

AS: comprised of multiple networks/routers sharing all routing information under a single administration (i.e., routing protocol)Stub AS: small corporation: one connection to other AS’sMultihomed AS: large corporation (no transit) with

multiple connections to other AS’sTransit AS: service provider, hooking many AS’s together

Two-level routing: Intra-AS: administrator responsible for choice of routing

algorithm within network ~ RIP, OSPFInter-AS: unique standard for inter-AS routing ~ BGP

Network Layer 107

IntraIntra--AS RoutingAS Routing

Also known as Interior Gateway Protocols (IGP)

Most common Intra-AS routing protocols:

RIP: Routing Information Protocol

OSPF: Open Shortest Path First

IGRP: Interior Gateway Routing Protocol (Cisco proprietary)

Network Layer 108

RIP ( Routing Information Protocol)RIP ( Routing Information Protocol)RIP ( Routing Information Protocol)

Adopted by Xerox Network System architecture firstly

Included in BSD-UNIX Distribution in 1982

Use Distance vector algorithm

Distance/cost metric: # of hops (max = 15 hops)

Can you guess why?

Distance vectors: exchanged every 30 sec via Response

Message (called RIP advertisement) with neighboring routers

Each advertisement contains up to 25 destination networks

RIPv1~ RFC 1058; RIPv2 ~ RFC 2453 (allows route aggregation)

For classful addressing, no VLSM supporting

Page 28: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 109

RIP Version 2 RIP Version 2 –– Packet FormatPacket Format

CommandCommand VersionVersion UnusedUnusedRoute TagRoute TagAddress Family IdentifierAddress Family Identifier

Net 1 addressNet 1 addressSubnet mask (v2 only)Subnet mask (v2 only)NextNext--Hop IP AddressHop IP Address

MetricMetricAddress Family IdentifierAddress Family Identifier Route TagRoute Tag

Net 2 addressNet 2 address

MetricMetricNext HopNext Hop

Subnet maskSubnet mask

DADA SASA TFTF CRCCRCUDP DataUDP DataIPIP HdrHdr UDPUDP HdrHdr

(use multicast instead of broadcasting in RIP v1)Network Layer 110

How does the RIP Advertisement Work ? How does the RIP Advertisement Work ? (a portion of an AS)

w x y

z

A

C

D B…

Destination Network Next Router Num. of hops to dest.w A 2y B 2z B 7x -- 1…. …. ....

Routing table in D

Network Layer 111

How does the RIP Advertisement Work ? How does the RIP Advertisement Work ?

Advertisement sent from router ADestination Network Next Router Num. of hops to dest.

z C 4w -- 1x -- 1…. …. ....

• Routing table in D updated to (after rerunning DV algorithm) …

Destination Network Next Router Num. of hops to dest.w A 2y B 2z A 5…. …. ....

Routing table in D

Network Layer 112

RIP: Link Failure and RecoveryRIP: Link Failure and Recovery

If no advertisement heard after 180 sec (missing 6 updates)

routes via neighbor invalidated (no longer reachable)

new advertisements sent to neighbors

neighbors in turn send out new advertisements (if tables changed)

link failure info quickly propagates to entire net

Route-flush timer: removed a route from routing table after being

declared invalid for 240 sec.

Poison reverse used to prevent ping-pong loops

(infinite distance = 16 hops)

Route-timeout timer

Page 29: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 113

RIP Table processingRIP Table processing

RIP routing tables managed by application-level processcalled “routed (route dee) ” (daemon) – executes RIP protocol

Advertisements sent in UDP packets, periodically repeated

Use “netstat –rn” to view routing table

Network Layer 114

RIP Table example (continued)RIP Table example (continued)

Router: giroflee.eurocom.fr

Destination Gateway Flags Ref Use Interface-------------------- -------------------- ----- ----- ------ ---------127.0.0.1 127.0.0.1 UH 0 26492 lo0192.168.2.5 192.168.2.5 U 2 13 fa0193.55.114.6 193.55.114.6 U 3 58503 le0192.168.3.5 192.168.3.5 U 2 25 qaa0224.0.0.0 193.55.114.6 U 3 0 le0default 193.55.114.129 UG 0 143454(0.0.0.0)

Three attached class C networks (LANs)

Router only knows routes to attached LANs

Default router used to “go up”Route multicast address: 224.0.0.0

Loopback interface (for debugging)

Network Layer 115

OSPF (Open Shortest Path First)OSPF (Open Shortest Path First)OSPF (Open Shortest Path First)

“Open” publicly available opposed to Cisco’s EIGRP

RFC 2178, 2328

Uses Link State algorithm (LS – the topology of the AS) with

LS packet dissemination

Topology map at each node

Route computation using Dijkstra’s lease-cost algorithm

OSPF advertisement carries one entry per neighbor router

Advertisements disseminated to entire AS (via flooding)

Carried in OSPF messages directly over IP (rather than TCP or UDP

Supports VLSM and CIDR

Network Layer 116

OSPF’s “Advanced” Features (not in RIP)

Security: all OSPF messages authenticated (to preventmalicious intrusion – injecting incorrect info into routing tables)

Multiple same-cost paths allowed (only one path in RIP)

For each link, multiple cost metrics for different TOS (e.g.,satellite link cost set “low” for best effort; high for real time)

Integrated uni- and multicast support:

Multicast OSPF (MOSPF) uses same topology database asOSPF

OSPF allows to structure an AS hierarchically within a largedomains (to ease routing)

Page 30: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 117

Metrics (cost)Metrics (cost)

• Cost = a configurable parameter with the output side ofeach router interface

• Reference RFC 1253 (OSPF v.2 MIB)• Metric = 108 / interface speed (recommended)

• Examples:– 100 Mbps 1– 10 Mbps 10– E1 (2.048 Mbps) 48– T1 (1.544 Mbps) 65– 64 kbps 1562– 19.2 kbps 5208– 9.6 kbps 10416

Network Layer 118

Generic Packet FormulaGeneric Packet Formula

Version Type Packet Length

Router ID

Area ID

Checksum Authentication Type

Authentication

LSA Specific1 – Hello, 2 – DB Description, 3 – LS Request,

4 – LS Update, 5 – LS Ack

DADA SASA TFTF CRCCRCIP DataIP DataIP Header IP Header Protocol ID 89Protocol ID 89

Network Layer 119

Hierarchical OSPFHierarchical OSPF

Two-level hierarchy in an OSPF AS: local area and backbone

Area routers broadcasts LS advertisements to routers inside thearea

Each router has detailed area topology; but the details areinvisible to the outside routers

Each router only knows direction (shortest path) to nets in other areas.

Area border routers: “summarize” distances to nets in own area,advertise to other Area Border routers.

Backbone routers: run OSPF routing limited to backbone.

Boundary routers: connect to other AS’s.

Network Layer 120

Hierarchical OSPF (contHierarchical OSPF (cont’’d)d)

Backbone Area

Only ONE BA per AS~ route pkts between

areas in AS

route pkts tooutside area

(nonborder router)

Connect to other ASs

Page 31: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 121

Inter-AS Routing Protocol – BGP4Inter-AS Routing Protocol – BGP4

Figure 4.5.2-new2: BGP use for inter-domain routing

AS2(OSPF

intra-AS routing)

AS1(RIP intra-AS

routing) BGP

AS3(OSPF intra-AS

routing)

BGP

R1 R2

R3

R4R5

BGP peer

Network Layer 122

InterInter--AS Routing Protocol AS Routing Protocol –– BGP4BGP4

BGP (Border Gateway Protocol): the de facto standardRFC 1771-1773Supports CIDRized address (e.g., 140.124.115.0/24)Use Path Vector protocol:

similar to Distance Vector protocoleach Border Gateway broadcast to neighbors (peers) entire path (i.e., sequence of AS’s) to destination

BGP routes/paths to networks (ASs), not individual hosts/routersE.g., Gateway X may send its path to dest. Z:

Path (X,Z) = X,Y1,Y2,Y3,…,Z

Network Layer 123

IPv6 – IP Version 6IPv6IPv6 –– IP Version 6IP Version 6

Initial motivation: 32-bit address space completely allocated by 2008(class B) and 2018(class C).

Additional motivation:

header format helps speed processing/forwarding

header changes to facilitate QoS

new “anycast” address: route to “best” of several replicated servers

IPv6 datagram format: RFC 2460

fixed-length 40 byte header + extension headers

no fragmentation allowed

Network Layer 124

IPv6 Header

• Priority: identify priority among datagrams in flow• Flow Label: identify datagrams in same “flow.”

(concept of“flow” not well defined).• Next header: identify extension or upper layer protocol

Page 32: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 125

IPv6 Next Header FieldIPv6 Next Header Field

• Next header values (Extension header)0 ~ Hop-by-Hop Options Header43 ~ IPv6 Routing Header44 ~ IPv6 Fragment Header50 ~ Encapsulating Security Payload *51 ~ IPv6 Authentication Header *59 ~ No Next Header60 ~ Destination Options Header

• Upper-layer Protocol type identifier (new)45 ~ Interdomain Routing Protocol

46 ~ Resource ReserVation Protocol

58 ~ IPv6 ICMP PacketNetwork Layer 126

Headers and Order : IPv6 and ExtensionHeaders and Order : IPv6 and Extension

D.O.H.

~ next header field

043

44

60

6

(a must-be order)

Authentication and encapsulatingsecurity payload header (ignored)

0 31

EHs = n x 8B

Network Layer 127

Other Changes from IPv4

Checksum: removed entirely to reduce processing time at each hop

Options: allowed, but outside of header, indicated by “Next Header” field

ICMPv6: new version of ICMP

additional message types, e.g. “Packet Too Big”multicast group management functions

Network Layer 128

IPv4 and IPv6 Differences in HeaderIPv4 and IPv6 Differences in Header

• IPv6 is a static 40 bytes in length- not variable any longer; checksum being removed

• IPv6 allows for jumbogrames (jumbo datagram > 65,536 bytes)- allows for various network attachments (RFC 2146)

• IPv6 supports Extension header (concatenated headers)

• IPv4’s Total length field is replaced with payload length

• IPv4 TTL field is replaced with the hop limit

• Many IPv4 options were moved to independent protocols

* Question :How many fields have been suppressed, renamed, and newly added ?* Question :How many fields have been suppressed, renamed, and newly added ?

Ans.: 6,3,2

Page 33: Internet Network Layer: Overview - ntut.edu.tkwke/cn/nlp.pdf · Routing Algorithms and Internet Routing Protocols ... Network Layer 23 Classful addressing (RFC 791) ¾Fixed number

Network Layer 129

Transition From IPv4 To IPv6Transition From IPv4 To IPv6

Not all routers can be upgraded simultaneous

no “flag days”How will the network operate with mixed IPv4 and

IPv6 routers?

Two proposed basic approaches:

Dual Stack: some routers with dual stack (v6, v4) can

“translate” between v4 and v6 formats

Tunneling: IPv6 carried as payload in IPv4 datagram

among IPv4 routers

Network Layer 130

Dual Stack ApproachDual Stack Approach

E

IPv6

B

IPv6

C

IPv4

FA

IPv6

D

IPv6IPv4

Flow: XSrc: ADest: F

data

Src:ADest: F

data

Flow: ??Src: ADest: F

data

Src:ADest: F

data

A-to-B:IPv6

B-to-C:IPv4

E-to-F:IPv6

D-to-E:IPv4

Network Layer 131

IP Tunneling

A B

IPv6

FE

IPv6

tunnelLogical view:IPv6IPv6

FE

IPv6

Physical view:A B

IPv6

C

IPv4

D

IPv6IPv6 IPv4

Flow: XSrc: ADest: F

data

Flow: XSrc: ADest: F

data

Src:BDest: E

Flow: XSrc: ADest: F

data

Src:BDest: E

Flow: XSrc: ADest: F

data

A-to-B:IPv6

E-to-F:IPv6

B-to-C:IPv6 inside

IPv4

D-to-E:IPv6 inside

IPv4Network Layer 132

The EndThe End