CCNA 静态路由 - 路由器无法相互 ping 通

网络工程 思科 路由 实验室
2021-07-24 20:17:57

我有以下拓扑结构: 拓扑 SW1 和 SW2 启用了 ip 路由。两者都能够 ping 回环地址:2.2.2.2 和 2.2.2.3

show ip route 的输出是:

SW1>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

     2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S       2.2.2.3/32 [1/0] via 192.168.100.2
S       2.2.2.0/24 [1/0] via 192.168.100.20
C    192.168.200.0/24 is directly connected, Vlan200
C    192.168.100.0/24 is directly connected, Vlan1

SW2>show ip route
Codes: 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, 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

Gateway of last resort is not set

     2.0.0.0/32 is subnetted, 2 subnets
S       2.2.2.3 [1/0] via 192.168.100.30
S       2.2.2.0 [1/0] via 192.168.100.1
S    192.168.200.0/24 [1/0] via 192.168.100.1
C    192.168.100.0/24 is directly connected, Vlan1

路由器将其直接连接的交换机作为默认网关

显示运行的输出是:

R2#show run
Building configuration...

Current configuration : 865 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$maRc$UwddG0WVyNyDcklve0f5v1
enable password 7 110A1016141D5A
!
no aaa new-model
ip subnet-zero
no ip routing
!
!
!
no ip cef
!         
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.100.20 255.255.255.0
 no ip route-cache
 speed auto
 full-duplex
 no mop enabled
!
interface BRI0/0
 no ip address
 encapsulation hdlc
 no ip route-cache
 shutdown
!
interface FastEthernet0/1
 no ip address
 no ip route-cache
 shutdown
 duplex auto
 speed auto
!
ip default-gateway 192.168.100.1
ip http server
ip classless
!
!
!
!
!         
!
!
!
line con 0
line aux 0
line vty 0 4
 password 7 070C285F4D06
 login
!
!
end

R3:

R3#show run
Building configuration...

Current configuration : 727 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
hostname R3
!
enable secret 5 $1$xOJl$oNJ4x6DoBuCeLk8T8Jr5q/
enable password 7 110A1016141D5A
!
ip subnet-zero
no ip routing
!
!
!
call rsvp-sync
!
!
!
!
!         
!
!
!
interface Loopback1
 ip address 2.2.2.3 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.100.30 255.255.255.0
 no ip route-cache
 no ip mroute-cache
 speed auto
 full-duplex
!
interface Serial0/0
 no ip address
 no ip route-cache
 no ip mroute-cache
 shutdown
 no fair-queue
!
ip default-gateway 192.168.100.2
ip classless
ip http server
!
!
dial-peer cor custom
!
!
!
!
line con 0
line aux 0
line vty 0 4
 password 7 1511021F0725
 login
!
end

为什么我无法从 R2 ping 2.2.2.3,也不能从 R3 ping 2.2.2.2?非常感谢你的帮助!

2个回答

您在路由器中没有路由(静态的或使用路由协议的)来到达其他路由器的环回地址。

路由器不应该有默认网关(这是菜鸟的错误),无论如何,交换机不能是网关,因为它们是第 2 层设备。您可以在路由器之间放置静态默认路由、静态特定路由或运行路由协议以共享路由。

您确定两台交换机都在转发 IP 数据包吗?

通常路由器都启用了“IP 路由”。

检查所有设备的“ip routing”和“ip cef”:

sh 运行 | ip路由

sh 运行 | ip cef