Ta có một mô hình mạng thực tế như sau:
+ Mô hình có 3 nhóm, nhóm 1 và 3 mỗi nhóm gồm một Router và ba Switch lớp 2, nhóm 2 gồm 1 Switch lớp 3 và ba Switch lớp 2.
+ Cấu hình Trunk Dot1q giữa các Switch.
+ Cấu hình VTP: Mỗi nhóm giữ VTP domain là vnprox (với x là số nhóm x = 1,2,3), VTP password là cisco, Switch x1 là Server, Switch x2,x3 là Client.
+ Tạo VLAN trong từng nhóm tương ứng với hình dưới, gán cổng cho mỗi VLAN đã tạo.
+ Tiến hành định tuyến giữa các VLAN trong một nhóm và với các VLAN khác nhóm.
Mô hình thực hành mô phỏng đinh tuyến VLAN
Tiến hành cấu hình trên các thiết bị:
Nhóm 1:
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW11
SW11(config)#intterface f0/8
SW11(config-if)#switchport mode trunk
SW11(config-if)#interface f0/9
SW11(config-if)#Switchport mode trunk
SW11(config-if)#int f0/24
SW11(config-if)#switchport mode trunk
SW11(config-if)#exit
SW11(config)#vtp domain
vnpro1 Changing VTP domain name from NULL to vnpro1
SW11(config)#vtp password cisco
Setting device VLAN database password to cisco
SW11(config)#vlan 11
SW11(config-vlan)#name VLAN11
SW11(config-vlan)#vlan 12
SW11(config-vlan)#name VLAN12
SW11(config-vlan)#vlan 13
SW11(config-vlan)#name VLAN13
SW11(config-vlan)#exit
SW11(config)#interface range f0/1-7
SW11(config-if-range)#switchport mode access
SW11(config-if-range)#switchport access vlan 11
SW11(config-if-range)#interface range f0/10-16
SW11(config-if-range)#sw mode access
SW11(config-if-range)#switchport access vlan 12
SW11(config-if-range)#interface range f0/17-23
SW11(config-if-range)#switchport mode access
SW11(config-if-range)#switchport access vlan 13
SW11(config-if-range)#end
SW11#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW12
SW12(config)#interface f0/8
SW12(config-if)#switchport mode trunk
SW12(config-if)#exit
SW12(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW12(config)#vtp domain vnpro1
Domain name already set to vnpro1
SW12(config)#vtp password cisco
Setting device VLAN database password to cisco
SW12(config)#interface range f0/1-7
SW12(config-if-range)#switchport mode access
SW12(config-if-range)#switchport access vlan 11
SW12(config-if-range)#interface range f0/9-16
SW12(config-if-range)#switchport mode access
SW12(config-if-range)#switchport access vlan 12
SW12(config-if-range)#interface range f0/17-24
SW12(config-if-range)#switchport mode access
SW12(config-if-range)#switchport access vlan 13
SW12(config-if-range)#end
SW12#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW13
SW13(config)#interface f0/8
SW13(config-if)#switchport mode trunk
SW13(config-if)#exit
SW13(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW13(config)#vtp domain vnpro1
Domain name already set to vnpro1.
SW13(config)#vtp password cisco
Setting device VLAN database password to cisco
SW13(config)#interface range f0/1-7
SW13(config-if-range)#switchport mode access
SW13(config-if-range)#switchport access vlan 11
SW13(config-if-range)#interface range f0/9-16
SW13(config-if-range)#switchport mode access
SW13(config-if-range)#switchport access vlan 12
SW13(config-if-range)#interface range f0/17-24
SW13(config-if-range)#switchport mode access
SW13(config-if-range)#switchport access vlan 13
SW13(config-if-range)#end
SW13#write memory
Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#int f0/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface f0/0
R1(config-if)#no shutdown
R1(config-if)#int f0/0.11
R1(config-subif)#encapsulation dot1Q 11
R1(config-subif)#ip add 172.16.1.1 255.255.255.0
R1(config-subif)#int f0/0.12
R1(config-subif)#encapsulation dot1Q 12
R1(config-subif)#ip add 172.16.2.1 255.255.255.0
R1(config-subif)#int f0/0.13
R1(config-subif)#encapsulation dot1Q 13
R1(config-subif)#ip add 172.16.3.1 255.255.255.0
R1(config-subif)#exit
R1(config)#router ospf 1
R1(config-router)#network 172.16.0.0 0.0.3.255 area 0
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#end R1#write memory
Nhóm 2:
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW21
SW21(config)#interface f0/8
SW21(config-if)#switchport mode trunk
SW21(config-if)#int f0/9
SW21(config-if)#switchport mode trunk
SW21(config-if)#int f0/24
SW21(config-if)#switchport mode trunk
SW21(config-if)#exit
SW21(config)#vtp domain vnpro2
Changing VTP domain name from NULL to vnpro2
W21(config)#vtp password cisco
Setting device VLAN database password to cisco
SW21(config)#vlan 21
SW21(config-vlan)#name VLAN21
SW21(config-vlan)#vlan 22
SW21(config-vlan)#name VLAN22
SW21(config-vlan)#vlan 23
SW21(config-vlan)#name VLAN23
SW21(config-vlan)#exit
SW21(config)#interface range f0/1-7
SW21(config-if-range)#switchport mode access
SW21(config-if-range)#switchport access vlan 21
SW21(config-if-range)#interface range f0/10-16
SW21(config-if-range)#switchport mode access
SW21(config-if-range)#switchport access vlan 22
SW21(config-if-range)#interface range f0/17-23
SW21(config-if-range)#switchport mode access
SW21(config-if-range)#switchport access vlan 23
SW21(config-if-range)#end
SW21#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW22
SW22(config)#interface f0/8
SW22(config-if)#switchport mode trunk
SW22(config-if)#exit
SW22(config)#vtp mode client
Device mode already VTP CLIENT.
SW22(config)#vtp domain vnpro2
Domain name already set to vnpro2.
SW22(config)#vtp password cisco
Setting device VLAN database password to cisco
SW22(config)#interface range f0/1-7
SW22(config-if-range)#switchport mode access
SW22(config-if-range)#switchport access vlan 21
SW22(config-if-range)#interface range f0/9-16
SW22(config-if-range)#switchport mode access
SW22(config-if-range)#switchport access vlan 22
SW22(config-if-range)#interface range f0/17-24
SW22(config-if-range)#switchport mode access
SW22(config-if-range)#switchport access vlan 23
SW22(config-if-range)#end
SW22#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW23
SW23(config)#interface f0/8
SW23(config-if)#switchport mode trunk
SW23(config-if)#exit
SW23(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW23(config)#vtp domain vnpro2
Domain name already set to vnpro2.
SW23(config)#vtp password cisco
Setting device VLAN database password to cisco
SW23(config)#interface range f0/1-7
SW23(config-if-range)#switchport mode access
SW23(config-if-range)#switchport access vlan 21
SW23(config-if-range)#interface range f0/9-16
SW23(config-if-range)#switchport mode access
SW23(config-if-range)#switchport access vlan 22
SW23(config-if-range)#interface range f0/17-24
SW23(config-if-range)#switchport mode access
SW23(config-if-range)#switchport access vlan
23 SW23(config-if-range)#end
SW23#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW2
SW2(config)#ip routing
SW2(config)#int f0/2
SW2(config-if)#no switchport
SW2(config-if)#ip address 192.168.2.2 255.255.255.0
SW2(config-if)#no shutdown
SW2(config-if)#int f0/3
SW2(config-if)#no switchport
SW2(config-if)#ip address 192.168.1.2 255.255.255.0
SW2(config-if)#no shutdown
SW2(config-if)#exit
SW2(config)#interface f0/1
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#exit
SW2(config)#vtp domain vnpro2
Domain name already set to vnpro2.
SW2(config)#vtp password cisco
Setting device VLAN database password to cisco
SW2(config)#int vlan 21
SW2(config-if)#ip address 172.17.1.1 255.255.255.0
SW2(config-if)#int vlan 22
SW2(config-if)#ip address 172.17.2.1 255.255.255.0
SW2(config-if)#int vlan 23
SW2(config-if)#ip address 172.17.3.1 255.255.255.0
SW2(config-if)#exit
SW2(config)#router ospf 1
SW2(config-router)#network 172.17.0.0 0.0.3.255 area 0
SW2(config-router)#network 192.168.1.0 0.0.0.255 area 0
SW2(config-router)#network 192.168.2.0 0.0.0.255 area 0
SW2(config-router)#end
SW2#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW31
SW31(config)#interface f0/8
SW31(config-if)#switchport mode trunk
SW31(config-if)#int f0/9
SW31(config-if)#switchport mode trunk
SW31(config-if)#int f0/24
SW31(config-if)#switchport mode trunk
SW31(config-if)#exit
SW31(config)#vtp domain vnpro3
Changing VTP domain name from NULL to vnpro3
SW31(config)#vtp password cisco
Setting device VLAN database password to cisco
SW31(config)#vlan 31
SW31(config-vlan)#name VLAN31
SW31(config-vlan)#vlan 32
SW31(config-vlan)#name VLAN32
SW31(config-vlan)#vlan 33
SW31(config-vlan)#name VLAN33
SW31(config-vlan)#exit
SW31(config)#interface range f0/1-7
SW31(config-if-range)#switchport mode access
SW31(config-if-range)#switchport access vlan 31
SW31(config-if-range)#interface range f0/10-16
SW31(config-if-range)#switchport mode access
SW31(config-if-range)#switchport access vlan 32
SW31(config-if-range)#interface range f0/17-23
SW31(config-if-range)#switchport mode access
SW31(config-if-range)#switchport access vlan 33
SW31(config-if-range)#end
SW31#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW32
SW32(config)#interface f0/8
SW32(config-if)#switchport mode trunk
SW32(config-if)#exit
SW32(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW32(config)#vtp domain vnpro3
Domain name already set to vnpro3.
SW32(config)#vtp password cisco
Setting device VLAN database password to cisco
SW32(config)#interface range f0/1-7
SW32(config-if-range)#switchport mode access
SW32(config-if-range)#switchport access vlan 31
SW32(config-if-range)#interface range f0/9-16
SW32(config-if-range)#switchport mode access
SW32(config-if-range)#switchport access vlan 32
SW32(config-if-range)#interface range f0/17-24
SW32(config-if-range)#switchport mode access
SW32(config-if-range)#switchport access vlan 33
SW32(config-if-range)#end
SW32#write memory
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW33
SW33(config)#interface f0/8
SW33(config-if)#switchport mode trunk
SW33(config-if)#exit
SW33(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW33(config)#vtp domain vnpro3
Domain name already set to vnpro3.
SW33(config)#vtp password cisco
Setting device VLAN database password to cisco
SW33(config)#interface range f0/1-7
SW33(config-if-range)#switchport mode access
SW33(config-if-range)#switchport access vlan 31
SW33(config-if-range)#interface range f0/9-16
SW33(config-if-range)#switchport mode access
SW33(config-if-range)#switchport access vlan 32
SW33(config-if-range)#interface range f0/17-24
SW33(config-if-range)#switchport mode access
SW33(config-if-range)#switchport access vlan 33
SW33(config-if-range)#end
SW33#write memory Building configuration...
[OK]
Router>enable
Router#configure terminal
Router(config)#hostname R3
R3(config)#interface f0/1
R3(config-if)#ip address 192.168.2.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int f0/0
R3(config-if)#no shutdown
R3(config-if)#int f0/0.31
R3(config-subif)#encapsulation dot1Q 31
R3(config-subif)#ip address 172.18.1.1 255.255.255.0
R3(config-subif)#int f0/0.32
R3(config-subif)#encapsulation dot1Q 32
R3(config-subif)#ip address 172.18.2.1 255.255.255.0
R3(config-subif)#int f0/0.33
R3(config-subif)#encapsulation dot1Q 33
R3(config-subif)#ip address 172.18.3.1 255.255.255.0
R3(config-subif)#exit
R3(config)#router ospf 1
R3(config-router)#network 172.18.0.0 0.0.3.255 area 0
R3(config-router)#network 192.168.2.0 0.0.0.255 area 0
R3(config-router)#end
R3#write memory
Các lệnh kiểm tra:
- Show vlan
- Show vtp status
- Show ip route
- Show interface trunk
Vũ Trường Sơn – VnPro