CS 210
Introduction to Computer Networks
application
transport
network
data link
physical
Link Layer
Local Area Networks (LANs) – Part II
Some slides are adapted from “Computer Networking – a Top-Down Approach”
© 1996-2012 by J.F Kurose and K.W. Ross, All Rights Reserved
Questions
• How does an Ethernet switch work?
• What are the differences between a switch
and a router?
• What/Why/How of VLANs?
• How do data center networks look like?
• How does a HTTP GET request message
reach its destination?
1
Ethernet Switch
• link-layer device: takes an active role
– store, forward Ethernet frames
– examine incoming frame’s MAC address,
selectively forward frame to one-or-more
outgoing links
• transparent
– hosts are unaware of presence of switches
• plug-and-play, self-learning
– switches do not need to be configured
Switch: Multiple Simultaneous Transmissions
• hosts have dedicated, direct A
connection to switch
C’ B
• switches buffer packets
• Ethernet protocol used on each 6 1 2
incoming link, but no collisions;
full duplex 5 4 3
– each link is its own collision
B’ C
domain
• switching: A-to-A’ and B-to-B’
can transmit simultaneously, A’
without collisions switch with six interfaces
(1,2,3,4,5,6)
2
Switch Forwarding Table
Q: how does switch know A’ A
reachable via interface 4, B’ B
C’
reachable via interface 5?
❖ A: each switch has a switch 6 1 2
table, each entry:
5 4 3
▪ (MAC address of host, interface
to reach host, time stamp) B’ C
▪ looks like a routing table!
A’
Q: how are entries created, switch with six interfaces
maintained in switch table? (1,2,3,4,5,6)
▪ something like a routing
protocol?
5
Switch: Self-learning Source: A
Dest: A’
A A A’
• switch learns which hosts
can be reached through
C’ B
which interfaces
– when frame received, 6 1 2
switch “learns” location
of sender: incoming LAN 5 4 3
segment
– records sender/location B’ C
pair in switch table
A’
MAC addr interface TTL
A 1 60 Switch table
(initially empty)
3
Switch: Frame filtering/forwarding
when frame received at switch:
1. record incoming link, MAC address of sending host
2. index switch table using MAC destination address
3. if entry found for destination
then {
if destination on segment from which frame arrived
then drop frame
else forward frame on interface indicated by entry
}
else flood /* forward on all interfaces except arriving
interface */
Self-learning, forwarding: Example Source: A
Dest: A’
A A A’
• frame destination, A’,
location unknown: flood C’ B
❖ destination A location 6 1 2
known: selectively send A A’
5 4 3
on just one link B’ C
A’ A
A’
MAC addr interface TTL
A 1 60 switch table
A’ 4 60 (initially empty)
4
Interconnecting Switches
❖ switches can be connected together
S4
S1
S3
A S2
F
D I
B C
G H
E
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!)
9
Self-learning Multi-switch Example
Suppose C sends frame to I, I responds to C
S4
S1
S3
A S2
F
D I
B C
G H
E
❖ Q: show switch tables and packet forwarding in S1, S2, S3,
S4
10
10
5
Institutional Network Example
mail server
to external
network
router web server
IP subnet
11
11
Switches vs. Routers
application
transport
both are store-and-forward:
datagram network
▪routers: network-layer frame link
devices (examine network- physical link frame
layer headers) physical
▪switches: link-layer devices
(examine link-layer headers) switch
both have forwarding tables: network datagram
link
▪routers: compute tables frame
using routing algorithms, IP physical
addresses application
▪switches: learn forwarding transport
table using flooding, learning, network
MAC addresses link
physical
12
12
6
VLANs: Motivation
consider:
• CS user moves office to EE,
but wants connect to CS
switch?
• single broadcast domain:
– all layer-2 broadcast
traffic (ARP, DHCP,
unknown location of
Computer
Computer destination MAC
Science Electrical
Engineering
Engineering address) must cross
entire LAN
– security/privacy,
efficiency issues
13
13
VLANs – cont’d port-based VLAN: switch ports grouped (by
switch management software) so that single
physical switch ……
Virtual Local
1 7 9 15
Area Network 2 8 10 16
switch(es) supporting
VLAN capabilities can be … …
configured to define
Electrical Engineering Computer Science
multiple virtual LANS over (VLAN ports 1-8) (VLAN ports 9-16)
single physical LAN
… operates as multiple virtual switches
infrastructure.
1 7 9 15
2 8 10 16
… …
Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-16)
14
14
7
Port-based VLAN
router
❖ traffic isolation: frames
to/from ports 1-8 can only
reach ports 1-8
▪ can also define VLAN based on
MAC addresses of endpoints, 15
1 7 9
rather than switch port 2 8 10 16
❖ dynamic membership: ports
can be dynamically assigned … …
among VLANs Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-15)
❖ forwarding between VLANS: done
via routing (just as with separate
switches)
▪ in practice vendors sell combined
switches plus routers
15
15
VLANS Spanning Multiple Switches
1 7 9 15 1 3 5 7
2 8 10 16 2 4 6 8
… …
Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN
(VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN
• trunk port: carries frames between VLANS defined over
multiple physical switches
– frames forwarded within VLAN between switches can’t be vanilla 802.1
frames (must carry VLAN ID info)
– 802.1q protocol adds/removed additional header fields for frames
forwarded between trunk ports
16
16
8
802.1Q VLAN Frame Format
type
preamble dest. source data (payload) CRC
address address 802.1 frame
type
dest. source
preamble
address address
data (payload) CRC 802.1Q frame
2-byte Tag Protocol Identifier Recomputed
(value: 81-00) CRC
Tag Control Information (12 bit VLAN ID field,
3 bit priority field like IP TOS)
17
17
Data center networks
• 10’s to 100’s of thousands of hosts, often closely
coupled, in close proximity:
– e-business (e.g. Amazon)
– content-servers (e.g., YouTube, Akamai, Apple, Microsoft)
– search engines, data mining (e.g., Google)
▪ challenges:
▪ multiple applications, each
serving massive numbers of
clients
▪ managing/balancing load,
avoiding processing,
networking, data bottlenecks
Inside a 40-ft Microsoft container,
Chicago data center
18
18
9
Data center networks – cont’d
load balancer: application-layer routing
▪ receives external client requests
▪ directs workload within data center
▪ returns results to external client (hiding data
Internet center internals from client)
Border router
Load Load
balancer Access router
balancer
Tier-1 switches
B
A C Tier-2 switches
TOR switches
Server racks
1 2 3 4 5 6 7 8
19
19
Data center networks – cont’d
▪ rich interconnection among switches, racks:
• increased throughput between racks (multiple routing paths
possible)
• increased reliability via redundancy
Tier-1 switches
Tier-2 switches
TOR switches
Server racks
1 2 3 4 5 6 7 8
20
20
10
Synthesis: a day in the life of a web request
• journey down protocol stack complete!
– application, transport, network, link
• putting-it-all-together: synthesis!
– goal: identify, review, understand protocols (at all
layers) involved in seemingly simple scenario:
requesting www page
– scenario: student attaches laptop to campus network,
requests/receives [Link]
21
21
A day in the life: scenario
browser DNS server
Comcast network
[Link]/13
school network
[Link]/24
web page
web server Google’s network
[Link] [Link]/19
22
22
11
A day in the life… connecting to the Internet
DHCP DHCP • connecting laptop needs to
DHCP UDP
IP
get its own IP address, addr
of first-hop router, addr of
DHCP
DHCP Eth
Phy DNS server: use DHCP
DHCP
▪ DHCP request encapsulated
in UDP, encapsulated in IP,
DHCP
DHCP
DHCP UDP
encapsulated in 802.3
DHCP IP Ethernet
DHCP Eth router
Phy (runs DHCP) ▪ Ethernet frame broadcast
(dest: FFFFFFFFFFFF) on LAN,
received at router running
DHCP server
▪ Ethernet demuxed to IP
demuxed, UDP demuxed to
DHCP
23
23
A day in the life… connecting to the Internet
DHCP DHCP •DHCP server formulates
DHCP UDP DHCP ACK containing
DHCP IP client’s IP address, IP
DHCP Eth address of first-hop router
Phy for client, name & IP address
of DNS server
▪ encapsulation at DHCP
DHCP DHCP server, frame forwarded
DHCP UDP (switch learning) through
DHCP IP LAN, demultiplexing at client
DHCP Eth router
(runs DHCP)
DHCP
Phy ▪ DHCP client receives DHCP
ACK reply
Client now has IP address, knows name & addr of DNS
server, IP address of its first-hop router
24
24
12
A day in the life… ARP (before DNS, before HTTP)
DNS DNS • before sending HTTP request, need
DNS UDP IP address of [Link]: DNS
DNS
ARP
IP
ARP query Eth
Phy ▪ DNS query created, encapsulated in
UDP, encapsulated in IP,
encapsulated in Eth. To send frame
ARP
to router, need MAC address of
ARP reply Eth
Phy router interface: ARP
▪ ARP query broadcast, received by
router
(runs DHCP) router, which replies with ARP
reply giving MAC address of
router interface
▪ client now knows MAC address
of first hop router, so can now
send frame containing DNS
query
25
25
A day in the life… using DNS DNS
DNS UDP DNS server
DNS IP
DNS DNS DNS Eth
DNS UDP DNS Phy
DNS IP
DNS Eth
Phy
DNS
Comcast network
[Link]/13
router
▪ IP datagram forwarded from
(runs DHCP) campus network into Comcast
▪ IP datagram containing DNS network, routed (tables created
query forwarded via LAN by RIP, OSPF, IS-IS and/or BGP
switch from client to 1st hop routing protocols) to DNS server
router ▪ demuxed to DNS server
▪ DNS server replies to client
with IP address of
[Link]
26
26
13
A day in the life…TCP connection carrying HTTP
HTTP
HTTP
SYNACK
SYN TCP
SYNACK
SYN IP
SYNACK
SYN Eth
Phy
▪ to send HTTP request,
client first opens TCP
router socket to web server
(runs DHCP) ▪ TCP SYN segment (step 1 in 3-
SYNACK
SYN TCP
SYNACK
SYN IP
way handshake) inter-domain
SYNACK
SYN Eth routed to web server
Phy ▪ web server responds with TCP
SYNACK (step 2 in 3-way
web server handshake)
[Link] ▪ TCP connection established!
27
27
A day in the life… HTTP request/reply
HTTP
HTTP HTTP
▪ web page finally (!!!) displayed
HTTP
HTTP TCP
HTTP
HTTP IP
HTTP
HTTP Eth
Phy
▪ HTTP request sent into
TCP socket
router ▪ IP datagram containing HTTP
HTTP
HTTP
HTTP TCP
(runs DHCP) request routed to
HTTP IP [Link]
HTTP Eth ▪ web server responds with
Phy HTTP reply (containing web
page)
web server
[Link]
▪ IP datagram containing HTTP
reply routed back to client
28
28
14
Quote of The Day
29
29
15