19.configuring Vlans
19.configuring Vlans
Server: This is the default mode of VTP; in this mode, switches are allowed to modify
their VLANs and send VTP advertisements
Client: In this mode, switches listen for VTP advertisements from other server switches.
Client switches aren't allowed to modify their VLAN database locally.
• Transparent: This mode works independent of other switches. In this mode, the
switch only forwards the VTP advertisements it receives and does not generate any,
neither does it modify its own VLANs based on the VTP advertisements
The following topology will be used for demonstration:
In the first switch (VTP-Server), we will have four VLANs with different names. Then,
we will set all the switch-switch ports to trunking.
VTP-Server(config)#interface Fa0/1
VTP-Server(config-if)#switchport mode trunk
VTP-Transparent(config)#interface range Fa0/1-2
VTP-Transparent(config-if-range)#switchport mode trunk
VTP-Client(config)#interface Fa0/1
VTP-Client(config-if)#switchport mode trunk
• Since VTP is already in server mode, we will just change the VTP domain name and set a
password.
VTP-Server(config)#vtp domain My-Office
Changing VTP domain name from NULL to My-Office
VTP-Server(config)#vtp password s3cRet
Setting device VLAN database password to s3cRet
The final task is to move the third switch (VTP-Client) to client mode.
VTP-Client(config)#vtp mode client
You do not have to change the domain of this switch, as changing it to client will make it pick
up the domain name from the server. However, it is necessary to set the VTP password.
VTP-Client(config)#vtp password s3cRet
The configuration is done; now, use the show vlan command on the VTP-Client switch to see
the new VLANs. This example is only to demonstrate VTP. This topology won't allow normal
communication between VTP-Server and VTP-Client, as the switch in the middle (VTP-
Transparent) doesn't have any of the VLANs we configured.
InterVLAN routing with routers and
layer 3 switches
Although VLAN is used to split the broadcast domain, it is
necessary to enable communication between two or more
VLANs at layer 3 using IP routing.
This is called InterVLAN routing and can be configured using
both routers and layer 3 switches. This requires allocating a
different IP subnet for devices in each VLAN .
We will configure InterVLAN routing by connecting the router
to a switch using a single link. All the traffic to other VLANs
passes through this link, to the router and back again through
this link. This method of configuration is also called router-on-
a-stick, as a single link to the router handles all traffic
InterVLAN on a router
We will use the following topology for
this setup:
As stated earlier, each VLAN will have IP addresses from different network ranges and
the router's interface will have three IP addresses—each belonging to a different network
After IP addresses have been assigned to all PCs, create the necessary VLANs on the
switch and assign the ports to them.
Sw1(config)#int range f0/2-3
Sw1(config-if-range)#switchport access vlan 10
Sw1(config-if-range)#int range f0/4-5
Sw1(config-if-range)#switchport access vlan 20
Sw1(config-if-range)#int range f0/6-7
Sw1(config-if-range)#switchport access vlan 30
Configure the switch port that connects to the router as a trunk link. More on this in the
Switch-to-switch trunk links section.
Sw1(config)#int f0/1
Sw1(config-if)#switchport mode trunk
Now, moving on to the router portion of the configuration, bring the interface up.
R1(config)#int f0/0
R1(config-if)#no shutdown
We will now create the subinterfaces. Each will have its own IP address in a different
network.
R1(config-subif)#int f0/0.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address 10.10.0.1 255.255.255.0
R1(config-subif)#int f0/0.20
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip address 10.20.0.1 255.255.255.0
R1(config-subif)#int f0/0.30
R1(config-subif)#encapsulation dot1Q 30
R1(config-subif)#ip address 10.30.0.1 255.255.255.0
Notice the encapsulation command here. It specifies the VLAN ID the interface will
handle
That's it, now test the connectivity between hosts on different VLANs using simple PDUs
or a ping. The first packet will always time out as it takes some time for the ARP
(Address Resolution Protocol) to complete
Try using tracert to see the path the packet takes
InterVLAN on a layer 3
switch
The only layer 3 switch present on
Packet Tracer is 3560-24PS. We will use
the same topology by replacing only the
router with the layer 3 switch, as shown
in the following screenshot:
Creation and configuration of VLANs is the same on the layer 2 switch, hence it won't be
repeated here. So, we'll move to the layer 3 switch straightaway.
Since the switch-switch link on the layer 2 switch was set to trunking mode with the
switchport mode trunk command, the same port on the layer 3 switch will also be in trunking
mode. This can be verified as follows:
MSw1#sh interface trunk
These interfaces will stay down, as this layer 3 switch doesn't have VLANs 10, 20, and 30. So
we'll create them as follows:
MSw1(config)#vlan 10
MSw1(config-vlan)#vlan 20
MSw1(config-vlan)#vlan 30
As each command is entered, the associated SVI will come up. IP Routing has to be enabled.
MSw1(config)#ip routing
Learning Objectives
• View the default VLAN configuration.
• Configure VLANs.
• Assign VLANs to ports.
• Configure trunking.
Introduction
VLANs are helpful in the administration
of logical groups, allowing members of a
group to be easily moved, changed, or
added. This activity focuses on creating
and naming VLANs, assigning access
ports to specific VLANs, changing the
native VLAN, and configuring trunk
links.
Task 1: View the Default VLAN
Configuration
Objectives
Part 1: Verify the Default VLAN
Configuration
Part 2: Configure VLANs
Part 3: Assign VLANs to Ports
Background
VLANs are helpful in the administration of logical groups, allowing members of a group
to be easily moved, changed, or added. This activity focuses on creating and naming
VLANs, and assigning access ports to specific VLANs.
Part 1: View the Default VLAN Configuration
Step 1: Display the current VLANs.
On S1, issue the command that displays all VLANs configured. By default, all interfaces
are assigned to VLAN 1.
Which command will only display the VLAN name, status, and associated ports on a
switch?
Previously, PCs that shared the same network could ping each other successfully. Try pinging
between PC1 and PC4. Although the access ports are assigned to the appropriate VLANs,
were the pings successful? Why?