路由器的路由问题

网络工程 思科 路由 路由器 思科-ios
2022-03-03 06:31:49

我用 3 台路由器、3 台交换机和 6 台计算机创建了网络

下面是配置,

R1-> serial2/0= 192.168.1.1/30, Fastethernet 0/0= 192.168.1.9/29

R2->serial2/0= 192.168.1.2/30, serial3/0= 192.168.1.5/30, Fastethernet 0/0= 192.168.1.17/28

R3->serial2/0= 192.168.1.6/30 Fastethernet 0/0= 192.168.1.33/28

PC IP's are dhcp

PC1 Ping 如下,

Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=2ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 2ms, Average = 0ms

但是 Ping 到下一个路由器 R2 没有从 PC 1 ping

PC>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

请帮忙

在此处输入图像描述

3个回答

我相信这是因为 R1 没有网络 192.168.1.8/29 的路由(您有 R0 的 f0/0 接口 PC0 和 PC1)。因此,R1 不知道将流量从何处返回给 PC1。

PC1 的 IP 为 192.168.1.11,默认网关为 192.168.1.9。它可以 ping 192.168.1.1,因为这个 IP 在 R0 上,并且 R0 知道从哪里返回流量到 PC1(f0/0 直连网络)。

只需在 R1 上添加以下静态路由并重试:

ip route 192.168.1.8 255.255.255.248 192.168.1.1

R1可能没有到 的路由,192.168.1.9/29R0可能没有返回到 的路由192.168.1.17/28

默认情况下,路由器会将连接的路由添加到其路由表中。这意味着R1将知道如何到达192.168.1.0/30192.168.1.4/30192.168.1.16/28

如果没有RIPOSPFEIGRPBGP等动态路由协议,路由器将不会与其他路由器动态共享或学习其路由路由器也可以配置为静态安装路由。一个常见的例子是默认路由或“全零”路由。

一种解决方案是跨R0R1运行动态路由协议。另一种解决方案是在R0R1上手动配置静态路由

静态路由

!R0
ip route 192.168.1.16 255.255.255.240 192.168.1.2

!R1
ip route 192.168.1.8 255.255.255.248 192.168.1.1

为了确保三个网络之间的通信。确保正确和正确的路由到位..

路由器0

Router0(config)#ip route 192.168.1.16 subnet mask 255.255 .240.0 pointing towards gateway 192.168.1.2

Router0(config)#ip route 192.168.1.32 subnetmask 255.255.248.0 pointing towards gateway 192.168.1.2

在路由器 1

Router1(config)#ip route 192.168.1.255.255.248.0pointing towards gateway 192.168 .1.1

Router1(config)#ip route 192.168.1.32 subnetmask255.255 .240.0 pointing towards gateway 192.168.1.6

在路由器 2 中

Router2(config)#ip route 192.168.1.0 255.255.248.0 pointing towards gateway 192.168.1.5

Router2(config)#ip route 192.168.1.16 subnetmask 255.255.240.0 pointing towards gateway 192 .168.1.5