diff --git "a/20 \345\224\220\345\256\207\345\247\227/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" "b/20 \345\224\220\345\256\207\345\247\227/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..8857eb85a2edf60c00353a5e841ac9fc509116c5 --- /dev/null +++ "b/20 \345\224\220\345\256\207\345\247\227/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" @@ -0,0 +1,635 @@ +# 笔记 + +#### 第一题 + +路由器1 + +```cmd +Router>en +Router# +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.10.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.10.1 255.255.255.0 +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up +end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.10.0 is directly connected, FastEthernet0/1 +C 192.168.10.0/24 is directly connected, FastEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#net +Router(config-router)#network 10.10.10.0 +Router(config-router)#network 192.168.10.0 +Router(config-router)# +``` + +路由器2 + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# +Router(config)#conf t +%Invalid hex value +Router(config)#int +Router(config)#interface 10.10.10.2 255.255.255.0 + ^ +% Invalid input detected at '^' marker. + +Router(config)#interfac +Router(config)#interface f0/0 +Router(config-if)#ip ad 10.10.10.2 255.255.255.0 +Router(config-if)#ip ad 10.10.10.2 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.20.1 255.255.255.0 +Router(config-if)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.10.0 is directly connected, FastEthernet0/0 +C 10.10.20.0 is directly connected, FastEthernet0/1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rout +Router(config)#router rip +Router(config-router)#ve +Router(config-router)#version 2 +Router(config-router)#net +Router(config-router)#network 10.10.10.0 +Router(config-router)#network 10.10.20.0 +Router(config-router)# + + + + + + + + +Router con0 is now available +``` + +路由器3 + +```cmd +Router>en +Router#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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.20.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#network 10.10.20.0 +Router(config-router)#network 192.168.20.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 2 subnets +R 10.10.10.0 [120/1] via 10.10.20.1, 00:00:05, FastEthernet0/0 +C 10.10.20.0 is directly connected, FastEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.20.1, 00:00:05, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1 + +Router# +``` + +##### 测试结果 + +![image-20250418173638065](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968998.png) + + + +#### 第三题 + +![image-20250418173546761](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968951.png) + +三层交换机 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#route rip +Switch(config-router)#ver +Switch(config-router)#version 2 +Switch(config-router)#net +Switch(config-router)#network 192.168.10.0 +Switch(config-router)#network 192.168.40.0 +Switch(config-router)#network 10.10.1.0 + +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#ip routing +Switch(config)#route rip +Switch(config-router)#version 2 +Switch(config-router)#network 10.10.1.0 +Switch(config-router)#network 192.168.40.0 +Switch(config-router)#network 192.168.10.0 +Switch(config-router)#ex^Z +Switch# +%SYS-5-CONFIG_I: Configured from console by console + +Switch#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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/2 +R 10.10.2.0 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 +C 192.168.10.0/24 is directly connected, Vlan10 +R 192.168.20.0/24 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 +R 192.168.30.0/24 [120/2] via 10.10.1.2, 00:00:20, FastEthernet0/2 +C 192.168.40.0/24 is directly connected, Vlan20 +R 192.168.50.0/24 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 + +Switch# + + +``` + +中间那台路由器 + +```cmd +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#interface f0/1 +Router(config-if)#no shutdown + +Router(config-if)#en +% Ambiguous command: "en" +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)#ex +Router(config)#no interface f0/0.1 +Router(config)# interface f0/1.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/1.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.1, changed state to up +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#ex +Router(config)# interface f0/1.2 +Router(config-subif)# +%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 +encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.50.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.1.2 255.255.255.0 +Router(config-if)#ex +Router(config)#int +Router(config)#interface f1/0 +Router(config-if)#no shu + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.2.1 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown +Router(config-if)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.1.0 +Router(config-router)#network 192.168.20.0 +Router(config-router)#network 192.168.50.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up +end +Translating "end"...domain server (255.255.255.255) % Name lookup aborted +Router#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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 10.10.2.0 is directly connected, FastEthernet1/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +R 192.168.30.0/24 [120/1] via 10.10.2.2, 00:00:24, FastEthernet1/0 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.2.0 +Router(config-router)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 10.10.2.0 is directly connected, FastEthernet1/0 +R 192.168.10.0/24 [120/1] via 10.10.1.1, 00:00:21, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +R 192.168.30.0/24 [120/1] via 10.10.2.2, 00:00:05, FastEthernet1/0 +R 192.168.40.0/24 [120/1] via 10.10.1.1, 00:00:21, FastEthernet0/0 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router# + +``` + +右边 + +```cmd +Router(config-if)#ex +Router(config)#int +Router(config)#interface g0/0.1 +Router(config-subif)#en +Router(config-subif)#encapsulation fo +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.30.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface g0/0 /错了 + +Router(config-if)#no shut +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up + +%LINK-5-CHANGED: Interface GigabitEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.2.2 255.255.255.0 +Router(config-if)#ex +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console +s +% Ambiguous command: "s" +Router# +Router#show ip route +Codes: L - local, 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, 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 + + 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.2.0 +Router(config-router)#network 192.168.30.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: L - local, 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, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 + +Router#show ip route +Codes: L - local, 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, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console +Router#show ip route +Codes: L - local, 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, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.40.0/24 [120/2] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#no in +Router(config)#no interface g0/0.1 /这里才对 +Router(config)# +%LINK-3-UPDOWN: Interface GigabitEthernet0/0.1, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.1, changed state to down + +Router(config)#int g0/1 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.30.254 255.255.255.0 +Router(config-if)#exit +Router(config)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: L - local, 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, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/1 +R 192.168.40.0/24 [120/2] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 + +Router# + +``` + +二层交换机 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#int +Switch(config)#interface f0/2 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +% Access VLAN does not exist. Creating vlan 10 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 20 +% Access VLAN does not exist. Creating vlan 20 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/1 +Switch(config-if)#sw +Switch(config-if)#switchport m +Switch(config-if)#switchport mode +% Incomplete command. +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk +``` + +#### 测试 + +![image-20250418173613395](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968973.png) \ No newline at end of file