Ping Vrf 环回接口

网络工程 思科-ios 虚拟现实
2022-02-11 06:39:09

我正在做一个实验室,它非常简单。就像我需要确认一些命令,但我真的很不高兴。

这是我的实验室。我配置了一个 vrf 和一个环回接口,我在 vrf 下应用它。环回已从全局表中消失,并已插入到 vrf 表中。所以我添加了一个静态路由,以便能够从全局表中 ping 接口。现在我可以在全局表中看到作为静态插入的环回接口,但我无法 ping。

我觉得缺少一些愚蠢的东西,因为一切似乎都很好,而且应该可以工作。我的路由器配置的输出如下所示:

ip vrf HQ
 rd 30:50

!
!
!
!
!
!
!

interface Loopback1
 ip vrf forwarding HQ
 ip address 1.1.1.1 255.255.255.255
!

ip classless
ip route 1.1.1.1 255.255.255.255 Loopback1
no ip http server
no ip http secure-server
!
!
!
!


R2#sh ip ro
R2#sh 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

     1.0.0.0/32 is subnetted, 1 subnets
S       1.1.1.1 is directly connected, Loopback1



R2#sh ip ro
R2#sh ip route vrf HQ

Routing Table: HQ
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

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
R2#

注意:我可以traceroute接口的ip

2个回答

您需要的是从 VRF 到全局路由表的路由泄漏(您已经做过)以及从全局路由表到 VRF 的路由泄漏。

我假设您的网络图很简单,如下所示

在此处输入图像描述

在 R2 上,您已经拥有ip route 1.1.1.1 255.255.255.255 Loopback1.

现在您将需要另一个静态 VRF 路由来将路由 10.0.0.0/24 泄漏到 VRF 总部:

  ip route vrf HQ 10.0.0.0 255.255.255.0 10.0.0.1 global

R2 上的验证:

R2#show run | i route
ip route 1.1.1.1 255.255.255.255 Loopback1
ip route vrf HQ 10.0.0.0 255.255.255.0 10.0.0.1 global


R2#show ip route | beg Gateway
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
S       1.1.1.1 is directly connected, Loopback1
     10.0.0.0/24 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet0/0


R2#show ip route vrf HQ | beg Gateway
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
     10.0.0.0/24 is subnetted, 1 subnets
S       10.0.0.0 [1/0] via 10.0.0.1


R2#ping 1.1.1.1 source 10.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.0.0.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/70/72 ms

R1 上的验证:

R1#show run | i route
ip route 1.1.1.1 255.255.255.255 10.0.0.2


R1#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/36/64 ms

我希望它对您有所帮助并回答您的问题。

您不需要静态路由,只需在 vrf 内 ping 即可,如下所示:

ping vrf vrfname ip