UCCN1004 - Lect6 - Virtual LAN
UCCN1004 - Lect6 - Virtual LAN
1 physical
switch
=
Equivalent
Difference Between LAN & VLAN
• LANs are separated and linked • VLANs are “logically” formed
by routers. by managed switches
• LAN is formed with a physical • Router is needed for
(normally non-managed) switch communication between
which is location based. VLANs
Broadcast domains with VLANs & routers
• Without VLANs, each group is Without
10.1.0.0/16
• Step #2:
– Naming the new VLAN (optional)
• Step #3:
– Assigning switch ports as member of a
particular VLAN.
• That particular VLAN must be created first.
VLAN 1 & “show vlan”
vlan 1 (default)
VLAN 1 can’t
be deleted.
WHY VLAN?
• Benefits of VLANs are
–VLANs improve network security by
isolating users that have access to
sensitive data and applications.
–VLANs divide a network into smaller
logical networks, resulting in lower
susceptibility to broadcast storms
• VLANs allow network
administrators to
organize LANs logically
instead of physically.
– Easily move
workstations on the LAN
– Easily add workstations
to the LAN
– Easily change the LAN
configuration
– Easily control network
traffic
– Improve security
Bad reasons to use VLANs
Trunk
Configure Trunk in Switches
• Guideline to select switch ports for trunks:
– Preferably higher bandwidth (e.g. GigabitEthernet in 2960 switches)
– Switch ports of both switches preferably share the same speed.
• Key in the following commands for both Switch0 and
Switch1.
Switch(config)#int gig1/1
Switch(config-if)#switchport mode trunk
Fine Tuning Trunk mode in Switches
• By default, trunk carries VLAN from 1 to 1005.
– If we have 200 VLANs, the trunk is a bottleneck.
• For the following example, we “fine tune” the trunk link to just carry data for certain
VLANS (2,3,100-200) by keying in the following commands in Switch0 and
Switch1.
– You must configure the link as trunk mode first.
• After the command, PC0 can ping PC3. PC1 can ping PC4. However, PC2 CAN’T
ping PC5 (VLAN 4).
Switch(config-if)#int gig1/1
Switch(config-if)#switchport trunk allowed vlan 2,3,100-200
Useful show trunk commands
• Switch#show int trunk
• Example:
Switch#show int trunk
Port Mode Encapsulation Status Native vlan
Gig1/1 on 802.1q trunking 1
10.3.0.0/16
inter-VLAN routing (method 1)
• Trunk between switches for “unified VLAN”.
• PC5 still has to go to Router0 first before going to PC7
– Go through Switch2, Switch1, Switch0 to Router0 and back.
Trunk to Router
Router on
a stick
Subinterfaces
• Subinterfaces take the interface name followed by a dot
and a number.
– e.g. interface f0/0.10
• It is normal to use the VLAN number. If this ties in with the
IP address, even better.
– e.g. interface f0/0.2, interface fa0/0.3
– “.2” and “.3” are numbers that differentiate the subinterfaces.
• Each of the subinterfaces have an IP address.
• Subinterfaces need to use 802.1Q trunking protocol to
differentiate the VLANs in the trunks
– e.g. encapsulation dot1q 11
– The above command means only accept traffic of VLAN 11
• The physical interface has no IP address
– but physical interface need “no shutdown”
Example of Configuring subinterfaces
Switch(config)#int gig1/1
Switch(config-if)#switchport mode trunk
Router(config)#int fa0/1
Router(config-if)#no shutdown
Router(config-if)#int fa0/1.10
Router(config-subif)#encap dot1q 2
Router(config-subif)#ip addr 192.168.1.254 255.255.255.0
Router(config-subif)#exit
Router(config)#int fa0/1.11
Router(config-subif)#encap dot1q 3
Router(config-subif)#ip addr 192.168.2.254 255.255.255.0
VLAN Trunking Protocol (VTP)
VLAN Management Challenge
• It is not difficult to add new VLAN
for a small network (switch by
switch).