Cis82 6 VLANs v6
Cis82 6 VLANs v6
Chapter 6 VLANs
Spring 2018
Chapter 6: Objectives
Explain the purpose of VLANs in a switched network.
Analyze how a switch forwards frames based on VLAN
configuration in a multi-switched environment.
Configure a switch port to be assigned to a VLAN based on
requirements.
Configure a trunk port on a LAN switch.
Configure Dynamic Trunk Protocol (DTP).
Troubleshoot VLAN and trunk configurations in a switched network.
Configure security features to mitigate attacks in a VLAN-
segmented environment.
Explain security best practices for a VLAN-segmented environment.
VLAN Segmentation
It’s all about the IP Address
Emmalia, you are in my Rick
neighborhood so I can Santa Cruz, Ca
take the letter to you!
Emmalia
Lucia, I see by your Santa Cruz, Ca
address that you are
somewhere else. So I
have to take your letter Rick
to the Post Office. Santa Cruz, Ca
Lucia
Emmalia
Capitola, Ca
Santa Cruz, Ca
Even if two houses are on the same street, you only know the
4
address so must take it to the local post office
Understanding IP communications
192.168.10.0/24 A MAC MAC B 192.168.10.0/24
Subnet aa.aa bb.bb Subnet
192.168.10.10 192.168.10.11
255.255.255.0 255.255.255.0
Devices can only communicate with other devices on the same subnet
A knows that it is on the 192.168.10.0/24 subnet (AND operation with its
IP address and subnet mask). (Same subnet = Same subnet mask)
A knows that B (192.168.1.11) is on its same subnet (AND operation
with B’s IP address and A’s subnet mask)
A 192.168.10.10 SAME Subnet B 192.168.10.11
AND 255.255.255.0 A can reach B AND 255.255.255.0
-------------------- directly without --------------------
192.168.10.0 going through a 192.168.10.0
router
Understanding IP communications
192.168.10.0/24 A MAC MAC C 192.168.20.0/24
Subnet aa.aa cc.cc Subnet
192.168.10.10 192.168.20.12
255.255.255.0 255.255.255.0
Devices can only communicate with other devices on the same subnet
A knows that it is on the 192.168.10.0/24 subnet (AND operation with its
IP address and subnet mask) (Same subnet = Same subnet mask)
A knows that C (192.168.20.12) is on a different subnet (AND operation
with B’s IP address and A’s subnet mask) – Can’t get there directly!
192.168.10.10 192.168.10.11
255.255.255.0 255.255.255.0
A C
192.168.10.10 192.168.20.12
255.255.255.0 255.255.255.0
A C
ARP Request
Broadcast
A B C D
You can do this but devices can only communicate with each other that
are on the same IP subnet…. Unless you have a …..
ROUTER (coming)
Who can A Ping? B ping? C ping? D ping?
A single VLAN (“no VLANs”) means no segmentation
ARP Request
Wasted
Broadcast
bandwidth
MAC A MAC B MAC C MAC D
aa.aa bb.bb cc.cc dd.dd
192.168.10.10 192.168.10.11 192.168.20.12 192.168.20.13
255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0
ARP Request
Broadcast
A B C D
Configured
for VLAN 20
A B C D
A B C D
MAC 192.168.10.1
11.11 255.255.255.0
MAC 192.168.10.1
11.11 255.255.255.0
MAC 192.168.10.1
11.11 255.255.255.0
MAC 192.168.10.1
11.11 255.255.255.0
MAC 192.168.10.1
11.11 255.255.255.0
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0
Switch#
Normal Range VLANs
Switch# show vlan
Note:
VLAN Trunking Protocol (VTP) can manage normal range VLANs.
Extended Range
VLANs
VLAN = Subnet
Business VLANs
IT VLAN
HR VLAN
Sales VLAN
College
Student VLAN
Faculty VLAN
Guest VLAN
37
Default VLAN
VLAN 1
Default VLAN
Native VLAN
Un-tagged (If trunking there is no
802.1Q or ISL encapsulation)
CDP, VTP, PAgP, LACP, DTP,
BPDUs
By default all traffic is carried across VLAN 1.
By default all ports are on VLAN 1
VLAN 1 is:
The default VLAN (all user traffic)
Native VLAN: No trunking encapsulation even if configured as a trunk
coming).
All Layer 2 control traffic (e.g., DTP, VTP, STP BPDUs, PAgP, LACP,
38
CDP, etc.), are associated with VLAN 1
Default VLAN 1
S1(config)# vlan 20
S1(config-vlan)# name SALES
S1(config-vlan)# exit
S1(config)# interface range fastethernet 0/13 - 22
S1(config-if-range)# switchport mode access
S1(config-if-range)# switchport access vlan 20
S1(config-if-range)# exit
S1(config)# interface gigabitethernet 0/2
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 20
S1(config-if)# end
S1#
Configuring a
Range of Ports
<output omitted>
<output omitted>
S1#
Verifying VLANs
S1(config)# vlan 444
S1(config-vlan)# end
S1# show vlan
SSH to
192.168.10.254
55
Power over Ethernet
56
switchport voice vlan vvid
Voice: 802.1Q trunk
Tagged as vvid CoS in 802.1p bits
Data:
Untagged: Native VLAN
Recommended Option
Switch(config)# interface type mod/num
Switch(config-if)# switchport voice vlan vlan-id
Instructs the Cisco IP phone to forward all voice traffic through the specified VLAN.
By default, the Cisco IP phone forwards the voice traffic with an 802.1Q priority of 5.
Creates a special 802.1Q trunk (so called trunk later)
Negotiated by DTP and CDP (provisioning of the vvid)
CoS (Class of Service) in 802.1p bits (later)
vvid puts:
Voice packets on voice VLAN
Voice VLAN is configured.
Data packets in Native VLAN
VLAN 1 by default unless modified on the switch
Can configure the data VLAN to be a a VLAN other than Native or Voice. (coming)
57
Configuring Voice VLAN Operation
Voice: 802.1Q trunk
Tagged as voice VLAN 100 CoS in 802.1p bits
Data:
Untagged: Native VLAN
Tagged as VLAN 20
Recommended Option
Switch(config)# interface FastEthernet0/24
Switch(config-if)# switchport voice vlan 100
Switch(config-if)# switchport access vlan 20
interface FastEthernet0/24
switchport voice vlan 100
switchport access vlan 20
spanning-tree portfast
More to come!
58
VLAN Trunks
Default VLAN
VLAN 1 Control traffic (STP, DTP, VTP, CDP, …)
User VLAN
VLAN 10 HR – 192.168.10.0/24
User VLAN
VLAN 20 Sales– 192.168.20.0/24
Voice VLAN
VLAN 100 VoIP– 192.168.100.0/24
Management VLAN
VLAN 155 Guests – 192.168.150.0/24
Garbage/Guest VLAN
VLAN 199 Garbage – 192.168.199.0/24
Native VLAN
VLAN 200 Untagged traffic
The TAG is added by the switch before it goes over a trunk link.
The TAG is removed by the switch at the other end of the trunk link.
60
Priority
Tag protocol ID VLAN ID (VID)
Used Canonical Format Identifier (CFI)
for QoS (802.1p
(TPID) VLAN identification number
Enables
standard) Token Ring
specifies frames to be
how to
that supports up to 4096
carried
expedite across Ethernet
transmission of links
Ethernet is 0x8100. VLAN IDs
Layer 2 frames
61
Native VLAN
Native VLAN
For devices that do not support tagging.
All trunks must have a native VLAN
Native VLAN must be the same on both ends (both switches).
Can be modified to be a VLAN other than VLAN 1.
Should not be used for user VLAN or Management VLAN.
Control traffic (CDP, VTP, PAgP, DTP) still transmitted over VLAN 1.
If Native VLAN is other than VLAN 1 then control traffic on VLAN 1
is sent tagged.
It is fine to leave VLAN 1 as the Native VLAN but should only carry
control traffic and not user or management traffic. 62
Inter-switching links: Default and Trunking
VLAN 1 VLAN 1
VLAN VLAN
Trunk Trunk
63
Configuring VLAN Trunks
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S1# show vlan brief
Minimum configuration.
65
Configuring VLAN Trunks
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S1# show vlan
No trunking information.
Fa 0/1 no longer included in VLAN 10
66
Configuring VLAN Trunks
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S1# show interfaces trunk
67
Configuring VLAN Trunks
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S2#show interfaces trunk
68
Configuring the Native VLAN
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S1(config)# inter fa 0/1
S1(config-if)# switchport trunk native vlan 200
*Mar 1 01:59:34.927: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered
on FastEthernet0/1 (200), with S2 FastEthernet0/1 (1)
S1(config-if)#
71
Configuring Allowed VLANs
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
S1# show interfaces trunk
72
What’s in the running-config?
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
interface FastEthernet0/1
Trunk link
switchport trunk native vlan 200
switchport trunk allowed vlan 10,20,200
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 10 VLAN 10 access port
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 10
switchport mode access
<continued>
73
What’s in the running-config?
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
!
interface FastEthernet0/11
!
No configuring…. Default VLAN 1
(Should be in garbage, temporary VLAN if
interface FastEthernet0/12
port is not in use)
!
interface FastEthernet0/13
VLAN 20 access port
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/14
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/15
switchport access vlan 20
switchport mode access 74
What’s in the running-config?
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
!
interface Vlan1 SVI (Switched Virtual Interface)
no ip address Management VLAN
shutdown No current IP Address
! Still in VLAN 1
75
Configuring Management VLAN
VLAN 155 VLAN 155
192.168.155.1/24 192.168.155.2/24 VLANs
VLANs Fa0/1
10, 20 Fa0/1 10, 20
S1 S2
S1(config)# interface vlan 155
S1(config-if)# ip address 192.168.155.1 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)# exit
S1(config)# vlan 155
S1(config-vlan)# name MANAGEMENT
S1(config-vlan)#
S2(config)# interface vlan 155
S2(config-if)# ip add 192.168.155.2 255.255.255.0
S2(config-if)# no shutdown
S2(config-if)# exit
S2(config)# vlan 155
S2(config-vlan)# name MANAGMENT
S2(config-vlan)# end
S2# ping 192.168.155.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.158.155.2, timeout is 2 seconds:
..... ??? 76
Configuring Management VLAN
VLAN 155 VLAN 155
192.168.155.1/24 192.168.155.2/24 VLANs
VLANs Fa0/1
10, 20 Fa0/1 10, 20
S1 S2
S1(config)# inter fa 0/1
S1(config-if)# switchport trunk allowed vlan 10,20,200,155
77
Verifying VLANs Once More
VLAN 155 VLAN 155
192.168.155.1/24 192.168.155.2/24 VLANs
VLANs Fa0/1
10, 20 Fa0/1 10, 20
S1 S2
S1# show vlan
78
Verifying VLANs Once More
VLAN 155 VLAN 155
192.168.155.1/24 192.168.155.2/24 VLANs
VLANs Fa0/1
10, 20 Fa0/1 10, 20
S1 S2
S1# show interfaces trunk
<output omitted> 79
Verifying VLANs Once More
VLAN 155 VLAN 155
192.168.155.1/24 192.168.155.2/24 VLANs
VLANs Fa0/1
10, 20 Fa0/1 10, 20
S1 S2
S1# show interface fa0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 200 (Inactive)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
<output omitted>
Trunking VLANs Enabled: 10,20,155,200
80
Dynamic Trunk Protocol
Switch Ethernet Port Type
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
VLANs VLANs
Fa0/1 Fa0/1 10, 20
10, 20
S1 S2
Dynamic auto Dynamic auto
Ports on the 2960 and 3560 are set to dynamic auto by default.
Does not trunk if both sides default to dynamic auto
This results in the interface being in access mode (non-trunking)
86
S1(config-if)# switchport mode ?
Dynamic
Trunking
Protocol
(DTP)
Access - Puts the interface into permanent non-trunking mode and negotiates to convert the link into a
non-trunk link. The interface becomes a non-trunk interface even if the neighboring interface does not
agree to the change.
Trunk - Puts the interface into permanent trunking mode and negotiates to convert the link into a trunk
link. The interface becomes a trunk interface even if the neighboring interface does not agree to the change.
Nonegotiate - Puts the interface into permanent trunking mode but prevents the interface from
generating DTP frames. You must configure the neighboring interface manually as a trunk interface to
establish a trunk link. Use this mode when connecting to a device that does not support DTP.
Dynamic desirable - Makes the interface actively attempt to convert the link to a trunk link. The
interface becomes a trunk interface if the neighboring interface is set to trunk, desirable, or auto mode.
Dynamic auto - Makes the interface willing to convert the link to a trunk link. The interface becomes a
trunk interface if the neighboring interface is set to trunk or desirable mode. This is the default mode for
all Ethernet interfaces in Cisco IOS.
Trunk Modes Must be Compatible
DTP Mode: On (default)
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
S1
F0/1 F0/1
<output omitted>
TO CLEAR A SWITCH
ALWAYS DO THE FOLLOWING TO CLEAR A SWITCH!!
Legacy Inter-VLAN
Routing
Router-on-Stick
Switch SVI
Switch Routed Ports
Legacy Inter-VLAN Routing
Legacy Inter-VLAN Routing
A B C D
VLAN 30
PC 4
172.17.30.55
133
R1# show vlans
<output omitted>
Virtual LAN ID: 10 (IEEE 802.1Q Encapsulation)
<output omitted>
135
Problem #1
VLAN 10
138
Problem #2
Trunk
139
Problem #3
Trunk
VLAN 10
142
Problem #5
172.17.10.21/24
143
Problem #6
172.17.10.21/24
144
Multi-layer Switches and Inter-
VLAN Routing
– EXTRA (CIS 83)
Routers vs Multilayer Switches
Multilayer switches can perform Layer 2 and Layer 3 functions, replacing the need for
dedicated routers.
Multilayer switches support dynamic routing and inter-VLAN routing.
A switch virtual interface (SVI) exists for VLAN 1 by default.
On a multilayer switch, a logical (layer 3) interface can be configured for any VLAN.
With a multilayer switch, traffic is routed internal to the switch device.
This routing process is a suitable and scalable solution.
149
Configure Router On A Stick: 802.1Q Trunk Link
interface GigabitEthernet 0/0
no shutdown ! Does not show in config
!
interface GigabitEthernet 0/0.2
description VLAN 2
encapsulation dot1Q 2 native
ip address 172.16.1.2 255.255.255.0
!
interface GigabitEthernet 0/0.10
172.16.10.100/ 172.16.20.100/
24 24 description VLAN 10
encapsulation dot1Q 10
ip address 172.16.10.1 255.255.255.0
!
interface GigabitEthernet 1/1 interface GigabitEthernet 0/0.20
switchport mode trunk description VLAN 20
encapsulation dot1Q 20
ip address 172.16.20.1 255.255.255.0
Router on a stick is very !
interface GigabitEthernet 0/0.30
simple to implement. description VLAN 30
encapsulation dot1Q 30
ip address 172.16.30.1 255.255.255.0
!
interface GigabitEthernet 0/0.40
description VLAN 40
encapsulation dot1Q 40
ip address 172.16.40.1 255.255.255.0 150
Routed Ports versus Switched Virtual Interfaces
Routed Ports – Just like a router, the port has an IP address/mask that makes it
a member of that subnet.
SVI – The switch is a member of that IP subnet/VLAN. All switch ports that are a
151
member of that VLAN can communicate with the switch
Multilayer Switch Interfaces
Layer 2: Access or Trunk Ports
Physical Interface
Logical Interface (SVI)
A B C D
A B C D
A B C D
A B C D
Alternative Configuration
156
SVI VLAN 10 SVI VLAN 20
192.168.10.1 192.168.20.1
255.255.255.0 255.255.255.0
Distribution
Layer Switch
Trunk
Access
Layer Switch
A B C D
165
Default Gateway (SVI)
172.16.10.10
255.255.255.0 Statically or Dynamically assigned
172.16.10.1
166
Layer 3 Port Configuration
– Physical Interfaces
10.10.10.100/24
DF 10.10.10.1
168
interface vlan 10 interface vlan 20
172.16.10.1/24 172.16.20.1/24
Trunk =
169
Management VLAN (SVI)
For each device in the network
we configured it to be a member
of the management VLAN.
On each switch
If you want to reach the management VLAN from other VLANs, assign
this address to one of the multilayer switches (DLS1 and DLS2):
DLS1(config)# ip default-gateway 172.16.98.1 170
Management VLAN (SVI)
For each device in the network
we configured it to be a member
of the management VLAN.
On each switch
If you want to reach the management VLAN from other VLANs, assign
this address to one of the multilayer switches (DLS1 and DLS2):
DLS1(config)# ip default-gateway 172.16.99.1 171
interface vlan 98
172.16.98.1/24
On each switch
172
interface vlan 98 interface vlan 99
172.16.98.1/24 172.16.99.1/24
Switched Network Design
Core –
Route/Switch
packets quickly
across between
distribution
multilayer
switches.
Distribution –
Route between
VLANs/Subnets,
ACLs
Access –
Provide access
to end devices
and provide port L3 = Routed Ports, over IP, separate subnets
security.
L2 = SVI, VLANs over Trunks OR individual VLANs
174
Verifying
Verify IP addresses
VLAN 1
External Router VLAN 2
VLANs VLAN 3
VLANs 1, 2, 3
Router on a stick
Trunk
VLANs or No VLANs
VLAN 1
VLAN 2
Multilayer Switch VLAN 3
Trunk
Multilayer Switch
176
SDM
Cisco Switch Database Manager (SDM)
192.168.2.2/24 192.168.1.2/24
VLAN 2 VLAN 1