Ta đã phân Subnet 172.16.254.0/24 cho việc kết nối giữa các Router. Thực tế ta chia nhỏ thành 3 subnet : 172.16.254.0/30 , 172.16.254.4/30 , 172.16.254.8/30 để kết nối các router với nhau thong qua việc chia VLAN ở MainSwitch.
MainSwitch sẽ chia thành 3 VLAN :
- VLAN 1 cho router khoa CNTT qua interface fa0/2 - VLAN 2 cho router khoa Điện qua interface fa0/3 - VLAN 3 cho router của 7 khoa còn lại
MainRouter của trường sẽ định tuyến cho 3 VLAN này
Bước 1 : Xóa cấu hình hiện tại (xóa Startup-config) và cấu hình VLAN cũ (xóa file vlan.dat trong flash) của MainSwitch
Tiến hành tương tự như những switch khác đã cấu hình
Bước 2 : Xem qua cấu hình mặc định của switch và thiết lập các bước cấu hình cơ bản :
Tiến hành tương tự như những switch khác đã cấu hình
Bước 3 : Tạo 3 VLAN trên MainSwitch và gắn port vào các VLAN
MainSwitch#show vlan VLAN Name Status Ports
---- --- --- --- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15, Fa0/16 Fa0/17, Fa0/18, Fa0/19, Fa0/20 Fa0/21, Fa0/22, Fa0/23, Fa0/24 Gig1/1, Gig1/2
1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active MainSwitch# MainSwitch#config t
Enter configuration commands, one per line. End with CNTL/Z. MainSwitch(config)#vlan 2 MainSwitch(config-vlan)#name Dien MainSwitch(config-vlan)#exit MainSwitch(config)#vlan 3 MainSwitch(config-vlan)#name 7Khoa MainSwitch(config-vlan)#exit MainSwitch(config)#int f0/1
MainSwitch(config-if)#switchport mode trunk MainSwitch(config-if)#exit
MainSwitch(config)#int f0/3
MainSwitch(config-if)#switchport access vlan 2 MainSwitch(config-if)#exit
MainSwitch(config)#int f0/4
MainSwitch(config-if)#switchport access vlan 3 MainSwitch(config-if)#^Z
%SYS-5-CONFIG_I: Configured from console by console MainSwitch#show vlan
VLAN Name Status Ports
---- --- --- --- 1 default active Fa0/1, Fa0/2, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Fa0/24, Gig1/1, Gig1/2 2 Dien active Fa0/3
3 7Khoa active Fa0/4 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active
Bước 4 : Cấu hình Trunking trên MainRouter
MainRouter(config)#
MainRouter(config)#int f0/1
MainRouter(config-if)#ip address 172.16.254.1 255.255.255.252 MainRouter(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
MainRouter(config-if)#exit MainRouter(config)#int f0/1.2
%LINK-5-CHANGED: Interface FastEthernet0/1.2, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.2, changed state to up MainRouter(config-subif)#encapsulation dot1Q 2 MainRouter(config-subif)#ip address 172.16.254.5 255.255.255.252 MainRouter(config-subif)#no shutdown MainRouter(config-subif)#exit MainRouter(config)#int f0/1.3
%LINK-5-CHANGED: Interface FastEthernet0/1.3, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.3, changed state to up
MainRouter(config-subif)#encapsulation dot1Q 3
MainRouter(config-subif)#ip address 172.16.254.9 255.255.255.252 MainRouter(config-subif)#no shutdown
MainRouter(config-subif)#
Bước 5 : Tiến hành Routing trên các router sử dụng giao thức OSPF Trên Router-CNTT :
Router-CNTT#config t
Enter configuration commands, one per line. End with CNTL/Z. Router-CNTT(config)#int f0/0
Router-CNTT(config-if)#ip address 172.16.254.2 255.255.255.252 Router-CNTT(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up Router-CNTT(config-if)#router ospf 1 Router-CNTT(config-router)#net 172.16.0.0 0.0.0.255 area 0 Router-CNTT(config-router)#net 172.16.1.0 0.0.0.255 area 0 Router-CNTT(config-router)#net 172.16.2.0 0.0.0.255 area 0 Router-CNTT(config-router)#net 172.16.254.0 0.0.0.3 area 0 Router-CNTT(config-router)#^Z
%SYS-5-CONFIG_I: Configured from console by console Router-CNTT#
Trên Router – Điện :
R-Dien(config)#
R-Dien(config)#int f0/0
R-Dien(config-if)#ip address 172.16.254.6 255.255.255.252 R-Dien(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R-Dien(config-router)#net 172.16.8.0 0.0.0.255 area 0 R-Dien(config-router)#net 172.16.9.0 0.0.0.255 area 0 R-Dien(config-router)#net 172.16.10.0 0.0.0.255 area 0 R-Dien(config-router)#net 172.16.11.0 0.0.0.255 area 0 R-Dien(config-router)#net 172.16.12.0 0.0.0.255 area 0 R-Dien(config-router)#net 172.16.254.4 0.0.0.3 area 0 R-Dien(config-router)#
Trên Router 7 Khoa :
Router#config t
Enter configuration commands, one per line. End with CNTL/Z. Router-7Khoa(config)#int f0/0
Router-7Khoa(config-if)#ip address 172.16.254.10 255.255.255.252 Router-7Khoa(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up Router-7Khoa(config-if)#router ospf 1 Router-7Khoa(config-router)#net 172.16.16.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.17.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.18.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.19.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.20.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.21.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.22.0 0.0.0.255 area 0 Router-7Khoa(config-router)#net 172.16.254.10 0.0.0.3 area 0 Router-7Khoa(config-router)#
Trên MainRouter của trường :
MainRouter(config)# MainRouter(config)#router ospf 1 MainRouter(config-router)#net 172.16.254.0 0.0.0.3 area 0 MainRouter(config-router)#net 172.16.254.4 0.0.0.3 area 0 MainRouter(config-router)#net 172.16.254.8 0.0.0.3 area 0 MainRouter(config-router)# 00:13:24: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.254.6 on FastEthernet0/1.2 from LOADING to FULL, Loading Done
00:13:25: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.254.2 on FastEthernet0/1 from LOADING to FULL, Loading Done
00:13:32: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.254.10 on FastEthernet0/1.3 from LOADING to FULL, Loading Done MainRouter(config-router)#^Z
%SYS-5-CONFIG_I: Configured from console by console MainRouter #show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 18 subnets, 2 masks
O 172.16.0.0/24 [110/2] via 172.16.254.2, 00:00:39, FastEthernet0/1 O 172.16.1.0/24 [110/2] via 172.16.254.2, 00:00:39, FastEthernet0/1 O 172.16.2.0/24 [110/2] via 172.16.254.2, 00:00:39, FastEthernet0/1 O 172.16.8.0/24 [110/2] via 172.16.254.6, 00:00:39, FastEthernet0/1.2 O 172.16.9.0/24 [110/2] via 172.16.254.6, 00:00:39, FastEthernet0/1.2 O 172.16.10.0/24 [110/2] via 172.16.254.6, 00:00:39, FastEthernet0/1.2 O 172.16.11.0/24 [110/2] via 172.16.254.6, 00:00:39, FastEthernet0/1.2 O 172.16.12.0/24 [110/2] via 172.16.254.6, 00:00:39, FastEthernet0/1.2 O 172.16.16.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.17.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.18.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.19.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.20.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.21.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 O 172.16.22.0/24 [110/2] via 172.16.254.10, 00:00:29, FastEthernet0/1.3 C 172.16.254.0/30 is directly connected, FastEthernet0/1
C 172.16.254.4/30 is directly connected, FastEthernet0/1.2 C 172.16.254.8/30 is directly connected, FastEthernet0/1.3