chapter 4
chapter 4
Switch Configuration
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 1
VLAN
VLAN (virtual LAN) is a logical partition of a network
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 2
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 3
In a switched network, a device can be assigned to a VLAN
based on its, MAC address, IP address, or the applications that
the device most frequently uses.
Administrators assign membership in a VLAN either statically
or dynamically.
Static VLAN membership requires an administrator to
manually assign each switch port to a specific VLAN.
Example, port fa0/3 may be assigned to VLAN 20.
Any device that plugs into port fa0/3 automatically becomes a
member of VLAN 20.
This type of VLAN membership is the easiest to configure and
is also the most popular, however, it requires the most
administrative support for adds, moves and changes.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 4
Dynamic VLAN membership requires a VLAN management
policy server (VMPS).
The VMPS contains a database that maps MAC addresses to
VLAN assignments.
When a device plugs into a switch port, the VMPS searches the
database for a match of the MAC address and temporarily assigns
that port to the appropriate VLAN.
Dynamic VLAN membership requires more configuration but
creates a structure with much more flexibility than static VLAN
membership.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 5
Configuring VLAN
Whether VLANs are created statically or dynamically, the
maximum number of VLANs depends on the type of switch and
the IOS. By default, VLAN1 is the management VLAN.
Management VLAN
A management VLAN is any VLAN configured to access the
management capabilities of a switch.
VLAN 1 is the management VLAN by default.
To create the management VLAN, the switch virtual interface
(SVI) of that VLAN is assigned an IP address and subnet mask,
allowing the switch to be managed via HTTP, Telnet, SSH, or
SNMP
An administrator will use the IP address of the management
VLAN to configure the switch remotely.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 6
When a VLAN is created, it is assigned a number and a name.
The VLAN number is any number from the range available on
the switch, except for VLAN1.
Switch(config)#vlan vlan_number
Switch(config-vlan)#name vlan_name
Switch(config-vlan)#exit
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 7
Assign ports to be members of the VLAN.
By default, all ports are initially members of VLAN1.
Assign ports one at a time or as a range.
Assign port to VLAN one by one:
Switch(config)#interface fa#/#
Switch(config-if)#switchport access vlan vlan_number
Switch(config-if)# exit
Assign by range
Switch(config)#interface range fa#/start_of_range - end_of_range
Switch(config-if)#switchport access vlan vlan_number
Switch(config-if)#exit
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 8
Verifying vlan configuration
To verify, maintain, and troubleshoot VLANs, it is important to
understand the key show commands that are available in the Cisco
IOS.
The following commands are used to verify and maintain VLANs:
show vlan
Displays a detailed list of all of the VLAN numbers and names
currently active on the switch, along with the ports associated
with each one
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 9
show vlan id id_number
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 10
To delete a VLAN:
Switch(config)#no vlan vlan_number
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 11
Trunk port
A VLAN has three major functions:
Limits the size of broadcast domains
Improves network performance
Provides a level of security
A trunk port.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 12
Access Port
An access port belongs to only one VLAN.
Access ports also carry traffic that comes from only the VLAN
assigned to the port.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 13
Trunk Port
A trunk port is a point-to-point link between the switch and
another networking device.
Trunks carry the traffic of multiple VLANs over a single link and
allow VLANs to reach across an entire network.
Trunk ports are necessary to carry the traffic from multiple
VLANs between devices when connecting either two switches
together, a switch to a router.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 14
Without trunk ports, each VLAN requires a separate connection
between switches.
For example, an enterprise with 100 VLANs requires 100 connecting
links.
This type of arrangement does not scale well and is very expensive.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 15
Trunk links provide a solution to this problem by transporting
traffic from multiple VLANs on the same link.
When multiple VLANs travel on the same link, they need VLAN
identification.
A trunk port supports frame tagging. Frame tagging adds VLAN
information to the frame.
Cisco developed a proprietary frame tagging protocol called Inter-
Switch Link (ISL).
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 16
Switch ports are access ports by default.
To configure a switch port as a trunk port, use the following
commands:
Switch(config)#interface fa #/#
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk encapsulation dot1q
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 17
Switches have the capability to detect the type of link configured
at the other end.
Based on the attached device, the link configures itself as either
a trunk port or an access port.
Switch(config-if)#switchport mode dynamic {desirable | auto}
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 18
To return a trunk port to an access port, issue either of the
following commands:
Switch(config)#interface fa#/#
Switch(config-if)#no switchport mode trunk or
Switch(config-if)#switchport mode access
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 19
Native VLAN
To accommodate untagged traffic, a special VLAN called a native
VLAN is available.
Untagged frames received on the 802.1Q trunk port will become
members of the native VLAN.
On Cisco Catalyst switches, VLAN 1 is the native VLAN by default.
VLAN is identified by a “tag” in the frame.
Native VLAN does not have a tag.
On an 802.1Q trunk, use the following command to assign the native
VLAN ID on a physical interface:
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 20
Switch Security
Secure Remote Access (SSH)
Telnet uses unsecure plaintext of the username and password as
well as the data transmitted.
SSH is more secure because it provides an encrypted
management connection
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 21
Switch security
Secure Unused Ports
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 22
Switch security
Port Security
Port security limits the number of valid MAC addresses
allowed to transmit data through a switch port.
If a port has port security enabled and an unknown MAC
address sends data, the switch presents a security violation.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 24
Switch Port Security
Port Security: Violation Modes
Protect – data from unknown source MAC addresses are
dropped; a security notification IS NOT presented by the
switch
Restrict - data from unknown source MAC addresses are
dropped; a security notification IS presented by the switch and
the violation counter increments.
Shutdown – (default mode) interface becomes error-disabled
and port LED turns off. The violation counter increments.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 25
Switch Security
Port Security: Configuring
rr or
i o ne!
t d
i gur a m an
nf m
n co i s co
o th
om m r g et
c o
ost t o f
M i s
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 26
Port security
Switch(config-if)#switchport port-security max ?
<1-132> Maximum addresses
Switch(config-if)#switchport port-security mac-address ?
H.H.H 48 bit mac address
sticky Configure dynamic secure addresses as sticky
Switch(config-if)#switchport port-security violation ?
protect Security violation protect mode
restrict Security violation restrict mode
shutdown Security violation shutdown mode
Switch(config-if)#switchport port-security maximum 10
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 27
Port Security: Configuring (Cont.)
or
n er r
i o !
u rat and
fi g m
c on com
m on t t h si
m e
t co f o r g
s o
Mo is t
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 28
Port Security: Verifying
Use the show port-security interface command to verify the
maximum number of MAC addresses allowed on a particular
port and how many of those addresses were learned
dynamically using sticky.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 29
Port Security: Verifying (Cont.)
Use the show running-config command to see learned MAC
addresses added to the configuration
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 30
Ports in Error Disabled State
Switch console messages display when a port security
violation occurs. Notice the port link status changes to down.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 31
Ports in Error Disabled State (Cont.)
Check the port status and the port security settings.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 32
VLAN Trunking protocol (VTP)
As networks grow in size and complexity, centralized
management of the VLAN structure becomes crucial.
VLAN Trunking Protocol (VTP) is a Layer 2 messaging protocol
that provides a method for the distribution and management of
the VLAN database from a centralized server in a network
segment.
Any change to the VLAN structure requires further manual
configuration. One incorrectly keyed number causes
inconsistencies in connectivity throughout the entire network.
To resolve this issue, Cisco created VTP to automate many of
the VLAN configuration functions.
VTP ensures that VLAN configuration is consistently
maintained across the network and reduces the task of VLAN
management and monitoring.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 33
VTP is a client/server messaging protocol that adds, deletes, and
renames VLANs in a single VTP domain.
All switches under a common administration are part of a domain.
Each domain has a unique name. VTP switches only share VTP
messages with other switches in the same domain.
Two different versions of VTP exist: Version 1 and Version 2.
All switches must be configured with the same version.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 34
Server mode—In VTP server mode, you can create, modify, and
delete VLANs and specify other configuration parameters, such as
VTP version and VTP running, for the entire VTP domain.
Client mode —VTP clients behave the same way as VTP servers,
but you cannot create, change, or delete VLANs on a VTP client.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 35
VTP
With VTP, each switch advertises messages on its trunk ports.
Messages include the management domain, configuration
revision number, known VLANs, and parameters for each
VLAN.
These advertisement frames are sent to a multicast address so that
all neighbor devices receive the frames.
Each VTP switch saves a VLAN database in NVRAM that
contains a revision number.
If a VTP receives an update message that has a higher revision
number than the one stored in the database, the switch updates its
VLAN database with this new information.
To protect some one to insert incorrect VLAN update, is to
configure a VTP password to validate the switch.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 36
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 37
VTP messages come in three varieties:
Summary advertisements
Subset advertisements
Advertisement requests.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 38
Summary Advertisements
Switches issue summary advertisements every 5 minutes or
whenever a change to the VLAN database occurs.
Summary advertisements contain the current VTP domain name
and the configuration revision number.
If VLANs are added, deleted, or changed, the server increments the
configuration revision number and issues a summary
advertisement.
When a switch receives a summary advertisement packet, it
compares the VTP domain name to its own VTP domain name.
If the domain name is the same, the switch compares the
configuration revision number to its own number. If it is lower or
equal, the switch ignores the packet.
If the revision number is higher, an advertisement request is sent.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 39
Subset Advertisements
A subset advertisement follows the summary advertisement.
A subset advertisement contains a list of VLAN information.
The subset advertisement contains the new VLAN information
based on the summary advertisement.
If there are several VLANs, they require more than one subset
advertisement.
Advertisement Requests
Switches use advertisement requests to ask for VLAN information.
Advertisement requests are required if the switch has been reset or
the VTP domain name has been changed.
The switch receives a VTP summary advertisement with a higher
configuration revision number than its own.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 40
Configuring VTP
If a switch in server mode issues an update with a higher revision
number than the number currently in place, all switches will modify
their databases to match the new switch.
When adding a new switch to an existing VTP domain, use the
following steps:
Step 1: Configure VTP off-line (version 1)
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 41
Step 2: Verify the VTP configuration
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 42
Spanning Tree Protocol (STP)
Spanning Tree Protocol (STP) provides a mechanism for disabling
redundant links in a switched network.
STP provides the redundancy required for reliability without
creating switching loops.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 43
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 44
Switches are constantly checking the network to ensure that there
are no loops and that all ports function as required.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 45
In STP terminology, the term bridge is frequently used to refer to a
switch.
For example, the Root Bridge is the primary switch or focal point
in the STP topology.
The root bridge communicates with the other switches using
Bridge Protocol Data Units (BPDUs).
BPDUs are frames that multicast every 2 seconds to all other
switches.
BPDUs contain information such as:
Identity of the source switch
Identity of the source port
Cumulative cost of path to root bridge
Value of aging timers
Value of the hello timer
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 46
As a switch powers on, each port cycles through a series of four
states:
Blocking,
Listening,
Learning, and
Forwarding.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 47
When a switch powers on, it first goes into a blocking state to
immediately prevent the formation of a loop.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 49
Root Bridge
The root bridge is based on the lowest BID value. Since switches
typically use the same default priority value, the switch with the
lowest MAC address becomes the root bridge.
As each switch powers on, it assumes that it is the root bridge,
and sends out BPDUs containing its BID.
For example, if S2 advertises a root ID that is a lower number
than S1, S1 stops the advertisement of its root ID and accepts the
root ID of S2. S2 is now the root bridge.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 50
Root Port
The port that provides the least cost path back to the root bridge
becomes the root port. Switches calculate the least cost path using
the bandwidth cost of each link required to reach the root bridge.
Designated Port
A designated port is a port that forwards traffic toward the root
bridge but does not connect to the least cost path.
Blocked Port
A blocked port is a port that does not forward traffic.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 51
Before configuring STP, the network technician plans and
evaluates the network in order to select the best switch to
become the root of the spanning tree.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 52
The range for the priority is from 0 to 65535, the default value is
32768.
To set priority:
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 53
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 54
Spanning tree in Hierarchical Network
After establishing the root bridge, root ports, designated
ports, and blocked ports, STP sends BPDUs throughout the
switched network at 2-second intervals.
STP continues to listen to these BPDUs to ensure that no links
fail and no new loops appear.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 55
When a link goes down, STP detects the failure and
recalculates the best paths across the network.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 56
There are several useful commands used to verify spanning tree
operation.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 57
Inter-VLAN Routing
Although VLANs extend to span multiple switches, only
members of the same VLAN can communicate.
A Layer 3 device provides connectivity between different
VLANs.
This arrangement enables the network administrator to strictly
control the type of traffic that flows from one VLAN to another.
One method of accomplishing the inter-VLAN routing requires
a separate interface connection to the Layer 3 device for each
VLAN.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 58
Another method for providing connectivity between different
VLANs requires a feature called subinterfaces.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 59
Switch
Configure the switch interface as an 802.1Q trunk link.
Router
Select a router interface with a minimum of a 100Mbps
FastEthernet
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 60
The host from the sending VLAN forwards traffic to the router
using the default gateway.
The subinterface for the VLAN specifies the default gateway for
all hosts in that VLAN.
The router locates the destination IP address and does a routing
table lookup.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 61
If the destination VLAN is on the same switch as the source
VLAN, the router forwards the traffic back down to the source
switch using the subinterface parameters of the destination
VLAN ID. This type of configuration is often referred to as a
router-on-a-stick.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 62
To configure inter-VLAN routing, use the following steps:
1. Configure a trunk port on the switch.
Switch(config)#interface fa0/2
Switch(config-if)#switchport mode trunk
2. On the router, configure a FastEthernet interface with no IP
address or subnet mask.
Router(config)#interface fa0/1
Router(config-if)#no ip address
Router(config-if)#no shutdown
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 63
3. On the router, configure one subinterface with an IP address and
subnet mask for each VLAN. Each subinterface has an 802.1Q
encapsulation.
Router(config)#interface fa0/0.10
Router(config-subif)#encapsulation dot1q 10
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
4. Use the following commands to verify the inter-VLAN routing
configuration and functionality.
Switch#show trunk
Router#show ip interfaces
Router#show ip interfaces brief
Router#show ip route
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 64
END
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 65