R1配置:Router>enRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R1R1(config)#int s1/0R1(config-if)#ip add 192.168.1.1 255.255.255.0R1(config-if)#no shut%LINK-5-CHANGED: Interface Serial1/0, changed state to downR1(config-if)#exitR1(config)#int f0/0R1(config-if)#ip add 192.168.2.1 255.255.255.0R1(config-if)#no shutR1(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to upR1(config-if)#%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(config-if)#int s1/0R1(config-if)#clock rate 64000R1(config-if)#exitR1(config)#%LINK-5-CHANGED: Interface Serial1/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to downR1(config)#exitR1#%SYS-5-CONFIG_I: Configured from console by console ping 192.168.2.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)R1#%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1 con0 is now available Press RETURN to get started.R1>enR1#conf tEnter configuration commands, one per line. End with CNTL/Z.R1(config)#route ripR1(config-router)#netw 192.168.1.0R1(config-router)#netw 192.168.2.0R1(config-router)#exitR1(config)#exitR1#%SYS-5-CONFIG_I: Configured from console by consoleR1#sh ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Serial1/0 C 192.168.2.0/24 is directly connected, FastEthernet0/0R 192.168.3.0/24 [120/1] via 192.168.1.2, 00:00:19, Serial1/0R 192.168.4.0/24 [120/1] via 192.168.1.2, 00:00:19, Serial1/0R 192.168.10.0/24 [120/1] via 192.168.1.2, 00:00:19, Serial1/0R 192.168.20.0/24 [120/1] via 192.168.1.2, 00:00:19, Serial1/0R1#R2配置:Router>enRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R2R2(config)#int s1/0R2(config-if)#ip add 192.168.1.2 255.255.255.0R2(config-if)#no shutR2(config-if)#%LINK-5-CHANGED: Interface Serial1/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to upR2(config-if)#exitR2(config)#int loopback 0R2(config-if)#%LINK-5-CHANGED: Interface Loopback0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on InterfaceLoopback0, changed state to upR2(config-if)#ip add 192.168.3.1 255.255.255.0R2(config-if)#exitR2(config)#ping 192.168.3.1^% Invalid input detected at '^' marker.R2(config)#exitR2#%SYS-5-CONFIG_I: Configured from console by consoleR2#ping 192.168.3.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 0/19/47 msR2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#int loopback 1R2(config-if)#%LINK-5-CHANGED: Interface Loopback1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to upR2(config-if)#ip add 192.168.4.1 255.255.255.0R2(config-if)#no shutR2(config-if)#exitR2(config)#exitR2#%SYS-5-CONFIG_I: Configured from console by consoleR2#ping 192.168.4.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.4.1, timeoutis 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 0/18/63 msR2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#int f0/0R2(config-if)#no ip addR2(config-if)#no shutR2(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR2(config-if)#exitR2(config)#int f0/0.10R2(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to upR2(config-subif)#encap dot1q 10R2(config-subif)#ip add 192.168.10.1 255.255.255.0 R2(config-subif)#exitR2(config)#int f0/0.20R2(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to upR2(config-subif)#encap dot1q 20R2(config-subif)#ip add 192.168.20.1 255.255.255.0 R2(config-subif)#exitR2(config)#exitR2#%SYS-5-CONFIG_I: Configured from console by consoleR2#sh ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Serial1/0 C 192.168.3.0/24 is directly connected, Loopback0 C 192.168.4.0/24 is directly connected, Loopback1C 192.168.10.0/24 is directly connected, FastEthernet0/0.10C 192.168.20.0/24 is directly connected, FastEthernet0/0.20R2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#router ripR2(config-router)#netw 192.168.1.0R2(config-router)#netw 192.168.3.0R2(config-router)#netw 192.168.4.0R2(config-router)#netw 192.168.10.0R2(config-router)#netw 192.168.20.0R2(config-router)#exitR2(config)#exitR2#%SYS-5-CONFIG_I: Configured from console by consoleR2#sh ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA -OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Serial1/0 R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:11, Serial1/0C 192.168.3.0/24 is directly connected, Loopback0 C 192.168.4.0/24 is directly connected, Loopback1 C 192.168.10.0/24 is directly connected, FastEthernet0/0.10C 192.168.20.0/24 is directly connected, FastEthernet0/0.20R2#交换机的配置Switch>enSwitch#config tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#vlan 100Switch(config-vlan)#exitSwitch(config)#vlan 200Switch(config-vlan)#exitSwitch(config)#int range f0/2-5Switch(config-if-range)#swSwitch(config-if-range)#switchport aSwitch(config-if-range)#switchport access vlan 100 Switch(config-if-range)#ip add 192.168.100.2 255.255.255.0Switch(config-if-range)#exitSwitch(config)#int range f0/6 -10Switch(config-if-range)#swSwitch(config-if-range)#switchport aSwitch(config-if-range)#switchport access vlan 200 Switch(config-if-range)#exitSwitch(config)#vlan 100Switch(config-vlan)#ip add 192.168.100.1 255.255.255.0Switch(config-vlan)#ip add 192.168.10.1 255.255.255.0 Switch(config-vlan)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upSwitch(config-vlan)#exitSwitch(config)#int f0/1Switch(config-if)#no ip addSwitch(config-if)#no shutSwitch(config-if)#switchport mode trunk。