一、实训内容:
2、 配置过程说明
(1)交换机
S1:需要创建vlan、配置access和trunk接口、并将相应接口加入对应vlan3中。
S2:需要创建vlan、配置access和trunk接口、并将相应接口加入对应vlan9中。
S3:需要创建vlan、配置access和trunk接口、配置vlanif 3和vlanif 9接口及其IP地址,创建vlan1002,并配置vlanif 1002接口及其IP地址192.168.2.1/24。
S4:需要创建vlan、配置access和trunk接口、配置vlanif 105接口及其IP地址,创建vlan1004,并配置vlanif 1004接口及其IP地址192.168.4.1/24。
(2)路由器
R1:配置各接口IP地址、配置OSPF协议。
R2:配置各接口IP地址、配置OSPF协议。
3、设备配置
(1)S1配置步骤
Switch>en
Switch#conf t
Switch(config)#hostname S1
S1(config)#vlan 3
S1(config-vlan)#vlan 9
S1(config-vlan)#vlan 1002
S1(config-vlan)#exit
S1(config)#int f0/3
S1(config-if)#switchport access vlan 3
S1(config-if)#int f0/1
S1(config-if)#switchport mode trunk
S1(config-if)#
(2)S2配置步骤
Switch>en
Switch#conf t
Switch(config)#hostname S2
S2(config)#vlan 3
S2(config-vlan)#vlan 9
S2(config-vlan)#vlan 1002
S2(config-vlan)#exit
S2(config)#int f0/3
S2(config-if)#switchport access vlan 9
S2(config-if)#int f0/1
S2(config-if)#switchport mode trunk
S2(config-if)#
(3)S3配置步骤
Switch>en
Switch#conf t
Switch(config)#hostname S3
S3(config)#ip routing
S3(config)#vlan 3
S3(config-vlan)#vlan 9
S3(config-vlan)#vlan 1002
S3(config-vlan)#exit
S3(config)#int f0/1
S3(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is “Auto” can not be configured to “trunk” mode.
S3(config-if)#int f0/2
S3(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is “Auto” can not be configured to “trunk” mode.
S3(config-if)#int f0/3
S3(config-if)#switchport access vlan 1002
S3(config-if)#no shutdown
S3(config-if)#exit
S3(config)#
S3(config)#int vlan 3
S3(config-if)#ip address 172.16.3.1 255.255.255.0
S3(config-if)#int vlan 9
S3(config-if)#ip address 172.16.9.1 255.255.255.0
S3(config-if)#int vlan 1002
S3(config-if)#ip address 192.168.2.1 255.255.255.0
S3(config)#router ospf 1
S3(config-router)#router-id 1.1.1.1
S3(config-router)#network 172.16.3.0 0.0.0.255 area 1
S3(config-router)#network 172.16.9.0 0.0.0.255 area 1
S3(config-router)#network 192.168.2.0 0.0.0.255 area 1
S3(config)#service dhcp
S3(config)#ip dhcp pool vlan9
S3(dhcp-config)#network 172.16.9.0 255.255.255.0
S3(dhcp-config)#default-router 172.16.9.1
S3(dhcp-config)#dns-server 8.8.8.8
(4)S4配置步骤
Switch>en
Switch#conf t
Switch(config)#hostname S4
S4(config)#ip routing
S4(config)#vlan 105
S4(config-vlan)#vlan 1004
S4(config-vlan)#exit
S4(config)#int f0/1
S4(config-if)#switchport access vlan 1004
S4(config-if)#no shutdown
S4(config-if)#int f0/2
S4(config-if)#switchport access vlan 105
S4(config-if)#exit
S4(config)#int vlan 105
S4(config-if)#ip address 10.0.5.1 255.255.255.0
S4(config-if)#int vlan 1004
S4(config-if)#ip address 192.168.4.1 255.255.255.0
S4(config-if)#exit
S4(config)#router ospf 1
S4(config-router)#router-id 4.4.4.4
S4(config-router)#network 192.168.4.0 0.0.0.255 area 2
S4(config-router)#network 10.0.5.0 0.0.0.255 area 2
(5)R1配置步骤
Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#int f0/1
R1(config-if)#ip address 192.168.2.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/0
R1(config-if)#ip address 192.168.3.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#router-id 2.2.2.2
R1(config-router)#network 192.168.2.0 0.0.0.255 area 1
R1(config-router)#network 192.168.3.0 0.0.0.255 area 0
(6)R2配置步骤
Router>en
Router#conf t
Router(config)#hostname R2
R2(config)#int f0/0
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#int f0/1
R2(config-if)#ip address 192.168.4.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#router-id 3.3.3.3
R2(config-router)#network 192.168.3.0 0.0.0.255 area 0
R2(config-router)#network 192.168.4.0 0.0.0.255 area 2
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.0.5.0 [110/4] via 192.168.2.2, 00:12:44, Vlan1002
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.3.0 is directly connected, Vlan3
C 172.16.9.0 is directly connected, Vlan9
C 192.168.2.0/24 is directly connected, Vlan1002
O IA 192.168.3.0/24 [110/2] via 192.168.2.2, 00:12:54, Vlan1002
O IA 192.168.4.0/24 [110/3] via 192.168.2.2, 00:12:44, Vlan1002
S3#
(2)查看R1路由器路由表
R1#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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.0.5.0 [110/3] via 192.168.3.1, 00:14:00, FastEthernet0/0
172.16.0.0/24 is subnetted, 2 subnets
O 172.16.3.0 [110/2] via 192.168.2.1, 00:02:24, FastEthernet0/1
O 172.16.9.0 [110/2] via 192.168.2.1, 00:02:14, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
O IA 192.168.4.0/24 [110/2] via 192.168.3.1, 00:14:00, FastEthernet0/0
R1#
(3)查看R2路由器路由表
R2#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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
O 10.0.5.0 [110/2] via 192.168.4.1, 00:18:58, FastEthernet0/1
172.16.0.0/24 is subnetted, 2 subnets
O IA 172.16.3.0 [110/3] via 192.168.3.2, 00:03:19, FastEthernet0/0
O IA 172.16.9.0 [110/3] via 192.168.3.2, 00:03:09, FastEthernet0/0
O IA 192.168.2.0/24 [110/2] via 192.168.3.2, 00:15:03, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, FastEthernet0/1
R2#
(4)查看S4交换机路由表
S4#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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.5.0 is directly connected, Vlan105
172.16.0.0/24 is subnetted, 2 subnets
O IA 172.16.3.0 [110/4] via 192.168.4.2, 00:04:10, Vlan1004
O IA 172.16.9.0 [110/4] via 192.168.4.2, 00:04:00, Vlan1004
O IA 192.168.2.0/24 [110/3] via 192.168.4.2, 00:15:54, Vlan1004
O IA 192.168.3.0/24 [110/2] via 192.168.4.2, 00:16:55, Vlan1004
C 192.168.4.0/24 is directly connected, Vlan1004
S4#
4 配置PC地址
(1)配置PC1地址
IP地址:172.16.3.2
子网掩码:255.255.255.0
网关:172.16.3.1
(2)配置PC2地址
设置为DHCP动态获取IP地址方式
(3)配置PC3地址
IP地址:10.0.5.2
子网掩码:255.255.255.0
网关:10.0.5.1
5.网络连通性测试
(1)PC1连通测试
PC1(172.16.3.2)pingPC2(172.16.9.2),可以ping通
PC1(172.16.3.2)pingPC3(10.0.5.2),可以ping通
PC2(172.16.9.2)pingPC1(172.16.3.2),可以ping通
PC2(172.16.9.2)pingPC3(10.0.5.2),可以ping通
PC3(10.0.5.2)pingPC1(172.16.3.2),可以ping通
PC3(10.0.5.2)pingPC2(172.16.9.2),可以ping通