CS 3640: Introduction to Networks and Their Applications Fall 2018, - - PowerPoint PPT Presentation

cs 3640 introduction to
SMART_READER_LITE
LIVE PREVIEW

CS 3640: Introduction to Networks and Their Applications Fall 2018, - - PowerPoint PPT Presentation

CS 3640: Introduction to Networks and Their Applications Fall 2018, Lecture 9: The Network Layer I: Addressing (Credit: Christo Wilson @ NEU) Instructor: Rishab Nithyanand Teaching Assistant: Md. Kowsar Hossain 1 You should Be


slide-1
SLIDE 1

1

CS 3640: Introduction to Networks and Their Applications

Fall 2018, Lecture 9: The Network Layer I: Addressing (Credit: Christo Wilson @ NEU) Instructor: Rishab Nithyanand Teaching Assistant: Md. Kowsar Hossain

slide-2
SLIDE 2

2

You should…

  • Be checking Piazza regularly for announcements.
  • Be ready for assignment 2.
  • Download VirtualBox and assignment at end of class!
  • Know and understand:
  • The three Internet design principles.
  • The components of the Internet.
  • Circuit- vs. packet- switched networks.
  • Components of end-to-end delay.
  • Functions of the link layer.
  • How error detection works at the link layer.
  • How medium access control works at the link layer – ALOHA,

CSMA/CD, CSMA/CA, RTS/CTS.

  • How link layer addressing and routing works - End hosts, Switches, Hubs.
slide-3
SLIDE 3

3

Today in class

1.

Recap: Link layer principles 2.

3.

The role of the network layer Network layer addressing

slide-4
SLIDE 4

Recap: Medium access control protocols

  • What is the function of a MAC protocol? What are the general strategies for

designing one?

  • Why does slotted ALOHA have better performance than standard ALOHA?
  • Why cant we use CSMA/CD for wireless media?
  • Carrier sensing while transmitting is not feasible, so collisions can only be detected at

the receiver.

  • What is the hidden terminal problem with CSMA/CA? How do we solve it?
  • Two terminals want to transmit to another common terminal. They cannot hear each
  • ther and they collide. Asking for permission to transmit helps (RTS/CTS).
  • What is the exposed terminal problem? Why don’t we use RTS/CTS always?
  • A terminal falsely thinks another is transmitting to the same destination and backs off.

RTS/CTS is too expensive!

slide-5
SLIDE 5

Recap: Link layer addressing

  • Hubs vs. Switches vs. Bridges? Why are hubs a good/bad idea?
  • Hubs broadcast everywhere.
  • Switches and bridges are more intelligent and maintain forwarding tables.
  • Switches are connected to a single end-hosts. Bridges are connected to entire LANs.
  • What is a forwarding table? How do bridges/switches update their tables?
  • A collection of <MAC address, port/interface> entries used by switches to learn

which MAC addresses are accessible through which interfaces. These mappings are gathered by observing source MAC addresses of each arriving frame.

  • If no entry exists, a frame is broadcasted through all interfaces.
  • Why are loops bad in our networks? How do we stop them?
  • They cause packets to circulate forever. Building a logical MST from routing tables

avoid this.

  • MST construction high-level idea: Pick a root. Every node finds the shortest path to
  • root. Merge all paths.
slide-6
SLIDE 6

6

Today in class

1.

Recap: Link layer principles 2.

3.

The role of the network layer Network layer addressing

slide-7
SLIDE 7

What the network layer does

  • It connects multiple LANs

with each other.

  • Facilitate communication between

incompatible link layers (e.g., Wi-Fi and Ethernet networks).

  • The connected networks are an

“internetwork”. Example: The Internet.

Routers

slide-8
SLIDE 8

The structure of the Internet

  • The Internet is a collection of interconnected networks.
  • It is not organized to have a specific topology and technologies in each

network vary significantly.

  • Packets travel from source to destination by hopping through networks
  • Routers “peer” (connect) with different networks
  • At each hop a router sends packets to one of its peer networks
  • Remember: The Internet is packet-switched
  • Discuss: What are the implications of this?
  • Packets between the same source and destination can take different routes.

Network 2 Network 1 Network 3 Network 4

slide-9
SLIDE 9

Forwarding vs. Routing

  • Discuss: How do you plan a long multi-day road trip?
  • You plan the trip at a high-level: We’ll drive from Iowa City to

Chicago to Youngstown to New York.

  • This is routing: How can we make this packet reach its final destination?
  • Then you plan the day-to-day bits: We need to get off the I-80 and
  • nto the I-76 to get from Iowa City to Chicago.
  • This is forwarding: How can we make this packet reach its next hop?
slide-10
SLIDE 10

The network layer

  • What are the functions of the network layer?
  • Addressing: How do we specify who we want to talk to on the Internet?
  • Forwarding: How do we make sure our router knows what the next hop is? (local)
  • Routing: How do we make sure our packets get to the other side? (global)
  • Why not use the link layer? It does both of these for LANs.
  • Link layer protocols were not designed to be scalable to billions of end-hosts.
  • Link layers can be different in different networks!
  • What makes the network layer special?
  • The core protocols are implemented in every host and router! There is no

Internet without the network layer.

  • Discuss: What kind of service guarantees can the network layer

provide if it has to serve every network on the Internet?

  • Serve the lowest common denominator. Best-effort but no guarantees.
slide-11
SLIDE 11

11

Today in class

1.

Recap: Link layer principles 2.

3.

The role of the network layer Network layer addressing

slide-12
SLIDE 12

Addressing options

  • Discuss: How did LANs deal with addressing? Why doesn’t

that work on the Internet?

  • LANs relied on a “flat” addressing scheme.
  • A unique random 48-bit string for each device.
  • Problem: Each router has to remember how to reach every other device on the

Internet (~23 Billion).

  • Discuss: How do we deal with addressing in the physical world?
  • We use a hierarchical addressing scheme.
  • Country (least specific) – State – City – Street – Building – Apartment –

Person (most specific).

  • Mail routing offices along the way only need to know how to reach the region

at some specificity.

  • E.g., UPS New York only needs to know how to get the parcel to UPS Iowa. UPS

Iowa needs to get the parcel to UPS Iowa City.

slide-13
SLIDE 13

Network layer addressing

  • The Internet uses a hierarchical addressing scheme.

1** 10* 11* 100 101 110 111 0** 00* 01* 000 001 010 011 Datagram, Destination = 101

slide-14
SLIDE 14

In In rea eality, th this is is what rou

  • utes loo

look li like

slide-15
SLIDE 15

IP addressing

  • Every device on the Internet has an “IP address”
  • IP (Internet Protocol) is THE network layer protocol.
  • There is no Internet without IP!
  • IPv4: 32 bit strings
  • They are usually written in dotted notation. Example: 192.168.0.1
  • Each of these numbers is a byte.

11000000 C0 192 10101000 A8 168 00010101 15 21 01001100 4C 76 Decimal Hex Binary 8 16 24 31

slide-16
SLIDE 16

Requirements of routing tables

  • For ANY IP address, be able to give the next hop.
  • 32 bit addresses: 232 addresses!
  • Problem isn’t just storage. Also speed of lookup.
  • 4 10G ports operating at capacity will require 176Gbps memory bandwidth!
  • DRAM is 6 Gbps.
  • Need to hit caches and have smaller tables.
slide-17
SLIDE 17

The hierarchy of IP addresses

  • Each IP address has a “network” string known to all routers

and a “host” string known to edge routers (access networks).

  • How long is the network string and host string?
  • Depends on the “class” of the network.

Host Network Pfx 31

Known by all routers Known by edge (LAN) routers

slide-18
SLIDE 18

Classes of IP addresses

  • Class A

Host Ntwk 31 1 8 Example: MIT 18.*.*.* 1-126

 Class B

Host Network 10 31 2 16 Example: UIowa 172.16.*.* 128-191 8

 Class C

Host Network 11 31 3 24 Example: 216.63.78.* 192-223 8 16 16 24 24

  • IANA (Internet Assigned Number Authority) assigns IP addresses.
  • You can apply, get a class, and start installing routers that advertise routes to

devices in your class.

slide-19
SLIDE 19

The hierarchy of IP addresses

… …

Host Networ k Pfx

Subtree size determined by network class

slide-20
SLIDE 20

The hierarchy of IP addresses

  • Discuss: Do IP address classes solve our problem of memory
  • n routing devices? Why or why not?

Class Prefix Bits Network Bits Number of Classes Hosts per Class A 1 7 27 – 2 = 126 (0 and 127 are reserved) 224 – 2 = 16,777,214 (All 0 and all 1 are reserved) B 2 14 214 = 16,398 216 – 2 = 65,534 (All 0 and all 1 are reserved) C 3 21 221 = 2,097,512 28 – 2 = 254 (All 0 and all 1 are reserved) Total: 2,114,036

Too many network IDs Way too big

slide-21
SLIDE 21

The problem with class-based hierarchies

  • Problem: Too many hosts to remember for Class A and Class B

access network routers.

  • Discuss: How would you do this?

Class Prefix Bits Network Bits Number of Classes Hosts per Class A 1 7 27 – 2 = 126 (0 and 127 are reserved) 224 – 2 = 16,777,214 (All 0 and all 1 are reserved) B 2 14 214 = 16,398 216 – 2 = 65,534 (All 0 and all 1 are reserved) C 3 21 221 = 2,097,512 28 – 2 = 254 (All 0 and all 1 are reserved) Total: 2,114,036

Way too big

slide-22
SLIDE 22

Reducing router storage with “subnets”

  • Problem: Too many hosts to remember for Class A and

Class B access network routers.

  • Solution: Hack on another layer to the hierarchy.
  • Each “network” manages many “subnetworks”.
  • The number of hosts in each subnetwork is much smaller.
  • Each access network router only needs to know how to reach a subnet.
  • If it seems like everything on the Internet is a patched solution, its

because it is! The designers did not foresee needing to store 1000s of entries on routers.

Host Ntwk Pfx Subnet

slide-23
SLIDE 23

Subnet masks and routing tables

  • A subnet “mask” is a 32 bit string.
  • 1s as long as the prefix+network+subnet parts of the IP address. It is

used by routers to indicate which hosts are reachable by other routers.

  • Discuss: We need to send a packet to 128.42.222.198. This

entry is satisfied by 4 entries in the routing table. Which entry should I use? Why?

  • Match the longest prefix. The row with the longest string of 1s in the

subnet mask. It gets me closest to the destination.

Host Ntwk Pfx Subnet Address Prefix Subnet Mask Prefix After Masking (in Binary) Next Hop 0.0.0.0 0.0.0.0

******** ******** ******** ********

Port 4 18.0.0.0 255.0.0.0

00010010 ******** ******** ********

Port 2 128.42.0.0 255.255.0.0

10000000 00101010 ******** ********

Port 3 128.42.128.0 255.255.128.0

10000000 00101010 1******* ********

Port 5 128.42.222.0 255.255.255.0

10000000 00101010 11011110 ********

Port 1

slide-24
SLIDE 24

Reducing router storage with “subnets”

… …

Host Networ k Pfx

Subtree size determined by length

  • f subnet mask

Subnet

  • Tree does not have a fixed depth
  • Increasingly specific subnet masks
slide-25
SLIDE 25

The limitations of subnetting

  • Discuss: Do subnets solve the problem of having too many

classes?

  • No! We have less number of hosts in a class, but a router still needs to know

(at least) every network that has a class (at least 2.1 M).

Class Prefix Bits Network Bits Number of Classes Hosts per Class A 1 7 27 – 2 = 126 (0 and 127 are reserved) 224 – 2 = 16,777,214 (All 0 and all 1 are reserved) B 2 14 214 = 16,398 216 – 2 = 65,534 (All 0 and all 1 are reserved) C 3 21 221 = 2,097,512 28 – 2 = 254 (All 0 and all 1 are reserved) Total: 2,114,036

Way too big

slide-26
SLIDE 26

Reducing routing table sizes with CIDR (Classless Inter Domain Routing)

  • Key idea: Get rid of IP classes in routing tables.
  • Create an arbitrary split between networks and hosts.
  • The split is specified by a bitmask (net mask).
  • CIDR representation example:
  • Let 129.10.0.1 be our host IP. Let 255.255.0.0 be our net mask
  • Host IP: 10000001 00001010 00000000 00000001
  • Net mask: 11111111 11111111 00000000 00000000
  • CIDR representation: 129.10.0.1 & 255.255.0.0: 129.10.0.0/16
  • Saying you can route to 129.10.0.0/16 means you’re saying you can reach all

IPs which have a CIDR representation of 129.10.0.0/16

  • this includes 129.10.0.0/17, …, 129.19.0.0/32.
slide-27
SLIDE 27

Reducing routing table sizes with CIDR (Classless Inter Domain Routing) Prefix Netmask Prefix After Masking (in Binary) IP Address Range 207.46.0.0 19

11001111 00101110 000***** ********

207.46.0 – 31.* 207.46.32.0 19

11001111 00101110 001***** ********

207.46.32 – 63.* 207.46.64.0 19

11001111 00101110 010***** ********

207.46.64 – 95.* 207.46.128.0 18

11001111 00101110 10****** ********

207.46.128 – 191.* 207.46.192.0 18

11001111 00101110 11****** ********

207.46.192 – 255.* Hole in the Routing Table: No coverage for 96 – 127 Missing entry: 207.46.96.0/19

slide-28
SLIDE 28

Reducing routing table sizes with CIDR (Classless Inter Domain Routing) Prefix Netmask Prefix After Masking (in Binary) Next Hop 207.46.0.0 19

11001111 00101110 000***** ********

Port 1 207.46.32.0 19

11001111 00101110 001***** ********

Port 1 207.46.64.0 18

11001111 00101110 01****** ********

Port 1 207.46.128.0 18

11001111 00101110 10****** ********

Port 2 207.46.192.0 18

11001111 00101110 11****** ********

Port 3

Aggregation allows multiple routes to be compressed together to shrink the size of the routing table

207.46.0.0 18

11001111 00101110 00****** ********

Port 1 207.46.0.0 17

11001111 00101110 0******* ********

Port 1 Same length netmask All bits match except for the last one Same port

slide-29
SLIDE 29

Size of CIDR routing tables: ~ 450K entries for the entire Internet!

slide-30
SLIDE 30

What you should remember from this lecture

  • Why doesn’t “flat addressing” work on the Internet? What does?
  • Flat addressing is not scalable. Too many routing table entries for every router.
  • Hierarchical addressing scales better. Don’t need to have entries for all routers.
  • Need highly specific information only for routers in their own network.
  • Class-based addressing is too coarse.
  • Class A networks are too big for access network routers.
  • Class C networks are too many for everyone else.
  • CIDR introduces arbitrary hierarchies using netmasks.
  • Improves scalability by allowing more aggregation at routers.
  • At each hop routing decisions are made using “longest prefix

matching”.

slide-31
SLIDE 31

Assignment 2

  • Now online! Start early!
  • Topics: Performance measurement and link layer routing
  • Tools: Mininet and Scapy [pre-configured VM]