Download port

Document related concepts

Cracking of wireless networks wikipedia , lookup

Parallel port wikipedia , lookup

Spanning Tree Protocol wikipedia , lookup

Transcript
Advanced Lab in Computer
Communications
Meeting 2 – Hubs, Bridges and Switches
Instructor: Tom Mahler
Some slides taken from:
Computer Networks 2008 in CS department, University of Virginia (Instructor: Prof. Jörg Liebeherr)
Hubs, Bridges and Switches

Companies and institutions consist of different
departments, with each having it’s own LAN.

Hubs, Bridges and Switches are 3 different
approaches for connecting LANs.

Question: Why can’t they all use a single
LAN?
2
Ethernet Hub

Used to connect hosts to Ethernet LAN and to connect
multiple Ethernet LANs

Collisions are propagated
Ethernet
Hub
Ethernet
Hub
Host
Host
IP
IP
LLC
LLC
802.3 MAC
Hub
Hub
802.3 MAC
3
Hubs

Hubs are multiway repeaters.

When a bit comes into a hub interface, the hub
simply broadcasts the bit on all the other interfaces.

All LANs connected using a hub are on a single
collision domain.

Hubs are Physical Layer devices.

Simple and cheap
4
Bridges

Bridges operate on Ethernet frames
2nd Layer devices (Data Link Layer)

Bridges forward and filter frames using the
LAN destination address (MAC address).

The frames are forwarded only to the relevant
interfaces.
5
Bridges
Tokenring
Bridge
IP
IP
Bridge
LLC
802.3 MAC
LLC
LAN
802.3 MAC
LLC
802.5 MAC
LAN
802.5 MAC
6
Three departmental LANs interconnected with a bridge
7
Three departmental LANs interconnected with a
bridge - Advantages

Support interdepartmental communication

Each LAN is an isolated collision domain

Bridges can interconnect different LAN
technologies: 10Mbps and 100Mbps

In theory there is no limit to how large the
LAN can grow…
8
Switches





From the mid 90’s the switch replaced the
bridge…
Switches are advanced bridges
Switches generally have more interfaces
Switches generally designed for high
performance (at least 100Mbps)
Main difference: Switches operate in fullduplex mode
9
Full-Duplex Star Topology

2 pairs of wire: Upload and
download are done simultaneously

If a node is connected directly to
the Switch it means it has a
dedicated-access


Since switches do “store and
forward”, no collision are possible
on dedicated-access lines.
On dedicated-access lines there is
no need for CSMA/CD !
10
Ethernet Hubs vs. Ethernet Switches

An Ethernet switch is a packet switch for Ethernet
frames



Buffering of frames prevents collisions.
Each port is isolated and builds its own collision domain
An Ethernet Hub does not perform buffering:

Collisions occur if two frames arrive at the same time.
Hub
Switch
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
HighSpeed
Backplane
CSMA/CD
Input
Buffers
CSMA/CD
CSMA/CD
Output
Buffers
11
Routers


Routers operate at the Network Layer (Layer 3)
Interconnect IP networks
IP network
IP network
IP network
Host
Router
Host
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
12
Switches Versus Routers – Don’t Confuse





Routers are operating in layer-3
Both can be used for packet switching.
Both create different collision domains.
Networks admins often have to choose between
them.
Routers will be discussed in labs 4 and 6
13
Interconnecting networks:
Switches versus Routers
Routers
Switches

Each host’s IP address must be
configured

MAC addresses of hosts are
hardwired

If network is reconfigured, IP
addresses may need to be reassigned

No network configuration needed

Routing done via RIP or OSPF

Routing done by

Each router manipulates packet
header (e.g., reduces TTL field)


learning bridge algorithm

spanning tree algorithm
Switches do not manipulate frames
14
Switches Versus Routers
Switches
Routers
Plug-and-Play
Need a lot of configurations
Simple – Can handle high packet
rates
Complex – Work slower
Always use the same path
(spanning tree)
Can use a different paths each
time.
What for?
No defense against broadcast
storms and attacks
Most routers are also firewalls
Used in smaller LANs (up to
hundreds of hosts)
Used along bridges in larger LANs
(thousands of hosts)
15
Two Switching Methods


Store-and-forward – The entire frame is received before any
forwarding takes place.
 The destination and source addresses are read and filters are
applied before the frame is forwarded.
 CRC Check done
Cut-through – The frame is forwarded through the switch before
the entire frame is received.
 This mode decreases the latency of the transmission, but also
reduces error detection (may reduce throughput).
16
Bridges
Overall design goal: Complete transparency
“Plug-and-play”
Self-configuring without hardware or software changes
Bridges should not impact operation of existing LANs
Three parts to understanding bridges:
(1) Forwarding of Frames
(2) Learning of Addresses
(3) Spanning Tree Algorithm
17
(1) Frame Forwarding

Each bridge maintains a MAC forwarding table

Forwarding table plays the same role as the routing table
of an IP router
Entries have the form ( MAC address, port, age), where

MAC address:
host name or group address
port:
port number of bridge
age:
aging time of entry (in seconds)
with interpretation:
a machine with MAC address lies in direction of the port number
from the bridge. The entry is age time units old.
MAC forwarding table
MAC address
a0:e1:34:82:ca:34
45:6d:20:23:fe:2e
port age
1
2
10
20
18
(1) Frame Forwarding

Port x
Assume a MAC frame arrives on port x.
Is MAC address of
destination in forwarding
table for ports A, B, or C ?
Found?
Bridge 2
Port A
Port C
Port B
Not
found ?
Flood the frame,
Forward the frame on the
appropriate port
i.e.,
send the frame on all
ports except port x.
19
(2) Address Learning (Learning Bridges)

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
Port 1
Port 4
Port 2
Port 5
Port 3
Port 6
20
(2) Address Learning (Learning Bridges)

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.
Port 1
Port 4
x is at Port 3
Port 2
Port 5
Port 3
Port 6
21
(2) Address Learning (Learning Bridges)

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
Port 1
Port 4
Src=x,
Src=y, Dest=x
Dest=y
x is at Port 3
Src=x, Dest=y
Port 2
Port 3
Port 5
Port 6
Src=x, Dest=y
Src=x, Dest=y
22
(2) Address Learning (Learning Bridges)

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.
Port 1
Port 4
Src=y, Dest=x
x is at Port 3
Port 2
Port 5
Port 3
Port 6
23
(2) Address Learning (Learning Bridges)

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.
Port 1
Port 4
x is at Port 3
y is at Port 4
Src=x,
Src=y, Dest=x
Dest=y
Port 2
Port 5
Port 3
Port 6
24
(2) Address Learning (Learning Bridges)
Learning 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).
Src=y, Dest=x
Port 1
Port 4
x is at Port 3
y is at Port 4
Src=y, Dest=x
Port 2
Port 5
Port 3
Port 6
25
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
26
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.
LAN 2
F
F
F
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
Bridge B
Bridge A
Where’s the problem? What’s the solution ?
F
LAN 1
F
host n
27
STP

Redundant connections can greatly improve
robustness

But!! Problems with cycling and multiplying
frames.

The answer: STP – Spanning Tree Protocol
28
STP (IEEE 802.1d)

The Spanning Tree Protocol (STP) is a
LAN 2
solution to prevent loops when forwarding
frames between LANs
The STP is standardized as the IEEE 802.1d
Bridge 4
Bridge 3
protocol
The STP organizes bridges and LANs as
spanning tree in a dynamic environment
LAN 5
Bridge 1
 Frames are forwarded only along the
branches of the spanning tree
Bridge 5
 Note: Trees don’t have loops
d


LAN 1

Bridges exchange messages to configure
the bridge (Configuration Bridge Protocol
Data Unit or BPDUs) to build the tree.
Bridge 2
LAN 3
LAN 4
29
Configuration BPDUs
Destination
MAC address
Source MAC
address
message type
Set to 0
lowest bit is "topology change bit (TC bit)
flags
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
ID of port from which
message is sent
maximum age
Time between
BPDUs from the root
(default: 1sec)
Set to 0
version
root ID
Configuration
Message
Set to 0
protocol identifier
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
30
Information Contained in BPDUs
31
What do the BPDUs do?
With the help of the BPDUs, bridges can:

Elect a single bridge as the root bridge.

Calculate the distance of the shortest path to the root
bridge

Each LAN can determine a designated bridge, which is
the bridge closest to the root. The designated bridge will
forward packets towards the root bridge.

Each bridge can determine a root port, the port that
gives the best path to the root.

Select ports to be included in the spanning tree.
32
Concepts

Each bridge has a unique identifier:
Bridge ID
Bridge ID = Priority :
2 bytes
Bridge MAC address: 6 bytes

Priority is configured

Bridge MAC address is lowest MAC addresses of all ports

Each port of 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.
33
Concepts

Root Path Cost: For each bridge, the cost of the
min-cost
path to the root. Shortest path is based
on cumulative link costs

Link costs are based on the speed of the link
34
Steps of Spanning Tree Algorithm

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
Identifies the sending port


The transmission of BPDUs results in the distributed
computation of a spanning tree
The convergence of the algorithm is very quick
35
Ordering of Messages

Ordering of BPDU messages
ID R1 C1 ID B1 ID P1
M1
ID R2 C2 ID B2 ID P2
M2
We say M1 advertises a better path than M2 (“M1<<M2”) if
(R1 < R2),
Or (R1 == R2) and (C1 < C2),
Or (R1 == R2) and (C1 == C2) and (B1 < B2),
Or (R1 == R2) and (C1 == C2) and (B1 == B2) and (P1 < P2)
36
Initializing the Spanning Tree Protocol

Initially, all bridges assume they are the root bridge.

Each bridge B sends BPDUs of this form on its LANs from
each port P:
B
0
B
P

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)
37
Operations of Spanning Tree Protocol


Each bridge B looks on all its ports for BPDUs that are better than its
own BPDUs
Suppose a bridge with BPDU:
M1
R1 C1 B1 P1
M2
R2 C2 B2 P2
receives a “better” BPDU:
Then it will update the BPDU to:
R2 C2+1 B1 P1


However, the new BPDU is not necessarily sent out
On each bridge, the port where the “best BPDU” (via relation “<<“) was
received is the root port of the bridge.
38
When to send a BPDU

Say, B has generated a BPDU for each port x
R

Cost
B
x
B will send this BPDU on port x only if its
BPDU is better (via relation “<<“) than any
BPDU that B received from port x.
Port x
Bridge B
Port A

In this case, B also assumes that it
is the designated bridge for the
LAN to which the port connects

And port x is the designated port of that LAN
Port C
Port B
39
Selecting the Ports for the Spanning
Tree

Each bridge makes a local decision which of its ports are part
of the spanning tree

Now B can 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)
40
Building the Spanning Tree


LAN 2
Consider the network on the
right.
Assume that the bridges have
calculated the designated ports
(D) and the root ports (R) as
indicated.
d
D
Bridge
Bridge
D
R
R
LAN 5
Bridge
R
Bridge
D

LAN 1
What is the spanning tree?

On each LAN, connect R
ports to the D ports on this
LAN
R
D
LAN 3
Bridge
D
LAN 4
41
STP

The STP tree is a connected subset of the original graph that
does not contain cycles.

Interfaces that are not part of the tree are disconnected and the
loops are removed.

BPDU – Are transmitted on the network (link layer), between the
switches. This exchange of messages results in the following:
- The election of a root
-The election of a designated switch for every LAN segment
- Removal of loops by placing redundant switch ports in a backup
state.
42
Port roles




STP makes ports:
Root ports (forwarding)
Designated ports (forwarding)
Non-designated ports (shut down)
43
Port roles
44
STP port states





Blocking – receives BPDU frames.
Listening - receives and transmits BPDU
frames.
Learning - receives and transmits BPDU
frames. Learns MAC addresses.
Forwarding – Fully active, forwards user data.
Disabled – Administratively shut down.
45
States and timers
Blocking
Loss of BPDU detected
Max-age = 20 sec
Listening
Forward delay = 15 sec
Learning
Forward delay = 15 sec
Forwarding
Blocking
When link first
comes up
Hello timer 2 sec for
sending BPDUs.
Up to 50 sec from
broken link to
forwarding again.
46
Stages of spanning-tree port states





Time is required for (BPDU) protocol information to
propagate throughout a switched network.
Topology changes in one part of a network are not instantly
known in other parts of the network.
There is propagation delay.
A switch should not change a port state from inactive
(Blocking) to active (Forwarding) immediately, as this
may cause data loops.
Each port on a switch that is using the Spanning-Tree
Protocol has one of five states
47
Example of redundant links
48
X Fails
Not seeing
BPDU from
Cat-B
Hub





Ages out
BPDU and
goes into
Listening
mode
Cat-B:1/2 fails.
Cat-C has no immediate notification because it’s still receiving a link
from the hub.
Cat-C notices it is not receiving BPDUs from Cat-B.
20 seconds (max age) after the failure, Cat-C ages out the BPDU that
lists Cat-B as having the DP for Hub
segment 3.
This causes Cat-C:1/2 to transition into the Listing state (15
seconds) in an effort to become the DP.
49
X Fails
Hub
Forwarding
ListeningMode
Mode

Because Cat-C:1/2 now offers the most attractive access from the Root
Bridge to this link, it eventually transitions to Learning State (15
seconds), then all the way into Forwarding mode.

In practice this will take 50 seconds (20 max age + 15 Listening + 15
Learning) for Cat-C:1/2 to take over after the failure of Cat-B:1/2.
Hub
50
Rapid Spanning-Tree Protocol (RSTP)

The IEEE 802.1w LAN standard and protocol introduce
the following:
1. Clarification of new port states and roles
2. Definition of a set of link types that can go to
forwarding state rapidly
3. Allowing switches, in a converged network, to
generate their own BPDUs rather than relaying
root bridge BPDUs
4. Point-to-point links and edge-type links can go to
the forwarding state immediately.
5. Network convergence does not need to be any
longer than 15 seconds with these changes.
51
Port states
Operational
STP
RSTP
Enabled
Blocking
Discarding
Enabled
Listening
Discarding
Enabled
Learning
Learning
Enabled
Forwarding
Forwarding
Disabled
Disabled
Discarding
52
Alternate and Backup Ports

These two port roles correspond to the blocking state
of 802.1d (discarding MACs).

A blocked port is defined as not being the designated or root
port.

A blocked port receives a more useful BPDU than the one it
would send out on its segment.

An alternate port is a port blocked by receiving more
useful BPDUs from another bridge.

A backup port is a port blocked by receiving more
useful BPDUs from the same bridge it is on.
53
Alternate and Backup Ports
54
RSTP port roles

Root and designated ports as before.
Alternate port
takes over if
Des port fails.
55
Rapid Spanning-Tree Protocol (RSTP)

Edge Ports:


An edge port is a switch port that is never intended to
be connected to another switch device.
It immediately transitions to the forwarding state when
enabled.
• Non-Edge Ports:
• A non-edge port is a switch port that is always intended to
be connected to another switch device.
56
Non-Edge Ports
Edge Ports
57
Link types



A link operating in full duplex between two
switches is regarded as a point-to-point link.
A link operating in half duplex is regarded as
a shared link.
Ports on a point-to-point link are able to move
to forwarding state quickly (reducing the Max-Age time to
3 times Hello interval, removing the STP listening state, and exchanging a
handshake between two switches to quickly transition the port to forwarding
state
).
58
RSTP Proposal and Agreement
Process

In IEEE 802.1D STP:


A designated port must wait two times the forward
delay before transitioning the port to the forwarding
state.
RSTP:



Significantly speeds up the recalculation process after
a topology change.
It converges on a link-by-link basis and does not rely
on timers expiring before ports can transition.
Only on edge ports and point-to-point links.
59
RSTP Proposal and Agreement
Process
RSTP Proposal and Agreement
Process
61
RSTP Proposal and Agreement
Process
62
RSTP Proposal and Agreement
Process
63
RSTP Proposal and Agreement
Process
64
RSTP Proposal and Agreement
Process
65
RSTP Proposal and Agreement
Process
66
RSTP Proposal and Agreement
Process
67
RSTP Proposal and Agreement
Process
68
RSTP Proposal and Agreement
Process
69
RSTP Proposal and Agreement
Process
70
RSTP Proposal and Agreement
Process
71
RSTP Proposal and Agreement
Process
72
RSTP Proposal and Agreement
Process
73
Rapid Spanning Tree Protocol







Much faster to converge.
Same BPDU structure, puts 2 in version field.
Sends BPDUs every 2 seconds.
Different port roles and states.
Does not use timers in the same way.
Edge ports can immediately change to a forwarding
state without waiting for the network to converge.
3 missed BPDUs taken to mean loss of the link. (6
seconds)
74