我不能设置最后的网关

网络工程 思科 路由 路由器 思科-ios cisco 命令
2021-07-21 03:07:11

我似乎无法在路由器上设置最后的网关。我希望它通过执行以下操作将任何 IP 地址不在路由表中的内容通过接口 s0/0/0 转发到路由器总部:

Branch1#config t
Branch1(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0

当我检查路由表时,它没有出现在那里...

Branch1#sh 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
     192.168.7.0/24 is variably subnetted, 8 subnets, 4 masks
C       192.168.7.64/27 is directly connected, GigabitEthernet0/0.107
L       192.168.7.94/32 is directly connected, GigabitEthernet0/0.107
C       192.168.7.144/28 is directly connected, GigabitEthernet0/0.37
L       192.168.7.158/32 is directly connected, GigabitEthernet0/0.37
C       192.168.7.160/28 is directly connected, GigabitEthernet0/0.157
L       192.168.7.174/32 is directly connected, GigabitEthernet0/0.157
C       192.168.7.244/30 is directly connected, Serial0/0/1
L       192.168.7.245/32 is directly connected, Serial0/0/1

虽然它确实出现在运行配置中

    ip classless 
    ip route 0.0.0.0 0.0.0.0 Serial0/0/0

ip接口简介:

    Branch1#sh ip interface br
    Interface              IP-Address      OK? Method Status                Protocol 
    GigabitEthernet0/0     unassigned      YES unset  up                    up 
    GigabitEthernet0/0.37  192.168.7.158   YES manual up                    up 
    GigabitEthernet0/0.107 192.168.7.94    YES manual up                    up 
    GigabitEthernet0/0.157 192.168.7.174   YES manual up                    up 
    GigabitEthernet0/1     unassigned      YES unset  administratively down down 
    Serial0/0/0            unassigned      YES unset  up                    up 
    Serial0/0/1            192.168.7.245   YES manual up                    up 
    Serial0/1/0            unassigned      YES unset  administratively down down 
    Serial0/1/1            unassigned      YES unset  administratively down down 
    Vlan1                  unassigned      YES unset  administratively down down
2个回答

问题将是接口关闭。当一个接口出现故障时,所有指向该接口的路由都会从路由表中删除,但当接口恢复时它们会重新出现。

我遇到了同样的问题。就我而言,其中一个接口已关闭。我已经激活它,它解决了这个问题。

步骤1:

最初,检查您的路由表

如果您是启用模式,请使用

show ip interface brief

如果您处于配置模式,请使用

do show ip int bri (这里加)

第2步:

检查网络的拓扑结构并相应地设置 IP 地址。

  1. 接口(接口名称)

int g0/2 (接口为 gi 0/2)

  1. 设置ip地址

ip address 192.168.5.0 255.255.255.0

注意:使用与您的拓扑相关的 ip 地址、接口