没有接口IP地址的Ping环回

网络工程 思科 路由器 IP地址 界面 环回
2021-07-27 05:36:15

我有两个直接连接的路由器,它们都有环回地址。接口没有IP地址,我只是将R1 g0/0连接到R5 g0/0。如果我将 IP 地址放在两个路由器的 g0/0 接口上,那么我可以在环回地址之间进行 ping 操作,但是如果我从 g0/0 中删除了 IP 地址,则无法进行 ping 操作。环回是否需要有IP地址的接口才能互相ping通? 图片

R1的sh ip路由

    Gateway of last resort is not set

         10.0.0.0/32 is subnetted, 1 subnets
 C       10.1.1.1/32 is directly connected, Loopback1

R5的sh ip路由

      Gateway of last resort is not set

         10.0.0.0/32 is subnetted, 1 subnets
 C       10.1.1.5/32 is directly connected, Loopback5

运行

       version 15.1
       no service timestamps log datetime msec
       no service timestamps debug datetime msec
       no service password-encryption
       !
       hostname R5
       !
       ip cef
       no ipv6 cef
       !
       license udi pid CISCO2911/K9 sn FTX15246RHB
       !
       spanning-tree mode pvst
       !
       interface Loopback5
        ip address 10.1.1.5 255.255.255.255
       !
       interface GigabitEthernet0/0
        no ip address
        duplex auto
        speed auto
       !
       interface GigabitEthernet0/1
        no ip address
        duplex auto
        speed auto
        shutdown
       !
       interface GigabitEthernet0/2
        no ip address
        duplex auto
        speed auto
        shutdown
       !
       interface Vlan1
        no ip address
        shutdown
       !
       ip classless
       ip route 10.1.1.1 255.255.255.255 GigabitEthernet0/0 
       !
       ip flow-export version 9
       !
       line con 0
       !
       line aux 0
       !
       line vty 0 4
        login
       !
       end
2个回答

在点对点链路上,您并不总是需要路由器接口上的 IP 地址,但您必须使用以下ip unnumbered命令将此事实告知路由器

环境

interface GigabitEthernet0/0
   ip unnumbered loopback 5

将借用环回 5 IP 地址在 GigabitEthernet0/0 接口上使用它作为邻居路由器的下一跳。在两个路由器上都这样做将允许您互相 ping 回环地址(并运行路由协议)。

此 Cisco 页面上的更多信息

interface GigabitEthernet0/0
 no ip address

意味着该接口不会被考虑用于任何 IP 协议活动(即发送和接收 IP 数据包)