16
Lecture 10: Addressing CSE 123: Computer Networks Alex C. Snoeren HW 2 due NEXT FRIDAY

Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Lecture 10:Addressing

CSE 123: Computer NetworksAlex C. Snoeren

HW 2 due NEXT FRIDAY

Page 2: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Lecture 10 Overview• Fragmentation example

• ICMP, the other network-layer protocol

• IP Addresses• Class-based addressing

• Subnettingu Classless addressing

2

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing

Page 3: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

ID=x

offset=0

MF=0

length=4000

ID=x

offset=0

MF=1

length=1500

ID=x

offset=1480

MF=1

length=1500

ID=x

offset=2960

MF=0

length=1040

One large datagram becomesseveral smaller datagrams

Fragmentation Example

3

(Offset actually encoded as bytes/8)

0

185

370

CSE 123 – Lecture 11: Fragmentation & Addressing

CSE 123 – Lecture 10: Addressing

Page 4: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Recursive fragmentation

● Suppose this packet needs to be sent on a network with a 500-byte MTU

CSE 123 – Lecture 4: Reliable Transmission 4

ID=x

offset=1480

MF=1

length=1500

How many fragments will result?

A. 1B. 2C. 3D. 4

What will be the offset of the second fragment?

A. 480 bytesB. 1480 bytesC. 1960 bytesD. 1980 bytes

Page 5: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Costs of Fragmentation● Interplay between fragmentation and retransmission

u A single lost fragment may trigger retransmissionu Any retransmission will be of entire packet (why?)

● Packet must be completely reassembled before it can be consumed on the receiving hostu Takes up buffer space in the mean timeu When can it be garbage collected?

● Why not reassemble at each router?

5

CSE 123 – Lecture 11: Fragmentation & Addressing

CSE 123 – Lecture 10: Addressing

Page 6: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Path MTU Discovery● Path MTU is the smallest MTU along path

u Packets less than this size don’t get fragmented

● Fragmentation is a burden for routersu We already avoid reassembling at routersu Avoid fragmentation too by having hosts learn path MTUs

● Hosts send packets, routers return error if too largeu Hosts can set “don’t fragment” flagu Hosts discover limits, can size packets at source

6

CSE 123 – Lecture 11: Fragmentation & Addressing

CSE 123 – Lecture 10: Addressing

Page 7: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Aside: ICMP● What happens when things go wrong?

u Need a way to test/debug a large, widely distributed system

● ICMP = Internet Control Message Protocol (RFC792)u Companion to IP – required functionality

● Used for error and information reporting:u Errors that occur during IP forwardingu Queries about the status of the network

7

CSE 123 – Lecture 11: Fragmentation & Addressing

CSE 123 – Lecture 10: Addressing

Page 8: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

ICMP Error Message Generation

● ICMP messages include portion of IP packet that triggered the error (if applicable) in their payload

CSE 123 – Lecture 10: Addressing 8

CSE 123 – Lecture 11: Fragmentation & Addressing

source dest

ICMP IP packet

IP packet

Error duringforwarding!

Page 9: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Common ICMP Messages● Fragmentation needed

u Need to fragment, but don’t fragment bit set● TTL Expired

u Used by the “traceroute” program» traceroute traces packet routes through Internet

● Destination unreachableu “Destination” can be host, network, port, or protocol

● Redirectu To shortcut circuitous routing

● Echo request/replyu Used by the “ping” program

» ping just tests for host liveness

9

CSE 123 – Lecture 11: Fragmentation & Addressing

CSE 123 – Lecture 10: Addressing

Page 10: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

ICMP Restrictions● The generation of error messages is limited to avoid cascades

u Error causes error that causes error…

● Don’t generate ICMP error in response to:u An ICMP erroru Broadcast/multicast messages (link or IP level)u IP header that is corrupt or has bogus source addressu Fragments, except the first

● ICMP messages are often rate-limited toou Don’t waste valuable bandwidth sending tons of ICMP messages

CSE 123 – Lecture 10: Addressing 10

CSE 123 – Lecture 12: Aggregation

Page 11: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Addressing Considerations● Fixed length or variable length addresses?

● Issues:u Flexibilityu Processing costs u Header size

● Engineering choice: IP uses fixed length addresses

11

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing

Page 12: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

IP Addresses● 32-bits in an IPv4 address

u Dotted decimal format a.b.c.du Each represent 8 bits of address

● Hierarchical: Network part and host partu E.g. IP address 128.54.70.238u 128.54 refers to the UCSD campus networku 70.238 refers to the host ieng6.ucsd.edu

● Which part is network vs. host?

12

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing

Page 13: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Class-based Addressing● Most significant bits determines “class” of address

● Special addressesu Class D (1110) for multicast, Class E (1111) experimentalu 127.0.0.1: local host (a.k.a. the loopback address)u Host bits all set to 0: network addressu Host bits all set to 1: broadcast address

CSE 123 – Lecture 10: Addressing 13

CSE 123 – Lecture 12: Aggregation

Network Host0

Network Host1

Network Host1

160

1 0821

14

Class A

Class B

Class C

127 nets, 16M hosts

16K nets, 64K hosts

2M nets, 254 hosts

To what class network does 132.239.180.101 belong?

A. AB. BC. CD. D

Page 14: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

● Router needs to know where to forward a packet

● Forwarding table contains:u List of network names and next hop routersu Local networks have entries specifying which interface

» Link-local hosts can be delivered with Layer-2 forwarding

● E.g. www.ucsd.edu address is 132.239.180.101u Class B address – class + network is 132.239u Lookup 132.239 in forwarding tableu Prefix – part of address that really matters for routing

IP Forwarding Tables

14

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing

Page 15: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

Subnetting● Individual networks may be composed of several LANs

u Only want traffic destined to local hosts on physical networku Routers need a way to know which hosts on which LAN

● Networks can be arbitrarily decomposed into subnetsu Each subnet is simply a prefix of the host address portionu Subnet prefix can be of any length, specified with netmask

15

Network HostSubnet

Prefix

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing

Page 16: Lecture 10: Addressingcseweb.ucsd.edu/classes/fa19/cse123-a/lectures/123-fa19-l10.pdf · CSE 123–Lecture 10: Addressing 13 CSE 123 –Lecture 12: Aggregation 0 Network Host 1 Network

For Next Time

• Read 4.1

• Turn in Homework 2 before class Friday

16

CSE 123 – Lecture 12: Aggregation

CSE 123 – Lecture 10: Addressing