28
EEC-484/584 EEC-484/584 Computer Networks Computer Networks Lecture 14 Lecture 14 Wenbing Zhao Wenbing Zhao [email protected]

EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao [email protected]

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

EEC-484/584EEC-484/584Computer NetworksComputer Networks

Lecture 14Lecture 14

Wenbing ZhaoWenbing Zhao

[email protected]

22

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

OutlineOutline• Reminder

– Lab#5: this Wednesday (4/28)– Quiz#4 moved to 5/12 (Wednesday)– Project due today midnight!

• ARP and DHCP• Hubs and switches

33

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-33

Ethernet/MAC AddressesEthernet/MAC Addresses

• Ethernet (or MAC or LAN or physical) address: – Function: get frame from one interface to

another physically-connected interface (same network)

– 48 bit MAC address• Burned in NIC ROM, also sometimes software

settable

04/18/2304/18/23

44

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-44

MAC AddressesMAC AddressesEach adapter on Ethernet has unique MAC address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

04/18/2304/18/23

55

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-55

MAC AddressesMAC Addresses

• MAC address allocation administered by IEEE• Manufacturer buys portion of MAC address space (to

assure uniqueness)• 32-bit IP address:

– network-layer address– used to get datagram to destination IP subnet

• MAC flat address ➜ portability – Can move LAN card from one LAN to another

• IP hierarchical address NOT portable– Address depends on IP subnet to which node is attached

04/18/2304/18/23

66

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-66

ARP: Address Resolution ProtocolARP: Address Resolution Protocol

• Each IP node (host, router) on LAN has ARP table

• ARP table: IP/MAC address mappings for some LAN nodes

< IP address; MAC address; TTL>

– TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)

Question: how to determineMAC address of B

knowing B’s IP address?

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137.196.7.23

137.196.7.78

137.196.7.14

137.196.7.88

04/18/2304/18/23

77

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-77

ARP Protocol: Same LANARP Protocol: Same LAN

• A wants to send datagram to B, and B’s MAC address not in A’s ARP table.

• A broadcasts ARP query packet, containing B's IP address

– Dest MAC address = FF-FF-FF-FF-FF-FF

– All machines on LAN receive ARP query

• B receives ARP packet, replies to A with its (B's) MAC address– Frame sent to A’s MAC

address (unicast)

• A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) – Soft state: information that

times out (goes away) unless refreshed

• ARP is “plug-and-play”:– Nodes create their ARP

tables without intervention from net administrator

04/18/2304/18/23

88

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-88

Addressing: Routing to Another LANAddressing: Routing to Another LAN

R

1A-23-F9-CD-06-9B

222.222.222.220111.111.111.110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111.111.111.112

111.111.111.111

A74-29-9C-E8-FF-55

222.222.222.221

88-B2-2F-54-1A-0F

B222.222.222.222

49-BD-D2-C7-56-2A

Walkthrough: send datagram from A to B via R

Assume A knows B’s IP address

• Two ARP tables in router R, one for each IP network

04/18/2304/18/23

99

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-99

• A creates IP datagram with source A, destination B • A uses ARP to get R’s MAC address for 111.111.111.110

• A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram

• A’s NIC sends frame • R’s NIC receives frame • R removes IP datagram from Ethernet frame, sees its destined

to B• R uses ARP to get B’s MAC address • R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222.222.222.220

111.111.111.110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111.111.111.112

111.111.111.111

A74-29-9C-E8-FF-55

222.222.222.221

88-B2-2F-54-1A-0F

B222.222.222.222

49-BD-D2-C7-56-2A

This is a really importantexample – make sure you

understand!

04/18/2304/18/23

1010

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

ARP – ExerciseARP – Exercise• Node 1 wants to send a packet to node 4, what will be

returned by ARP?• Node 1 wants to send a packet to node 2, what will be

returned by ARP?

1111

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

RARP RARP –– Reverse Address Resolution ProtocolReverse Address Resolution Protocol

• RARP - Allows a newly-booted diskless-workstation (e.g., X terminal) to broadcast its Ethernet address and ask for its IP address– RARP server responds to a RARP request with the

assigned IP address

32-bit Internet address

48-bit Ethernet address

ARP RARP

1212

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Limitations of RARPLimitations of RARP

• RARP uses a link-layer broadcast, RARP requests are not forwarded by routers, therefore, an RARP server must be present on every network

• The only thing returned by the RARP server is the IP address

1313

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

BOOTP BOOTP –– Bootstrap Protocol Bootstrap Protocol• BOOTP – uses UDP

– A client broadcasts to 255.255.255.255– The source IP address is set to 0.0.0.0 if client does

not know its own IP address yet– Port number: 67 for server, 68 for client

• BOOTP drawbacks– Requires manual configuration of tables mapping IP

address to Ethernet address at the BOOTP server• Replaced by DHCP

1414

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Dynamic Host Configuration ProtocolDynamic Host Configuration Protocol

• Allow host to dynamically obtain its IP address from network server when it joins network– IP address assignment is lease-based (to cope with

client failure, also enables reuse of addresses)– Can renew its lease on address in use

• DHCP overview (UDP is used for communication)– 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

1515

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

DHCP ReplayDHCP Replay• A DHCP relay agent can be configured on each LAN• The agent stores the IP address of the DHCP server and

forward the request to the server

1616

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

DHCP with Replay AgentDHCP with Replay Agent

• To find its IP address, a newly-booted machine broadcasts a DHCP Discover packet

• The DHCP relay agent on its LAN receives all DHCP broadcasts

• On receiving a DHCP Discover packet, the agent sends the packet as a unicast packet to the DHCP server, possibly on a distant network

1717

Link Layer DevicesLink Layer Devices

• Hubs

• Switches

04/18/2304/18/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

1818

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks5-5-1818

HubsHubs… physical-layer (“dumb”) repeaters:

– Bits coming in one link go out all other links at same rate– All nodes connected to hub can collide with one another– No frame buffering– No CSMA/CD at hub: host NICs detect collisions

twisted pair

hub

04/18/2304/18/23

1919

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-1919

SwitchSwitch

• Link-layer device: smarter than hubs, take active role– Store, forward Ethernet frames– Examine incoming frame’s MAC address, selectively forward

frame to one-or-more outgoing links when frame is to be forwarded on segment, uses CSMA/CD to access segment

• Transparent– Hosts are unaware of presence of switches

• Plug-and-play, self-learning– Switches do not need to be configured

04/18/2304/18/23

2020

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2020

Switch: Allows Switch: Allows MultipleMultiple Simultaneous Simultaneous TransmissionsTransmissions

• Hosts have dedicated, direct connection to switch

• Switches buffer packets• Ethernet protocol used on

each incoming link, but no collisions; full duplex– Each link is its own collision

domain

• Switching: a-to-a’ and b-to-b’ simultaneously, without collisions – Not possible with dumb hub

A

A’

B

B’

C

C’

switch with six interfaces(1,2,3,4,5,6)

1 23

45

6

04/18/2304/18/23

2121

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2121

Switch TableSwitch Table

• Q: how does switch know that A’ reachable via interface 4, B’ reachable via interface 5?

• A: each switch has a switch table, each entry:– (MAC address of host, interface to

reach host, time stamp)

• Looks like a routing table!• Q: how are entries created,

maintained in switch table? – Something like a routing protocol?

04/18/2304/18/23

A

A’

B

B’

C

C’

switch with six interfaces(1,2,3,4,5,6)

1 23

45

6

2222

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2222

Switch: Self-LearningSwitch: Self-Learning

• Switch learns which hosts can be reached through which interfaces– When frame received, switch

“learns” location of sender: incoming LAN segment

– Records sender/location pair in switch table

A

A’

B

B’

C

C’

1 23

45

6

A A’

Source: ADest: A’

Switch table (initially empty)

04/18/2304/18/23

2323

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2323

Switch: Frame Filtering/ForwardingSwitch: Frame Filtering/Forwarding

When frame received:

1. record link associated with sending host

2. index switch table using MAC dest address

3. if entry found for destination then {

if dest on segment from which frame arrived then drop the frame

else forward the frame on interface indicated

}

else flood

forward on all but the interface on which the frame arrived

04/18/2304/18/23

2424

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2424

Self-Learning, Self-Learning, Forwarding: Forwarding:

ExampleExampleA

A’

B

B’

C

C’

1 23

45

6

A A’

Source: ADest: A’

Switch table (initially empty)

A A’A A’A A’A A’A A’

• Frame destination unknown: flood• Destination A location known:

selective send

A’ A

04/18/2304/18/23

2525

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2525

Interconnecting SwitchesInterconnecting Switches

• Switches can be connected together

A

B

Q: sending from A to G - how does S1 know to forward frame destined to F via S4 and S3?

A: self learning! (works exactly the same as in single-switch case!)

S1

C D

E

FS2

S4

S3

H

I

G

04/18/2304/18/23

2626

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2626

Self-Learning Multi-Switch ExampleSelf-Learning Multi-Switch Example

Suppose C sends frame to I, I responds to C

Q: show switch tables and packet forwarding in S1, S2, S3, S4

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2

04/18/2304/18/23

2727

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2727

Institutional NetworkInstitutional Network

04/18/2304/18/23

2828

EEC-484/584: Computer NetworksEEC-484/584: Computer Networks 5-5-2828

Switches vs. RoutersSwitches vs. Routers• Both store-and-forward devices

– Routers: network layer devices (examine network layer headers)– Switches are link layer devices

• Routers maintain routing tables, implement routing algorithms

• Switches maintain switch tables, implement filtering, learning

algorithms

04/18/2304/18/23