33
Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder [email protected]

Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder [email protected]

  • View
    219

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Chapter 4Network Layer 3:

The Internet Protocol (IP)

Professor Rick HanUniversity of Colorado at Boulder

[email protected]

Page 2: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Announcements

• Reminder: Programming assignment #1 is due Feb. 19

• Part of Homework #2 available later today on Web site, the traceroute part will be available Monday

• Homework #1 solutions when we hand back graded Homework #1

• Reading Chapter 4• 4.1 today + added material• 4.2, 4.3, 4.4 in same order

• Next, IP network, packets, ARP, RARP, …

Page 3: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Recap of Previous Lecture• Interconnecting Ethernet LANs

• Ethernet Bridges/Switches – Layer 2• Loops can form, causing:

• Packet multiplication• Endless Looping

• Solution: Create Spanning Trees• Eliminates Loops and Spanning Trees

• Interconnecting Hosts and Switches via Point-to-Point Links• Asynchronous Transfer Mode (ATM)

• Virtual circuits to route packets

Page 4: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

ATM Network• Switch packets via virtual circuit routing• Lost to Ethernet in LAN, Losing to Gig.

Eth./ SONET in MAN, SONET/MPLS in WAN• Cost and complexity• But, some customers (DSL) want AAL’s

guaranteed QOS for voice/video

Host A

Switch C

Switch D

Switch B

Switch E

Host F

Page 5: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Frame Relay and X.25• Frame Relay:

• Like ATM, uses permanent virtual circuits (PVCs – more common) and SVCs

• Widely deployed in 1990s• No error recovery per link – not necessary over

optical fiber

• X.25 is an old 1970s “public packet switching” technology• Like ATM, uses virtual circuits to interconnect

“dumb” terminals• Error recovery on each link, due to noisy copper

phone lines

Page 6: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Bridging to Connect Remote LANs?

• Network “Cloud” could be one giant bridge• Switch B keeps Ethernet MAC header,

encapsulates Ethernet frame with network header, Switch E strips away network header

• spanning tree and a bridge table within cloud

SwitchC

SwitchD

SwitchB

SwitchE

Ethernet 1 Ethernet 2ATM or Frame Relay Network

Page 7: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Bridging to Connect Remote LANs? (2)

• Problems: • Many different types of LAN’s, e.g. Token Ring

and FDDI, with completely different addressing schemes

• Spanning tree doesn’t scale well

SwitchC

SwitchD

SwitchB

SwitchE

Ethernet 1

Token Ring

ATM or Frame Relay NetworkUndecipherable?

Page 8: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Routing to Connect Remote LANs

• Internet Protocol (IP) addressing is the glue that spans heterogeneous LANs and WANs

• IP hosts send IP packets via IP routers (shown in yellow)

SwitchC

SwitchD

SwitchB

SwitchE

RouterX

RouterY

Host 1

Host2

ATM/Frame Relay

Page 9: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Routing to Connect Remote LANs (2)

IP

Host 1

Eth.MAC

IP

Phys.

Router X

IP

Host 2

Tok RMAC

IP

Phys.

Router Y

ATMEth.MAC

Phys.

Tok RMAC

Phys.ATMNet.

Link

Phy

ATM

Link

Phy

Page 10: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Routing to Connect Remote LANs (3)

• Alternatively, IP directly over SONET (MANs)• Link-layer framing over fiber• Less overhead: (IP over SONET) vs. (IP over ATM

over link layer (could be SONET))

RouterC

RouterD

RouterB

RouterE

RouterX

RouterY

Host 1

Host2

IP over SONET

SONETSONET

SONET

SONET

SONETSONET

SONET

Page 11: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Routing to Connect Remote LANs (4)

IP

Host 1

Eth.MAC

IP

Phys.

Router X

IP

Host 2

Tok RMAC

IP

Phys.

Router Y

SONET framing

Eth.MAC

Phys.

Tok RMAC

Phys.IP

Net.Opt Fbr OC-?

SONET framing

Opt Fbr OC-?

• OC3=155 Mbps, OC12=622 Mbps, OC48=2.488 Gbps, OC192=10 Gbps

• Competitors to SONET in MAN: Gigabit Ethernet

Page 12: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Internet Backbone

Take this with a grain of salt: can be a highlypolitical prediction of what someone wants to happen

Page 13: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

UUNet/WorldComBackbone ProviderTo ISP’s:• Leader at 28% market share

Claim: there’s abandwidth glut onthe backbone:~1% bandwidthutilization

Page 14: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

AT&T SONET Backbone

Page 15: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Internet Topology

NAP

POPPOP

BackboneProvider

BackboneProvider

ISP ISP

Host 1

Host 2

Point of Presence

NetworkAccess Point

Also called NSP:Network Service Provider

Internet ServiceProvider

Page 16: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Internet Routing• For simplicity, assume an Internet with a

homogeneous IP backbone. IP provides:• Unreliable out-of-order datagram delivery, also

called “best-effort” service - no QOS guarantees, just First-Come-First-Serve (FCFS) routing

RouterC

RouterD

RouterB

RouterE

RouterX

RouterY

Host 1

Host2

IP backbone

Page 17: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Internet Protocol Packet Format

IP Header Data (variable length)

IP Datagram

Page 18: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header• Big endian/network byte order: send lower

order bytes first • Send bits 0-7, then 8-15, then …

• Version: current version is 4, I.e. IPv4• proposal for IPv6, which will have a different

header

Page 19: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (2)• IHL: header length in # 32-bit words

• Normally = 5, i.e. 20 byte IP headers• Max 60 bytes• Header can be variable length

Page 20: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (3)• Type of Service: 3-bit precedence field

(unused), 4 TOS bits, 1 unused bit set to 0• TOS bit 1 (min delay), 2 (max throughput), 3

(max reliability), 4 (min cost): only one can be set

• typically all are zero, for best-effort service• DiffServ proposes to use TOS for IP QOS

Page 21: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (4)• Total Length: of datagram, in bytes

• Max size is 65535 bytes

• Identification: uniquely identifies each datagram sent by a host• Used for fragmentation and reassembly

Page 22: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (5)• Flags & Fragment Offset: for fragmentation• Time To Live: upper limit on # routers that a

datagram may pass through• Initialized by sender, and decremented by each

router. When zero, discard datagram. Stops looping

Page 23: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (6)• Protocol: IP needs to know to what protocol

it should hand the received IP datagram• demultiplexes incoming IP datagrams into either

UDP, TCP, ARP, …

Page 24: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (7)• Header Checksum: calculated only over

header• At sender, set to 0. Compute one’s complement

16-bit sum. Insert 16-bit one’s complement of this sum.

• At receiver, compute 16-bit one’s complement sum of header – should be all 1’s. If not, discard

Page 25: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Packet Header (8)• Source and Destination IP address: 32 bits

long each:• Often see written like, 12.244.92.161

• 127.0.0.1 is localhost loopback address, i.e. yourself

• Various classes of IP addresses

Page 26: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Addressing• Destination address is the key to packet

routing:• IP routers only look at where the packet is

headed, rather than where it came from

• Source address is useful:• At receiver, to decide whether to accept

incoming packet• At receiver, to send acknowledgement back to

sender, e.g. TCP sends its acknowledgements

• IP address is per interface, so a given router with N interfaces can have N IP addresses

Page 27: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Addressing (2)• IP addresses are hierarchical: 12.244.92.161

• Class A

• Class B

• Class C

• Hierarchy to handle WANs, MANs, and LANs:• Class C allows for only 256 local hosts, but 221

Class C networks – for small office nets• Class A allows many 224 local hosts, few 27

networks

0 Network Host

1 Network Host

Network

0

Host1 1 0

7 24

14 16

21 8

Page 28: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Addressing (3)• Classes impose fixed-size network sub-fields

that may not suit an organization’s needs => waste much address space• Phase out fixed classes A, B, C• Solution: classless routing, or Classless

Interdomain Routing (CIDR), 1993• Network sub-field can have any number of

bits• a.b.c.d/x is CIDR notion for an IP address

a.b.c.d with first x bits as network address

Page 29: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Addressing (4)• Assigning IP addresses:

• Automatically: via Dynamic Host Configuration Protocol (DHCP) – we’ll study it later

• Manually:• Contact your ISP• an organization contacts its ISP for a block of

allocated IP addresses• An ISP contacts one of several well-known

global registries (originally managed by IANA alone)

• 4 billion possible addresses• Running out?• NAT (Network Address Translation) ease the

pressure – we’ll study it later• IPv6

Page 30: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Fragmentation and Reassembly

• Fragmentation occurs when datagram exceeds MTU of underlying network• Ethernet MTU is 1500 bytes, FDDI MTU is 4500

bytes

• Identifier field uniquely identifies a datagram sent from a source

• Set M bit in Flags field to one to indicate more fragments to follow

• Set Offset to 0 for first fragment• For second fragment, set Offset = length of data

in first fragment• For N’th fragment, set Offset = sum of lengths of

data in N-1 fragments

Page 31: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

IP Fragmentation and Reassembly (2)

• For last fragment, set M in Flags field to 0, to indicate no more fragments

• Each IP fragment is a full-fledged datagram• Reassembly:

• Fragments can be lost• After waiting a “reasonable” amount of time, an

IP end host will stop reassembly• To avoid this waiting delay due to lost

fragments, the sending host should perform path MTU discovery prior to sending IP packets, and then send at the MTU of the path

Page 32: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Address Resolution Protocol (ARP)

• How does IP sends its packet over Ethernet?• Ethernet doesn’t understand 32-bit addresses• Need to map 32-bit to Ethernet’s “physical” 48-

bit addresses

• Each host builds a cache that maps IP addresses to Ethernet addresses – distributed, not centralized

• If sending to a host on the same Ethernet, • First, check cache if address already present• If not, send an Ethernet’s broadcast query (all

1’s in 48-bit address), frame’s Type field set to ARP• Query contains “target” IP address, and link

layer address of sending host

Page 33: Chapter 4 Network Layer 3: The Internet Protocol (IP) Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu

Prof. Rick Han, University of Colorado at Boulder

Address Resolution Protocol (2)

• Each host receives broadcast query and checks to see if target IP address matches its own• If match, sends a response to link-layer address

of originator, containing its own link-layer address

• When another host hears an ARP request• If requester is in cache, then refresh its own

cache• Entries in ARP cache time out ~ every 15 min

• If requester is not in cache• If host is target, then add to cache• Otherwise don’t add to cache, to keep ARP

table clean