Cisco 3725:为什么默认网关没有出现在“show ip route”上

网络工程 思科
2021-07-07 23:34:06

我的网络拓扑如下

在此处输入图片说明

从 R1,我无法 ping R3。

R3 上的数据包捕获显示收到回显请求,但没有来自 R3 的回复。

在此处输入图片说明

事实证明,show ip route即使我已经放置了配置,然后没有出现默认网关wr mem

这有什么问题?

如何解决?

R1

R1#sh run | i ga
ip default-gateway 192.168.10.2
R1#
R1#show ip route
Default gateway is 192.168.10.2

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
R1#

R3

R3#sh run | i ga
ip default-gateway 10.10.10.2
R3#
R3#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
       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

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
R3#

显示运行配置 R1

R1#sh run
Building configuration...

Current configuration : 1003 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip routing
no ip icmp rate-limit unreachable
no ip cef
!
no ip domain lookup
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface FastEthernet0/0
 ip address 192.168.10.1 255.255.255.0
 no ip route-cache
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 no ip route-cache
 shutdown
 duplex auto
 speed auto
!
ip default-gateway 192.168.10.2
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
control-plane
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
end

R1#

显示运行配置 R2

R2#show running-config
Building configuration...

Current configuration : 1130 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
no ip domain lookup
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface FastEthernet0/0
 ip address 10.10.10.2 255.255.255.0
 ip nat outside
 ip virtual-reassembly
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.10.2 255.255.255.0
 ip nat inside
 ip virtual-reassembly
 duplex auto
 speed auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
ip nat inside source list NAT interface FastEthernet0/0 overload
!
ip access-list standard NAT
 permit 192.168.0.0 0.0.0.255
!
no cdp log mismatch duplex
!
control-plane
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
end

R2#

显示运行配置 R3

R3#sh run
Building configuration...

Current configuration : 944 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
no ip domain lookup
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface FastEthernet0/0
 ip address 10.10.10.3 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
ip default-gateway 10.10.10.2
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
control-plane
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
end

R3#

如果您需要更多信息,请告诉我。

3个回答

仅当 Cisco 路由器上禁用 IP 路由时才应使用 IP 默认网关。例如,如果路由器是 IP 世界中的主机,则可以使用此命令为其定义默认网关。当您的低端 Cisco 路由器处于引导模式时,您也可以使用此命令,以便将 Cisco IOS 软件映像通过 TFTP 传输到路由器。在引导模式下,路由器没有启用 IP 路由。

通常需要 IP 路由,还有其他实现目标的方法:

IP 默认网络

与 ip default-gateway 命令不同,当 Cisco 路由器上启用了 ip 路由时,您可以使用 ip default-network。当您配置 ip default-network 时,路由器会将到该网络的路由视为路由器上最后的网关进行安装。

对于每个配置了 ip default-network 的网络,如果路由器有到该网络的路由,则该路由将被标记为候选默认路由。

IP 路由 0.0.0.0 0.0.0.0

创建到网络 0.0.0.0 0.0.0.0 的静态路由是另一种在路由器上设置最后选择网关的方法。与 ip default-network 命令一样,使用到 0.0.0.0 的静态路由不依赖于任何路由协议。但是,必须在路由器上启用 ip 路由。

概括

在 Cisco 路由器上禁用 ip 路由时,请使用 ip default-gateway 命令。使用 ip default-network 和 ip route 0.0.0.0 0.0.0.0 命令在启用了 ip 路由的 Cisco 路由器上设置最后的网关。路由协议传播默认路由信息的方式因协议而异。

Cisco 使用 IP 命令配置最后的网关:

https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/16448-default.html

您不应该ip default-gateway在充当路由器的路由器上使用这些命令(ip routing已启用),并且该ip default-network命令实际上是针对 IGRP 的,它不理解默认路由;您可以使用静态默认路由。

Cisco 有一份解释差异的文档:使用 IP 命令配置最后的网关

概括

在 Cisco 路由器上禁用ip 路由时,请使用ip default-gateway命令使用ip default-networkip route 0.0.0.0 0.0.0.0命令在启用了ip 路由的Cisco 路由器上设置最后的网关路由协议传播默认路由信息的方式因协议而异。

我认为您需要配置 IGP(RIP、OSPF、IS-IS 等),因为这些路由器位于不同的子网中。不需要默认网关。