Documente Academic
Documente Profesional
Documente Cultură
31 Aaron Balchunas
VLAN Example
Consider the following example:
Advantages of VLANs
VLANs provide the several benefits:
Broadcast Control eliminates unnecessary broadcast traffic,
improving network performance and scalability.
Security logically separates users and departments, allowing
administrators to implement access-lists to control traffic between
VLANs.
Flexibility removes the physical boundaries of a network, allowing
a user or device to exist anywhere.
VLANs are very common in LAN and campus networks. For example, user
networks are often separated from server networks using VLANs.
VLANs can span across WANs as well, though there are only limited
scenarios where this is necessary or recommended.
VLAN Membership
VLAN membership can be configured one of two ways:
Statically
Dynamically
Statically assigning a VLAN involves manually assigning an individual or
group of ports to a VLAN. Any host connected to that port (or ports)
immediately becomes a member of that VLAN. This is transparent to the
host - it is unaware that it belongs to a VLAN.
VLANs can be assigned dynamically based on the MAC address of the
host. This allows a host to remain in the same VLAN, regardless of which
switch port it is connected to.
Dynamic VLAN assignment requires a separate database to maintain the
MAC-address-to-VLAN relationship. Cisco developed the VLAN
Membership Policy Server (VMPS) to provide this functionality.
In more sophisticated systems, a users network account can be used to
determine VLAN membership, instead of a hosts MAC address.
Static VLAN assignment is far more common than dynamic, and will be the
focus of this guide.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Creating VLANs
By default, all interfaces belong to VLAN 1. To assign an interface to a
different VLAN, that VLAN must first be created:
Switch(config)# vlan 100
Switch(config-vlan)# name SERVERS
The first command creates VLAN 100, and enters VLAN configuration
mode. The second command assigns the name SERVERS to this VLAN.
Note that naming a VLAN is not required.
The standard range of VLAN numbers is 1 1005, with VLANs 1002-1005
reserved for legacy Token Ring and FDDI purposes.
A switch operating in VTP transparent mode can additionally use the
VLAN range of 1006 4094. These are known as extended-range VLANs.
VTP is covered in great detail later in this guide.
To remove an individual VLAN:
Switch(config)# no vlan 100
Name
-------------------------default
SERVERS
fddi-default
token-ring-default
fddinet-default
trnet-default
Status
Ports
--------- ----------active
gi1/1-24
active
suspended
suspended
suspended
suspended
Note that no interfaces have been assigned to the newly created VLAN 100
yet.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Name
-------------------------default
SERVERS
fddi-default
token-ring-default
fddinet-default
trnet-default
Status
--------active
active
suspended
suspended
suspended
suspended
Ports
----------gi1/1-9,11-24
gi1/10
For switches running in VTP server or client mode, the list of VLANs are
stored in a database file named vlan.dat. The vlan.dat file is usually stored
in flash, though on some switch models it is stored in NVRAM. The VLAN
database will be maintained even if the switch is rebooted.
For switches running in VTP transparent mode, the list of VLANs is stored
in the startup-config file in NVRAM. VTP is covered extensively later in
this guide.
Regardless of VTP mode, the VLAN assignment for every switch interface
is stored in the switchs startup-config.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
VLAN Frame-Tagging
When VLANs span multiple switches, a mechanism is required to identify
which VLAN a frame belongs to. This is accomplished through frame
tagging, which places a VLAN ID in each frame.
Tagging only occurs when a frame is sent out a trunk port. Traffic sent out
access ports is never tagged. Consider the following example:
SwitchA
SwitchB
HostA
VLAN 100
HostB
VLAN 100
gi
1/
12
gi1
HostC
VLAN 200
HostD
VLAN 100
/20
/ 21
/10
gi1
gi1
gi 1
/ 11
HostE
VLAN 100
gi
1/
22
HostF
VLAN 200
IEEE 802.1Q
IEEE 802.1Q, otherwise referred to as dot1Q, is an industry-standard
frame-tagging protocol.
802.1Q is supported by nearly all switch manufacturers, including Cisco.
Because 802.1Q is an open standard, switches from different vendors can be
trunked together.
Recall that ISL encapsulates a frame with an additional header and trailer. In
contrast, 802.1Q embeds a 4-byte VLAN tag directly into the Layer-2 frame
header. Because the Layer-2 header is modified, 802.1Q must recalculate the
frames CRC value.
The VLAN tag includes a 12-bit VLAN ID. This tag increases the size of an
Ethernet frame, from its default of 1514 bytes to 1518 bytes. Nearly all
modern switches support the 802.1Q tag and the slight increase in frame
size.
802.1Q supports a maximum of 4096 VLANs on a trunk port.
For a switch that supports both ISL and 802.1Q, the tagging or
encapsulation protocol must be configured first:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport mode trunk
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport mode trunk
Important note: Both sides of the trunk must be configured with the same
tagging protocol. Otherwise, a trunk connection will not form.
If the switch only supports 802.1Q, the switchport trunk encapsulation
command will not be available.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
The tagging protocol that is supported by both switches will be used. If the
switches support both ISL and 802.1Q, ISL will be the preferred protocol.
By default, all active VLANs are allowed to traverse a trunk link. While this
is convenient, a good security practice is to allow only necessary VLANs
over a trunk.
To explicitly allow a subset of VLANs on a trunk port:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk allowed vlan 3,9,11-15
The above command will force the trunk link to only forward traffic from
VLANS 3, 9, and 11 15. To remove a VLAN from the allowed list:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk allowed vlan remove 12
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Native VLANs
Recall that a trunk port tags frames with a VLAN ID. But what happens if a
trunk port receives an untagged frame?
The native VLAN determines the VLAN that untagged traffic belongs to.
By default on all trunking ports, the native VLAN is VLAN 1. The native
VLAN can be changed on a per trunk port basis:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk native vlan 42
Only one native VLAN can be assigned to a trunk port. All untagged traffic
received on this port will become a member of the native VLAN.
Additionally, frames belonging to the native VLAN are not tagged when
being sent out a trunk port.
Native VLANS are only supported on 802.1Q trunk ports. ISL does not
support untagged frames, and will always tag frames from all VLANs.
The native VLAN must be configured identically on both sides of the
802.1Q trunk, otherwise the switches will not form a trunk connection.
The original intent of native VLANs was for legacy compatibility with hubs.
Consider the following deprecated example:
DTP has two modes to dynamically decide whether a port becomes a trunk:
Desirable the port will actively attempt to form a trunk with the
remote switch. This is the default setting.
Auto the port will passively wait for the remote switch to initiate the
trunk.
To configure the DTP mode on an interface:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
Trunk ports send out DTP frames every 30 seconds to indicate their
configured mode.
A trunk will form in the following configurations:
manual trunk manual trunk
manual trunk dynamic desirable
manual trunk dynamic auto
dynamic desirable dynamic desirable
dynamic desirable dynamic auto
A trunk will never form if the two sides of the trunk are set to dynamic auto,
as both ports are waiting for the other to initialize the trunk.
It is best practice to manually configure trunk ports, to avoid DTP
negotiation errors. DTP is also vulnerable to VLAN spoofing attacks.
To explicitly disable DTP:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport nonegotiate
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Mode
on
Encapsulation
802.1q
Status
trunking
Native VLAN
42
Port
Fa0/24
Port
Fa0/24
Port
Fa0/24
Note that VLANs 11-15 are not active. Most likely, no interfaces have been
assigned to those VLANs.
If there are no interfaces in an active trunking state, the show interface trunk
command will return no output.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
VTP Versions
There are three versions of VTP. VTP version 1 supports the standard 1
1005 VLAN range. VTP version 1 is also default on Catalyst switches.
VTP version 2 introduces some additional features:
Token Ring support
VLAN consistency checks
Domain-independent transparent pass through
VTPv1 and v2 are not compatible. The VTP version is dictated by the VTP
server, discussed in detail shortly. If the VTP server is configured for
VTPv2, all other switches in the VTP domain will change to v2 as well.
Until recently, VTP Version 3 was supported on only limited Cisco switch
platforms. VTPv3 was built to be flexible, and can forward both VLAN and
other database information, such as Multiple Spanning Tree (MST) protocol.
Other enhancements provided by VTPv3 include:
Support for the extended 1006-4094 VLAN range.
Support for private VLANs.
Improved VTP authentication.
Protection from accidental database overwrites, by using VTP primary
and secondary servers.
Ability to enable VTP on a per-port basis.
(Reference: http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3560/software/release/12-2_52_se/configuration/guide/3560scg/swvtp.html)
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
VTP Modes
A switch using VTP must operate in one of three modes:
Server
Client
Transparent
VTP servers are responsible for creating, deleting, or modifying entries in
the VLAN database. Each VTP domain must have at least one VTP server,
and this is the default mode for Cisco switches.
Servers advertise the VLAN database to all other switches in the VTP
domain, including other servers. VTP servers can only advertise the standard
1-1005 VLAN range, and advertisements are only sent out trunk ports.
VTP clients cannot modify the VLAN database, and rely on advertisements
from other switches to update VLAN information. A client will also forward
VTP advertisements out every trunk port.
Remember: switches must be in the same VTP Domain to share and accept
updates to the VLAN database. Only servers can change the VLAN
database.
A VTP transparent switch maintains its own local VLAN database, and
does not directly participate in the VTP domain. A transparent switch will
never accept VLAN database information from another switch, even a
server. Also, a transparent switch will never advertise its local VLAN
database to another switch.
Transparent switches will pass through advertisements from other switches
in the VTP domain. The VTP version dictates how the pass through is
handled:
VTP version 1 the transparent switch will only pass through
advertisements from the same VTP domain.
VTP version 2 the transparent switch will pass through
advertisements from any VTP domain.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
(Reference: http://www.cisco.com/c/en/us/support/docs/lan-switching/vtp/10558-21.html#vtp_msg)
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Configuring VTP
By default, a switch is in VTP server mode, and joined to a blank domain
labeled NULL.
To change the VTP domain name:
Switch(config)# vtp domain MYDOMAIN
Note that the domain name is case sensitive. To configure the VTP mode:
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
The password is also case sensitive. All switches participating in the VTP
domain must be configured with the same password. The password is hashed
into a 16-byte MD5 digest.
Cisco switches use VTP version 1 by default, which is not compatible with
VTPv2. The VTP version is dictated by the VTP server, and if the server is
configured for VTPv2, all other switches in the VTP domain will change to
v2 as well.
Switch(config)# vtp version 2
VTP Pruning
Recall that Layer-2 switches belong to only one broadcast domain. A
Layer-2 switch will thus forward both broadcasts and multicasts out every
port in the same VLAN but the originating port. This includes sending out
broadcasts out trunk ports to other switches, which will in turn flood that
broadcast out all ports in the same VLAN.
VTP pruning eliminates unnecessary broadcast or multicast traffic
throughout the switching infrastructure. Consider the following example:
Assume that a host is connected to SwitchB, in VLAN 300. If the host sends
out a broadcast, SwitchB will forward the broadcast out every port in VLAN
300, including the trunk ports to SwitchA and SwitchC. Both SwitchA and
SwitchC will then forward that broadcast out every port in VLAN 300.
However, SwitchA does not have any ports in VLAN 300, and will drop the
broadcast. Thus, sending the broadcast to SwitchA is a waste of bandwidth.
VTP pruning allows a switch to learn which VLANs are active on its
neighbors. Thus, broadcasts are only sent out the necessary trunk ports
where those VLANs exist. In the preceding example, pruning would prevent
VLAN 300 broadcasts from being sent to SwitchA, and would prevent
VLAN 100 and 200 broadcasts from being sent to SwitchC.
VTP pruning is disabled by default on IOS switches. VTP pruning must be
enabled on a server, and will be applied globally to the entire VTP domain:
Switch(config)# vtp pruning
Both VLAN 1 and the system VLANs 1002-1005 are never eligible for
pruning. To manually specify which VLANs are pruning eligible on a trunk:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk pruning vlan 2-10
Switch(config-if)# switchport trunk pruning vlan add 42
Switch(config-if)# switchport trunk pruning vlan remove 5
Switch(config-if)# switchport trunk pruning vlan except 100-200
Switch(config-if)# switchport trunk pruning vlan none
***
All original material copyright 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.