1、默认网关PC1200.30.40.2255.255.255.0200.30.40.1PC2200.30.50.2200.30.50.1PC3201.30.60.2201.30.60.1PC4202.30.61.3202.30.61.1PC5202.30.70.2202.30.70.1PC6202.30.70.3PC7202.30.71.3202.30.71.1(2)端口分配交换机交换机号端口所连PC分配VLANS1Fa0/1VLAN 40Fa0/2VLAN 50S2VLAN 60S3VLAN 61S4VLAN 70S5Fa0/3VLAN 71S2(config-if)#switchport m
2、ode trunk /将f0/2转换成trunks2(config-if)#no shutdowns2(config-if)#exits2(config)# interface FastEthernet0/1s2(config)#vlan 60 /创建VLAN 60S2(config-vlan)#inter vlan 60s2(config-if)# interface FastEthernet0/1s2(config-if)#switchport access vlan 60 /加入VLAN 60注:如果交换机与交换机,交换机与路由器相连要强制转换为trunk。若交换机与PC则不需要。S1,
3、S3,S4如s2配置。(4)路由器设置R1:R1(config)# interface FastEthernet0/0R1(config-if)#no shutdownR1(config-if)#exitR1(config)# interface serial0/3/0R1(config)#ip address 200.0.0.2 255.255.255.0 /写入IPR1(config)#interface FastEthernet0/0.40R1(config-subif)#encapsulation dot1q 40 /封装子接口到VLAN 40R1(config-subif)#ip a
4、ddress 200.30.40.1 255.255.255.0R1(config-subif)#exitR1(config)#interface FastEthernet0/0.50R1(config-subif)#encapsulation dot1q 50 R1(config-subif)#ip address 200.30.50.1 255.255.255.0R2(config)#interface FastEthernet0/0.60R2(config-subif)#encapsulation dot1q 60 R2(config-subif)#ip address 201.30.6
5、0.1 255.255.255.0R2(config-subif)#exit R3(config)#interface FastEthernet0/0.60R3(config-subif)#encapsulation dot1q 61 R3(config-subif)#ip address 202.30.61.1 255.255.255.0R3(config-subif)#exitR3(config)#interface FastEthernet0/0.70R3(config-subif)#encapsulation dot1q 70 R3(config-subif)#ip address 2
6、02.30.70.1 255.255.255.0R3(config)#interface FastEthernet0/0.71R3(config-subif)#encapsulation dot1q 71 R3(config-subif)#ip address 202.30.71.1 255.255.255.0R1(config)#router ripR1(config-router)#version 2 /版本R1(config-router)#network 200.0.0.0 /转发的网络R1(config-router)#network 200.30.40.0 R1(config-ro
7、uter)#network 200.30.50.0R1(config-router)#exitR2转发的网络R2(config-router)#network 200.0.0.0R2(config-router)#network 210.0.0.0R2(config-router)#network 201.30.60.0R3转发的网络R3(config-router)#network 210.0.0.0R3(config-router)#network 220.0.0.0R3(config-router)#network 202.30.61.0R3(config-router)#network
8、 202.30.70.0R3(config-router)#network 202.30.71.0R4转发的网络R4(config-router)#network 220. 0. 0.0 (5)时钟设置比如R2中的s0/3/0R2(config)# interface serial0/3/0R2(config-if)#ip address 200.0.0.3 255.255.255.0R2(config-if)#clock rate 64000R2(config-if)#no shutdown5、测试PC1为VLAN 40,PC2为VLAN 50,PC3为VLAN 60,PC4为VLAN 61
9、,PC5和PC6同属于VLAN 70,PC7为VLAN 71(1)同一VLAN之间的测试PC5(200.30.70.2)和PC6(200.30.70.3)之间的测试(2)不同网段之间的测试1、PC1(200.30.40.2)和PC2(200.30.50.2)先到相应的网段200.30.50.0,再根据路由表进行转发。2、PC1(200.30.40.2)和PC3(201.30.60.2)先到相应的网段201.30.60.0,再根据路由表进行转发。3、PC6(202.30.70.3)和PC7(202.30.71.3)先到相应的网段202.30.71.0,再根据路由表进行转发。其它的测试如上图所示,
10、均可Ping通。5、举例R3中的配置R3enableR3#show runBuilding configuration.Current configuration : 1081 bytes!version 12.4no service timestamps log datetime msecno service timestamps debug datetime msecno service password-encryptionhostname R3ip name-server 0.0.0.0interface FastEthernet0/0 no ip address duplex aut
11、o speed autointerface FastEthernet0/0.61 encapsulation dot1Q 61 ip address 202.30.61.1 255.255.255.0interface FastEthernet0/0.70 encapsulation dot1Q 70 ip address 202.30.70.1 255.255.255.0interface FastEthernet0/0.71 encapsulation dot1Q 71 ip address 202.30.71.1 255.255.255.0interface FastEthernet0/
12、1 shutdowninterface Serial0/2/0interface Serial0/2/1interface Serial0/3/0 ip address 210.0.0.3 255.255.255.0interface Serial0/3/1 ip address 220.0.0.3 255.255.255.0interface Vlan1router rip version 2 network 202.30.61.0 network 202.30.70.0 network 202.30.71.0 network 210.0.0.0 network 220.0.0.0ip classlessline con 0line vty 0 4 loginendS1#show running-config 1088 bytesversion 12.1no service timesta
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1