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 8: The Link Layer III Addressing Protocols (animations from Christo Wilson @ NEU) Instructor: Rishab Nithyanand Teaching Assistant: Md. Kowsar Hossain 1 You


slide-1
SLIDE 1

1

CS 3640: Introduction to Networks and Their Applications

Fall 2018, Lecture 8: The Link Layer III – Addressing Protocols (animations from 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 close to making a submission for assignment 1.
  • Know and understand:
  • The three Internet design principles.
  • Encapsulation.
  • 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.
slide-3
SLIDE 3

Recap: Medium access control protocols

  • What is the function of a MAC protocol? What are the

general strategies for designing one?

  • Regulate access to the shared medium.
  • Strategies: Medium partitioning, token-based access, best-effort need-

based access.

  • What are the problems with partitioning and token-based access?
  • Why does slotted ALOHA have better performance than

standard ALOHA?

  • Introducing “slots” means that the “sensitive” transmission period is cut

in half. This basically doubles the achievable throughput.

slide-4
SLIDE 4

The link layer: The CSMA/CA MAC protocol (1990s)

  • Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA).
  • Currently used in wireless transmission protocols (WiFi 802.11).
  • In wireless networks:
  • Carrier sensing while transmitting is not feasible, so collisions can only be detected

at the receiver. Why?

  • Detecting collisions is harder because accurately sensing the medium is tough –

wireless signals may not carry to far away hosts.

  • Connectivity is not transitive: If A can reach B and B can reach C, it doesn’t mean that A

can reach C.

  • Instead, wireless networks just try to avoid collisions instead of detecting and
  • retransmitting. They use the CSMA/CA protocol.
slide-5
SLIDE 5

The link layer: The CSMA/CA protocol

  • B wants to transmit to C.
  • Sense the carrier. Is another node transmitting?
  • Yes. So do an exponential back-off before trying again.

A B C D

slide-6
SLIDE 6

The link layer: The CSMA/CA protocol

  • B wants to transmit to C.
  • Sense the carrier. Is another node transmitting?
  • No. Send frames. If I don’t get an ACK in reasonable time, start again.

A B C D

slide-7
SLIDE 7

The link layer: The CSMA/CA MAC protocol

  • Step 1:
  • Sense the carrier. Is another node transmitting?
  • Step 2:
  • If the carrier is not busy: Send the frames.
  • If the carrier is busy: Do an exponential back-off and go to step 1.
  • Step 3:
  • Wait for an acknowledgement. If it doesn’t arrive after “timeout” seconds,

go to step 1 and try again.

  • Problem: Collisions can still occur and utilization can be low!
  • Why? Hidden nodes and exposed terminals.
slide-8
SLIDE 8

The link layer: The CSMA/CA MAC protocol – Hidden terminals

  • Step 1: Sense the carrier. Is another node transmitting?
  • Hidden nodes can increase false-negatives.

A B C

Collision! A cannot hear C C cannot hear A

slide-9
SLIDE 9

The link layer: The CSMA/CA MAC protocol – Hidden terminals

  • Discuss: Would asking for permission from the receiver help?

A B C

Collision! A cannot hear C C cannot hear A

slide-10
SLIDE 10

The link layer: The CSMA/CA MAC protocol (with RTS/CTS)

A B C

slide-11
SLIDE 11

The link layer: The CSMA/CA MAC protocol (with RTS/CTS)

  • Step 1:
  • Sense the carrier. Is another node transmitting?
  • Step 2:
  • If the carrier is not busy: Tell the receiver you have something to send via a

“Request To Send” (RTS) message. Wait for “timeout” seconds for a “Clear To Send” (CTS) message from the receiver.

  • If CTS arrives: send the frames.
  • If CTS doesn’t arrive: do an exponential back-off and go to step 1.
  • If the carrier is busy: Do an exponential back-off and go to step 1.
  • Step 3:
  • Wait for an acknowledgement. If it doesn’t arrive after “timeout” seconds, go to step

1 and try again.

  • Solves the hidden terminal problem, doesn’t help with exposed

terminals.

slide-12
SLIDE 12

The link layer: The CSMA/CA MAC protocol – Exposed terminals

Carrier sense detects a busy channel

No collision

A B C D

No collision

  • Step 1: Sense the carrier. Is another node transmitting?
  • Exposed terminals can increase false-positives.
slide-13
SLIDE 13

The link layer: The CSMA/CA MAC protocol – Exposed terminals

A B C D

  • Discuss: Why doesn’t RTS/CTS messaging work here?
  • RTS/CTS helps reduce false-negatives (thinking that the medium is free when it

isn’t) but doesn’t prevent false-positives (thinking the medium is busy when it isn’t) because we never actually reach the RTS stage when we have a false-positive.

slide-14
SLIDE 14

The link layer: The CSMA/CA MAC protocol – Exposed terminals

  • Discuss: Why not skip sensing and just start with an RTS

message if it solves the exposed terminal problem?

  • Overhead!
  • RTS/CTS packets don’t have any useful data in them. As your network gets

faster, you send more RTS/CTS packets per second because you can handle more transmissions per second.

  • RTS/CTS overhead on a 1Mbps WiFi connection: 4%
  • RTS/CTS overhead on a 11Mbps WiFi connection: 25%
  • Sending RTS/CTS packets when you don’t need to will only make this

worse.

  • Lesson: Everything is a trade-off!
  • Researchers and engineers decided that the overhead from this approach was

too high to be a feasible solution to the exposed terminal problem.

slide-15
SLIDE 15

Recap: Medium access control protocols

  • What is the general idea behind CSMA protocols?
  • Sense the medium before transmitting.
  • Why are wireless media more challenging?
  • Collisions can only be detected at the receiver and carrier sensing is not

always accurate.

  • Why do we need a CSMA/CD and CSMA/CA protocol?
  • Collisions can still occur due to transmission delays, CSMA/CD detects

these and improves throughput by stopping transmission as soon as it is detected.

  • CSMA/CA tries to avoid collisions entirely by requesting permission

from the receiver before transmission.

slide-16
SLIDE 16

16

This week in class

1.

Recap: Error detection in the link layer

2. 3.

Link layer principles: Medium access Link layer principles: Addressing

slide-17
SLIDE 17

Addressing in the link layer

  • When we studied MAC protocols, we assumed that packets

went on every wire (i.e., they were broadcasted).

  • This is why collisions occurred, but there was no need for any logic in the

link-layer hardware.

  • Originally, Ethernet was a broadcast-only medium and that’s how things
  • worked. Today, with new types of hardware we have new opportunities for

efficiency-gain.

Terminator Repeater

slide-18
SLIDE 18

Link layer and network interface technologies: Hubs

Hub

C B

Send Packet B → C

  • Discuss: What are the pros and cons of using Hubs for

your LAN?

  • Pros: Dirt cheap hardware with no logic.
  • Cons: Poor efficiency and scalability. Good enough for small LANs.
slide-19
SLIDE 19

Link layer and network interface technologies: Bridges and switches

  • Discuss: What could we do to improve efficiency and

scalability?

  • Stop using broadcast! Only send packets to their intended recipients.
  • This is what bridges and switches do. They contain logic to figure out

which wire to put packets on.

A C B

Send Packet B → C

Bridge

slide-20
SLIDE 20

Link layer and network interface technologies: Bridges and hubs in the real world

  • In the real world, we use a combination of old ethernet

broadcast nets, hubs, and bridges.

  • Bridges are usually used to create a “bridge” between two

small LANs. Hub Hub

slide-21
SLIDE 21

Link layer and network interface technologies: Bridges and hubs in the real world

  • Discuss: Why aren’t bridges used within all LANs?
  • This is the real world. You cannot force deployment – even when it is

better (Windows XP in most federal agency computers).

  • Bridges are more expensive and complex than hubs.

Hub Hub

slide-22
SLIDE 22

Link layer and network interface technologies: Bridges vs. Hubs (the internals)

  • Why are bridges more expensive and complicated?
  • They have memory for packets to be queued.
  • The have internal logic to forward packets to the correct wires.

Switch Fabric

Inputs Outputs Bridge Makes routing decisions Hub Memory buffer

slide-23
SLIDE 23

How do switches/bridges know what packet goes on which wire?

  • Each interface has a “MAC address”.
  • This is a 48-bit string that is allocated by the device manufacturer.
  • MAC addresses are unique to a device and usually cannot be changed.
  • Regulated by the IEEE.
  • Every link layer frame needs to have a source and destination MAC

address to ensure forwarding is done correctly.

slide-24
SLIDE 24

How do switches/bridges know what packet goes on which wire?

  • Each interface has a “MAC address”.
  • Each bridge/switch maintains a “forwarding table”.
  • Basically a collection of records of which MAC addresses are

accessible through which ports. Records expire after a “timeout”.

00:00:00:00:00:DD 1 3 minutes MAC address port age 00:00:00:00:00:AA 1 1 minute 00:00:00:00:00:BB 2 7 minutes 00:00:00:00:00:CC 3 2 seconds

slide-25
SLIDE 25

How do switches/bridges know what packet goes on which wire?

  • How is the forwarding table built?
  • Look at the source of each arriving frame.
  • Which MAC address sent the frame?
  • Which port did it reach the bridge on?

Hub

00:00:00:00:00:AA 00:00:00:00:00:BB Port 1 Port 2 00:00:00:00:00:BB 2 0 minutes MAC Address Port Age 00:00:00:00:00:AA 1 0 minutes

Delete old entries after a timeout

slide-26
SLIDE 26

How do switches/bridges know what packet goes on which wire?

  • How is the forwarding table used?
  • If the frame has a destination MAC address that is in the forwarding

table, send the frame out the corresponding port.

  • If the frame has a destination MAC address that is not in the

forwarding table broadcast the frame through all ports (except the incoming one).

Port 1 Port 3 Port 2 Port 4

slide-27
SLIDE 27

Forwarding tables in action

  • FF

EE DD CC BB AA Port 1 Port 2 Port 1 Port 2

Hub Hub Hub

AA 1 AA 1 CC 2 CC 1 EE 2 EE 2

Bridge 1 Bridge 2

slide-28
SLIDE 28

How loops can break forwarding protocols

  • <Src=AA, Dest=DD>
  • This continues to infinity.
  • Discuss: How do we stop this?
  • Remove loops from the topology.
  • We use an algorithm to build and

maintain a spanning tree for link layer addressing.

AA Port 1

Hub

Port 1

Hub

Port 2 Port 2 AA 1 AA 1 BB CC DD AA 2 AA 2 AA 1 AA 1

slide-29
SLIDE 29

What is a spanning tree?

  • A subset of edges in a graph that:
  • Spans all nodes.
  • Does not create any cycles.

1 4 2 5 6 3 7 1 4 2 5 6 3 7 5 1 4 2 6 3 7

slide-30
SLIDE 30

How do spanning trees help?

  • If bridges in our topology can collectively organize their forwarding

tables to make the topology seem like a spanning tree, then all loops are removed.

1 4 2 5 6 3 7 1 4 2 5 6 3 7 5 1 4 2 6 3 7

slide-31
SLIDE 31

How do nodes construct a spanning tree from any network topology?

  • All bridges randomly elect a single bridge as the “root” of the

spanning tree.

  • Example (shortest straw): All bridges pick a random number. The bridge with

the smallest random number is the root.

  • Each bridge finds the shortest path to this root.
  • Problem: Need to know who the root is!
  • Solution: Broadcast your best knowledge to all neighbors. Update your
  • knowledge. Repeat until steady state is reached.
  • The union of all these paths is a spanning tree.
slide-32
SLIDE 32

How do nodes construct a spanning tree from any network topology?

0: 0/0 12: 12/0 3: 3/0 27: 27/0 41: 41/0 9: 9/0 68: 68/0 27: 0/1 12: 0/1 41: 3/1 68: 9/1 41: 0/2 3: 0/2 68: 3/2 9: 3/2 68: 0/3 9: 0/3

slide-33
SLIDE 33

Bridges vs. Switches

  • Both make it possible to increase LAN capacity via the same

approaches.

  • Automatically learn and maintain forwarding tables.
  • A switch is a special case of a bridge.
  • Bridge: Each port can be connected to either another bridge, hub, or broadcast

net.

  • Switch: Each port can only be connected to a single device (an end-host or

another switch).

  • You don’t need MAC protocols in switches! Why?
slide-34
SLIDE 34

How does the link layer frame travel from source to destination within a LAN?

  • We know how frames are forwarded within the LAN.
  • Switches and bridges. Both rely on knowing the destination MAC address.
  • But how does the sender know the address of the receiver?
  • The Address Resolution Protocol (ARP)
  • Each end-host maintains an ARP table.
  • This is a collection of <IP address, MAC address, TTL> tuples.
  • When a packet from the network layer arrives, the link layer looks at the

destination IP address and fetches the corresponding record from the ARP table.

  • Discuss: What if there is no entry in the ARP table?
  • Broadcast an ARP request asking for a response from the end-host owning the destination IP

address.

  • ARP response has MAC address.
  • More in Assignment 2!
slide-35
SLIDE 35

Discussion

  • Could the whole Internet be one big switching domain? What

would this look like? What issues would appear?

  • Constant broadcasting to locate unknown hosts (billions of these!) would be a

disaster!

  • Reaching a steady state with the spanning tree would be very improbable.
  • Each switch would need to know every MAC address on the Internet! Think of

the memory that would required!

  • We use IP addressing and network-layer routing to avoid these

problems.

  • Topic for the next few weeks!9999999999p999