我们以R1为例,首先我们要进入配置模式,这就像是我们进入了R1的控制室,开始调整它的设置。然后我们进入了接口配置模式,就像我们深入到R1的内部,对每一个网络接口进行设置。我们为R1的每个接口分配了ip地址,设置了状态,就像是为每一条道路标上了起点和终点,指示了交通规则。
然后,我们查看了R1的接口IP配置,这就像是我们检查了每一条道路的通行情况,确保没有堵塞,所有道路都能正常通行。我们也查看了R1的路由表,这就像是我们看到了整个城市的交通图,了解哪些道路是畅通的,哪些道路是拥堵的。
接下来,我们对R2和R3进行了类似的配置。我们为它们分配了IP地址,设置了状态,并查看了它们的接口IP和路由表。这样,我们就像是在城市的不同区域都设置了交通指挥中心,确保整个城市的交通都能顺畅。
最后,我们配置了两个虚拟的PC(vpc4和vpc5),它们就像是城市的两个居民点。我们为它们分配了IP地址,并设置了网关。然后,我们在vpc4上ping了vpc5,这就像是从一个居民点向另一个居民点发送了信息,以测试网络的连通性。结果显示,vpc4能够成功ping通vpc5,这表明我们的网络配置是成功的,就像是我们成功地建立了一个畅通无阻的交通网络。
总的来说,网络配置就像是城市的交通规划,我们需要设置好每个节点的规则,确保整个网络都能顺畅运行。通过这次的配置,我们成功地实现了网络设备的互联,保证了数据包能够准确无误地从源头传送到目的地。
实验拓扑
配置R1
Router(config) R1(config) R1(config-if) R1(config-if) R1(config-if) R1(config-if) R1(config-if) R1(config) R1(config)
查看接口ip
R1 Interface IP-Address OK? Method Status Protocol Ethernet0/0 192.168.12.1 YES manual up up Ethernet0/1 192.168.1.254 YES manual up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down
查看R1路由表
R1 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 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.1.0/24 is directly connected, Ethernet0/1 L 192.168.1.254/32 is directly connected, Ethernet0/1 S 192.168.3.0/24 [1/0] via 192.168.12.2 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.12.0/24 is directly connected, Ethernet0/0 L 192.168.12.1/32 is directly connected, Ethernet0/0 S 192.168.23.0/24 [1/0] via 192.168.12.2
配置R2
Router>enable router Router(config) R2(config) R2(config-if) R2(config-if) R2(config-if) R2(config-if) R2(config-if) R2(config) R2(config)
查看接口ip
R2 Interface IP-Address OK? Method Status Protocol Ethernet0/0 192.168.12.2 YES manual up up Ethernet0/1 192.168.23.2 YES manual up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down
查看路由
R2 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 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set S 192.168.1.0/24 [1/0] via 192.168.12.1 S 192.168.3.0/24 [1/0] via 192.168.23.3 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.12.0/24 is directly connected, Ethernet0/0 L 192.168.12.2/32 is directly connected, Ethernet0/0 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.23.0/24 is directly connected, Ethernet0/1 L 192.168.23.2/32 is directly connected, Ethernet0/1
配置R3
Router>enable Router Router(config) R3(config) R3(config) R3(config-if) R3(config-if) R3(config-if) R3(config-if) R3(config-if) R3(config) R3(config)
查看接口ip
R3 Interface IP-Address OK? Method Status Protocol Ethernet0/0 192.168.23.3 YES manual up up Ethernet0/1 192.168.3.254 YES manual up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down
查看路由
R3 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 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set S 192.168.1.0/24 [1/0] via 192.168.23.2 192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.3.0/24 is directly connected, Ethernet0/1 L 192.168.3.254/32 is directly connected, Ethernet0/1 S 192.168.12.0/24 [1/0] via 192.168.23.2 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.23.0/24 is directly connected, Ethernet0/0 L 192.168.23.3/32 is directly connected, Ethernet0/0
配置vpc4
VPCS> ip 192.168.1.2/24 192.168.1.254 Checking for duplicate address... VPCS : 192.168.1.2 255.255.255.0 gateway 192.168.1.254
配置vpc5
VPCS> ip 192.168.3.2/24 192.168.3.254 Checking for duplicate address... VPCS : 192.168.3.2 255.255.255.0 gateway 192.168.3.254
在vpc4上ping vpc5测试连通性
VPCS> ping 192.168.3.2 84 Bytes from 192.168.3.2 icmp_seq=1 ttl=61 time=0.958 ms 84 bytes from 192.168.3.2 icmp_seq=2 ttl=61 time=0.785 ms 84 bytes from 192.168.3.2 icmp_seq=3 ttl=61 time=1.050 ms 84 bytes from 192.168.3.2 icmp_seq=4 ttl=61 time=0.823 ms 84 bytes from 192.168.3.2 icmp_seq=5 ttl=61 time=0.827 ms
审核编辑:汤梓红