实验工具:在虚拟机中完成,
3
台
CISCO7200
路由,
2
台
3640
交换,
6
台
PC
实验要求:同时设置RIP、VLAN、Trunk、单臂路由
实验目的:不同网段的
6
台
PC
能相互
PING
通
动态路由
RIP
:能通过计算,适应网络结构变化,而不像静态路由要通过管理员修改其跳数。
R1
R1(config)#interface f1/0
R1(config-if)#no sh
R1(config-if)#
R1(config-if)#ip add 20.0.0 .1 255.255.255.0
设置
IP
R1(config-if)#exit
R1(config)#ip router
R1(config)#router rip
设置动态路由
R1(config-router)#version 2
使用的是
V2
版本
R1(config-router)#network 10.0.0 .0
R1(config-router)#network 20.0.0 .0
R1(config-router)#no auto-summary
R1(config-router)#exit
R1(config)#interface f0/0
设置单臂路由子借口
R1(config-if)#no sh
R1(config-if)#
R1(config-if)#interface f0/0.1
R1(config-subif)#encapsulation dot
R1(config-subif)#encapsulation dot1Q 1
R1(config-subif)#ip add 10.0.1 .1 255.255.255.0
R1(config-subif)#interface f0/0.2
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip add 10.0.2 .1 255.255.255.0
R1(config-subif)#interface f0/0.3
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip add 10.0.3 .1 255.255.255.0
R1(config-subif)#exit
三个路由全都设置好后的情况,如果只设置了一个后
SHOW
,由于没有学习到别的路由的网段,不会出现一下信息。
R1#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
20.0.0 .0/24 is subnetted, 1 subnets
C 20.0.0 .0 is directly connected, FastEthernet1/ 0 C
代表直连网段
40.0.0.0/24 is subnetted, 3 subnets R
代表动态路由,学习到的
3
个子网
R 40.0.1.0 [120/2] vi a 20.0.0 .2, 00:00:19, FastEthernet1/0
R 40.0.2.0 [120/2] vi a 20.0.0 .2, 00:00:19, FastEthernet1/0
R 40.0.3.0 [120/2] vi a 20.0.0 .2, 00:00:19, FastEthernet1/0
10.0.0 .0/24 is subnetted, 3 subnets
C 10.0.2 .0 is directly connected, FastEthernet0/0.2
C 10.0.3 .0 is directly connected, FastEthernet0/0.3
C 10.0.1 .0 is directly connected, FastEthernet0/0.1
30.0.0.0/24 is subnetted, 1 subnets
R 30.0.0.0 [120/1] vi a 20.0.0 .2, 00:00:19, FastEthernet1/0
学到 30 网下 一跳为 20.0.0 .2 , [120/1] 中 120 代表管理距离,越小路由的优先级别越高, 0 代表度量值
R2
R2(config)#interface f0/0
R2(config-if)#no sh
R2(config-if)#ip add 20.0.0 .2 255.255.255.0
R2(config-if)#interface f1/0
R2(config-if)#no sh
R2(config-if)#ip add 20.0.0 .2 255.255.255.0
R2(config-if)#ip add 30.0.0.1 255.255.255.0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 20.0.0 .0
R2(config-router)#network 30.0.0.0
R2(config-router)#no auto-summary
R2(config-router)#exit
R2(config)#exit
R2#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
20.0.0 .0/24 is subnetted, 1 subnets
C 20.0.0 .0 is directly connected, FastEthernet0/0
40.0.0.0/24 is subnetted, 3 subnets
R 40.0.1.0 [120/1] via 30.0.0.2, 00:00:06, FastEthernet1/0
R 40.0.2.0 [120/1] via 30.0.0.2, 00:00:06, FastEthernet1/0
R 40.0.3.0 [120/1] via 30.0.0.2, 00:00:06, FastEthernet1/0
10.0.0 .0/24 is subnetted, 3 subnets
R 10.0.2 .0 [120/1] vi a 20.0.0 .1, 00:00:20, FastEthernet0/0
R 10.0.3 .0 [120/1] vi a 20.0.0 .1, 00:00:20, FastEthernet0/0
R 10.0.1 .0 [120/1] vi a 20.0.0 .1, 00:00:20, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.0.0.0 is directly connected, FastEthernet1/0
R3
R3(config)#interface f0/0
R3 (config-if)#no sh
R3 (config-if)#ip add
R3 (config-if)#ip add 30.0.0.2 255.255.255.0
R3 (config-if)#exit
R3 (config)#router rip
R3 (config-router)#version 2
R3 (config-router)#network 30.0.0.0
R3 (config-router)#network 40.0.0.0
R3 (config-router)#no auto-summary
R3 (config-router)#exit
R3(config)#interface f1/0
R3(config-if)#no sh
R3(config-if)#interface f1/0.1
R3(config-subif)#encapsulation dot1Q 1
R3(config-subif)#ip add 40.0.1.1 255.255.255.0
R3(config-subif)#interface f1/0.2
R3(config-subif)#ip add 40.0.2.1 255.255.255.0
R3(config-subif)#encapsulation dot1Q 2
R3(config-subif)#ip add 40.0.2.1 255.255.255.0
R3(config-subif)#interface f1/0.3
R3(config-subif)#encapsulation dot1Q 3
R3(config-subif)#ip add 40.0.3.1 255.255.255.0
R3(config-subif)#exit
R3(config)#exit
R3#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
20.0.0 .0/24 is subnetted, 1 subnets
R 20.0.0 .0 [120/1] via 30.0.0.1, 00:00:24, FastEthernet0/0
40.0.0.0/24 is subnetted, 3 subnets
C 40.0.1.0 is directly connected, FastEthernet1/0.1
C 40.0.2.0 is directly connected, FastEthernet1/0.2
C 40.0.3.0 is directly connected, FastEthernet1/0.3
10.0.0 .0/24 is subnetted, 3 subnets
R 10.0.2 .0 [120/2] via 30.0.0.1, 00:00:24, FastEthernet0/0
R 10.0.3 .0 [120/2] via 30.0.0.1, 00:00:24, FastEthernet0/0
R 10.0.1 .0 [120/2] via 30.0.0.1, 00:00:24, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.0.0.0 is directly connected, FastEthernet0/0
S1
S1#vlan database
S1(vlan)#vlan 2
设置
VLAN
VLAN 2 added:
Name: VLAN0002
S1(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
S1(vlan)#exit
APPLY completed.
Exiting....
S1#conf t
S1(config)#interface range f0/5 - 8
S1(config-if-range)#switchport access vlan 2
S1(config-if-range)#interface range f0/9 - 14
S1(config-if-range)#switchport access vlan 3
S1(config-if-range)#exit
S1(config)#interface f0/15
设置
Trunk
S1(config-if)#switchport mode trunk
S1#show vlan-s
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3
Fa0/4
2 VLAN0002 active Fa0/5, Fa0/6, Fa0/7,Fa0/8
3 VLAN0003 active Fa0/9, Fa0/10, Fa0/11, Fa0/12,Fa0/13, Fa0/14
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
S2
S2#vlan database
S2(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
S2(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
S2(vlan)#exit
APPLY completed.
Exiting....
S2#conf t
S2(config)#interface range f0/5 - 8
S2(config-if-range)#switchport access vlan 2
S2(config-if-range)#interface range f0/9 - 14
S2(config-if-range)#switchport access vlan 3
S2(config-if-range)#exit
S2(config)#interface f0/15
S2(config-if)#switchport mode trunk
S2(config-if)#
*Mar 1 00:22:52.667: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
S2(config-if)#end
S2#sh
S2#show vlan-s
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3
Fa0/4
2 VLAN0002 active Fa0/5, Fa0/6, Fa0/7, Fa0/8
3 VLAN0003 active Fa0/9, Fa0/10, Fa0/11, Fa0/12, Fa0/13, Fa0/14
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
PC能相互PING通,实验成功。
这个实验要注意的是
R1,R2
只要设置一个
IP
地址,单臂路由端口不用设置
IP