CSEE W4140 Networking Laboratory

Download Report

Transcript CSEE W4140 Networking Laboratory

CSEE W4140
Networking Laboratory
Lecture 8: LAN Switching
Jong Yul Kim
03.25.2009
Announcements
 Reminder of lab rules
 Labs are mandatory.
 Don’t connect rack machines to Internet.
 Don’t bring food / drinks to the lab.
Announcements
 Grades
 Will be uploaded today
 Field Trip
 Two separate groups / dates
 Projects
 Projects in place of finals?
 Please come see me after class
Short review of midterm
Today’s lecture
 Hubs
 Switches
 Learning algorithm
 Spanning Tree Protocol
Various equipments are used to
interconnect networks
Ethernet
Hub
Ethernet
Hub
Hosts
Hosts
Bridge
Router
X.25
Network
Tokenring
Gateway
We already know routers
 Routers operate at the Network Layer (Layer 3)
 Interconnect different subnetworks
Subnetwork
Subnetwork
Subnetwork
Router
Router
Application
Application
TCP
TCP
IP
Network
Access
Host
IP
IP protocol
Data
Link
Network
Access
IP
IP protocol
Network
Access
Router
Data
Link
Network
Access
IP protocol
Network
Access
Router
Data
Link
IP
Network
Access
Host
We’ve heard about gateways
 The term Gateway is used with different meanings in
different contexts
 Gateway is a generic term for routers (Level 3)
 “Default gateway”
 Gateway is also used for a device that interconnects
different Layer 3 networks and which performs
translation of protocols (“Multi-protocol router”)
SNA
Network
X.25
Network
IP Network
Gateway
Gateway
Ethernet Hub
 A simple repeater (extends the physical cable)
 Frame collisions are propagated
 Good for sniffing traffic in a network we want to monitor
Ethernet
Hub
Ethernet
Hub
Host
Host
IP
IP
LLC
LLC
802.3 MAC
Hub
Hub
802.3 MAC
Bridges/LAN switches

A bridge or LAN switch is a device that interconnects two or more Local
Area Networks (LANs) and forwards packets between these networks.

Bridges/LAN switches operate at the Data Link Layer (Layer 2)
Tokenring
Bridge
IP
IP
Bridge
LLC
802.3 MAC
LLC
LAN
802.3 MAC
LLC
802.5 MAC
LAN
802.5 MAC
Terminology: Bridge, LAN switch,
Ethernet switch
There are different terms to refer to a data-link layer
interconnection device:
 The term bridge was coined in the early 1980s.
 Today, the terms LAN switch or (in the context of
Ethernet) Ethernet switch are used.
Convention:
 Since many of the concepts, configuration
commands, and protocols for LAN switches were
developed in the 1980s, and commonly use the
old term `bridge’, we will, with few exceptions,
refer to LAN switches as bridges.
A Switched Enterprise Network
Internet
Router
Switch
Bridges versus Routers
Routers
Bridges

Each host’s IP address must
be configured

MAC addresses are
hardwired

If network is reconfigured, IP
addresses may need to be
reassigned

No network configuration
needed

Routing done via RIP or OSPF

Each router manipulates
packet header (e.g., reduces
TTL field)


No routing protocol needed
(sort of)



plug-and-play!
learning bridge algorithm
spanning tree algorithm
Bridges do not manipulate
frames
Frame Forwarding
 Each bridge maintains a forwarding table
with entries
< MAC address, port, age>
MAC address:
port:
age:
with interpretation:
host name or group address
port number of bridge
aging time of entry
a machine with MAC address lies in direction of
the port number from the bridge. The entry is
age time units old.
Frame Forwarding
 Assume a MAC frame arrives on port x.
Port x
Is MAC address of
destination in forwarding
table for ports A, B, or C ?
Bridge 2
Port A
Port C
Port B
Found?
Not
found ?
Flood the frame,
Forward the frame on the
appropriate port
i.e.,
send the frame on all
ports except port x.
Learning Algorithm
Routing tables entries are set
automatically with a simple
heuristic:
The source field of a frame that arrives on
a port tells which hosts are reachable from
this port.
Src=x, Dest=y
Src=x, Dest=y
Src=x,
Src=y, Dest=x
Dest=y
Port 1
Port 4
x is at Port 3
y is at Port 4
Port 2
Port 3
Port 5
Port 6
Src=x,
Src=y, Dest=x
Dest=y
Src=x, Dest=y
Src=x, Dest=y
Learning Algorithm
Algorithm:
 For each frame received, the source
stores the source field in the forwarding
database together with the port where
the frame was received.
 All entries are deleted after some time
(default is 15 seconds).
Learning Algorithm Example
•Consider the following packets:
(Src=A, Dest=F),
(Src=C, Dest=A), (Src=E, Dest=C)
•What have the bridges learned?
Bridge 2
Port1
Bridge 2
Port2
LAN 1
A
B
Port2
Port1
LAN 2
C
LAN 3
D
E
F
Danger of Loops
 Consider the two LANs that are
connected by two bridges.
 Assume host n is transmitting a
frame F with unknown destination.
What is happening?
 Bridges A and B flood the frame
to LAN 2.
 Bridge B sees F on LAN 2 (with
unknown destination), and copies
the frame back to LAN 1
 Bridge A does the same.
 The copying continues
LAN 2
F
F
Bridge B
Bridge A
F
F
LAN 1
F
Where’s the problem? What’s the
solution ?
host n
Spanning Tree Protocol (STP)
 A solution is to prevent loops in the topology
 IEEE 802.1d has an algorithm that builds and
maintains a spanning tree in a dynamic environment
 Bridges that run 802.1d are called transparent bridges
 Bridges exchange messages to configure the bridge
(Configuration Bridge Protocol Data Unit,
Configuration BPDUs) to build the tree.
 Using the BPDUs, each bridges makes a local decision
which of its ports are part of the spanning tree
Diagram of a spanning tree
Disabled ports
Forwarding ports
Concepts
 Each bridge as a unique identifier:
Bridge ID = <priority number + MAC address>
Note that a bridge has several MAC addresses
(one for each port), but only one ID
* lower priority number has higher priority
(The lower the better!!)
 Each port within a bridge has a unique
identifier (port ID).
 Root Bridge
 The bridge with the lowest identifier is the root of
the spanning tree.
 Root Port
 Each bridge has a root port which identifies the
next hop from a bridge to the root.
Concepts
 Root Path Cost
 For each bridge, the cost of the min-cost path to the
root.
 The lower the better!!
 Designated Bridge, Designated Port
 Lowest cost bridge on the segment is the designated
bridge.
 On the designated bridge, the port that is attached to
the segment is the designated port.
 if two bridges have the same cost, select the one with
highest priority
 if the min-cost bridge has two or more ports on the LAN,
select the port with the lowest identifier
Configuration BPDUs
Destination
MAC address
Source MAC
address
Set to 0
Set to 0
version
message type
lowest bit is "topology change bit (TC bit)
flags
root ID
Configuration
Message
Set to 0
protocol identifier
Cost
bridge ID
port ID
ID of root
Cost of the path from the
bridge sending this
message
ID of bridge sending this message
message age
maximum age
Time between
BPDUs from the root
(default: 1sec)
priority of configurable interface
(used for loop detection)
hello time
forward delay
Time between
recalculations of the
spanning tree
(default: 15 secs)
time since root sent a
message on
which this message is based
Steps of Spanning Tree
Algorithm
1. Determine the root bridge
2. Determine the root port on all other bridges
3. Determine the designated port on each LAN
 Each bridge is sending out BPDUs that
contain the following information:
root ID cost bridge ID/port ID
root bridge (what the sender thinks it is)
root path cost for sending bridge
Identifies sending bridge
Determine the Root Bridge
 Initially, all bridges assume they are the root
bridge.
 Each bridge B sends BPDUs of this form on its
LANs:
B
0
B
 Each bridge looks at the BPDUs received on all its
ports and its own transmitted BPDUs.
 Root bridge is the smallest received root ID that
has been received so far (Whenever a smaller ID
arrives, the root is updated)
Calculate the Root Path Cost
Determine the Root Port
 At this time: A bridge B has a belief of who the root is, say
R.
 Bridge B determines the Root Path Cost (Cost) as follows:
 If B = R :
 If B  R:
Cost
R
Cost = 0.
Cost = {Smallest Cost in any of BPDUs that were
B
received} +
cost of B’s interface where this BPDU was received
 B’s root port is the port from which B received the lowest
cost path to R
 Knowing R and Cost, B can generate its BPDU (but will not
necessarily send it out)
Default Cost
Ethernet Speed
Cost
10 Mbps
100
100 Mbps
19
1 Gbps
4
10 Gbps
2
Calculate the Root Path Cost
Determine the Root Port
At this time: B has generated its BPDU
R
Cost
B
B will send this BPDU on one of its ports,
say port x, only if its BPDU is lower than
any BPDU that B received from port x.
In this case, B also assumes that it
is the designated bridge for the
LAN to which the port connects.
Selecting the Ports for Spanning Tree
 Each bridges makes a local decision which
of its ports are part of the spanning tree
 B will decide which ports are in the
spanning tree:
 B’s root port is part of the spanning tree
 All designated ports are part of the spanning
tree
 All other ports are not part of the spanning tree
 B’s ports that are in the spanning tree will
forward packets (=forwarding state)
 B’s ports that are not in the spanning tree
will not forward packets (=blocking state)
Homework
 Prelab 6 due this Friday
 Lab reports due this week
Main Points of Lab 6
 Hubs vs. switches
 Switches
 Learning algorithm
 Spanning Tree Protocol