BGP 路由 - Cisco

网络工程 思科 路由 BGP
2022-03-03 09:47:59

好的,我目前遇到的问题是我有一个服务器堆栈连接到交换机。然后将交换机连接到路由器。该交换机/路由器组合已被多次使用和测试。

现在这个路由器通过一个 BGP 对等体连接到另一个路由器,然后连接到更广的区域网络,共享 200 条左右的 BGP 路由。

因此,连接到我的服务器堆栈的 R1 可以通过网络一直 ping 到它希望访问的任何地址。

但是,它后面的服务器堆栈无法 ping 出。它可以ping本地路由器接口,以及连接R1到R2的路由器接口……但奇怪的是,它无法ping通R2上的连接。因此,为了澄清它可以 ping 25.231.34.106,即 R1 g0/0,但不能 ping 25.231.34.105,即 R2 g0/0。

它也无法进一步 ping 到 WAN。这真的让我感到震惊,我确信配置是正确的。下面是一些摘录。

router bgp 65001  
 network 25.141.156.0 mask 255.255.252.0  
 neighbor 25.231.34.105 remote-as 65677  
 neighbor 25.231.34.105 filter-list 150 out

as-path access-list permit ^$

ip route 0.0.0.0 0.0.0.0 25.231.34.105  
ip route 25.141.156.0 255.255.252.0 25.141.156.6 - Note .6 is the switch vlan.

澄清一下,R1 有一个完整的 BGP 路由表,所以从 R1 到 R2 的连接很好,它只是允许我的服务器堆栈和客户端通过 R1 出去,这就是问题所在!我以前使用过这个配置并且它已经工作了,所以我正在努力看看是什么导致了这个问题。

有什么建议或指导吗?

    Current configuration : 15583 bytes

version 15.1
no service pad
service tcp-keepalives-in
service tcp-keepalives-out
service timestamps debug datetime msec
service timestamps log datetime msec localtime show-timezone
service password-encryption
no service password-recovery
!
hostname Router1
!
boot-start-marker
boot-end-marker
!
!
no logging console
!
!
!
!
!
!
aaa session-id common
clock timezone GMT 0 0
!
no ipv6 cef
no ip source-route
no ip gratuitous-arps
ip cef
!
!
!
!
!
no ip bootp server
no ip domain lookup
ip domain name example.net
multilink bundle-name authenticated
!
!
!
!
ip ssh version 2
ip scp server enable
!
!
!
!
interface Embedded-Service-Engine0/0
 no ip address
 shutdown
!
interface GigabitEthernet0/0
 no ip address
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 duplex full
 speed 100
 no mop enabled
!
interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 8.2.156.1 255.255.255.248
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 8.2.156.98 255.255.255.192
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/0.70
 encapsulation dot1Q 70
 ip address 8.2.156.9 255.255.255.248
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/0.80
 encapsulation dot1Q 80
 ip address 8.2.156.22 255.255.255.248 secondary
 ip address 8.2.156.18 255.255.255.248
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/0.210
 encapsulation dot1Q 210
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/0.301
 encapsulation dot1Q 301
 ip address 8.2.157.129 255.255.255.240
 no ip redirects
 no ip unreachables
 no ip proxy-arp
!
interface GigabitEthernet0/1
 no ip address
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip mtu 1400
 ip tcp adjust-mss 1360
 duplex auto
 speed auto
 no mop enabled
!
interface GigabitEthernet0/0/0
 no ip address
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 duplex auto
 speed auto
 no mop enabled
!
interface GigabitEthernet0/1/0
 ip address 77.5.34.106 255.255.255.252
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip tcp adjust-mss 1300
 duplex full
 speed 100
 media-type sfp
 no cdp enable
 no mop enabled
!
interface GigabitEthernet0/1/0
 ip address 77.5.34.106 255.255.255.252
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip tcp adjust-mss 1300
 duplex full
 speed 100
 media-type sfp
 no cdp enable
 no mop enabled
!
router bgp 64729
 bgp log-neighbor-changes
 network 8.2.156.0 mask 255.255.252.0
 neighbor 77.5.34.105 remote-as 64613
 neighbor 77.5.34.105 filter-list 150 out
!
ip forward-protocol nd
!
ip as-path access-list 150 permit ^$
no ip http server
ip http access-class 80
ip http authentication aaa
ip http secure-server
ip http secure-port 8443
!
ip route 0.0.0.0 0.0.0.0 77.5.34.105
ip route 8.2.156.0 255.255.252.0 8.2.156.6
ip tacacs source-interface GigabitEthernet0/0.20
!

access-list 8 permit 8.2.157.9
access-list 8 permit 8.2.157.10
access-list 8 permit 25.146.194.24
access-list 8 permit 8.2.157.128 0.0.0.15
access-list 8 deny   any log
access-list 80 permit 8.2.157.9
access-list 80 permit 8.2.157.10
access-list 80 permit 8.2.157.25
access-list 80 permit 8.2.156.130
access-list 80 permit 25.144.90.13
access-list 80 permit 25.144.90.12
access-list 80 permit 25.144.90.51
access-list 80 permit 25.144.90.50
access-list 80 permit 25.144.85.32 0.0.0.31
access-list 80 permit 25.144.101.32 0.0.0.31
access-list 80 permit 25.144.92.32 0.0.0.31
access-list 80 permit 25.149.202.128 0.0.0.127
access-list 80 permit 25.144.108.32 0.0.0.31
access-list 80 permit 25.149.181.128 0.0.0.127
access-list 80 deny   any log
access-list 110 permit tcp host 8.2.157.9 any eq 22
access-list 110 permit tcp host 8.2.157.10 any eq 22
access-list 110 permit tcp host 8.2.157.25 any eq 22
access-list 110 permit tcp host 8.2.156.130 any eq 22
access-list 110 permit tcp 8.2.157.128 0.0.0.15 any eq 22
access-list 110 permit tcp host 25.146.194.24 any eq 22
access-list 110 permit tcp 25.144.85.32 0.0.0.31 any eq 22
access-list 110 permit tcp 25.144.101.32 0.0.0.31 any eq 22
access-list 110 permit tcp 25.144.92.32 0.0.0.31 any eq 22
access-list 110 permit tcp 25.149.202.128 0.0.0.127 any eq 22
access-list 110 permit tcp 25.144.108.32 0.0.0.31 any eq 22
access-list 110 permit tcp 25.149.181.128 0.0.0.127 any eq 22
access-list 110 permit tcp host 25.144.90.12 any eq 22
access-list 110 permit tcp host 25.144.90.13 any eq 22
access-list 110 permit tcp host 25.144.90.50 any eq 22
access-list 110 permit tcp host 25.144.90.51 any eq 22
access-list 110 deny   ip any any log

BGP故障

1个回答

你有一些真正的问题,这似乎源于对 BGP 工作原理的误解。在 BGP 中放置网络语句并不能保证前缀将被通告给邻居。在 BGP 通告它之前,本地路由表中必须存在确切的网络。看起来您正在尝试宣传聚合地址而没有正确执行。如果使用聚合地址命令,则路由表中只需要存在聚合地址所包含的网络之一。

您有到 SW1 的第 2 层连接,因此对于与 SW1 不在同一网络上的网络,您不能简单地将路由指向 SW1 的管理地址。SW1 需要是第 3 层交换机,然后您将在 R1 和 SW1 之间只有一条路由链路。您还需要在 SW1 上具有静态默认路由或在它们之间运行路由协议。

您不应该对任何直接连接的网络使用静态路由。这可能会混淆路由器。此外,您不能让网络的下一跳位于您正在为其建立路由的网络上。这是行不通的,也没有任何意义。您应该删除静态路由:

no ip route 25.141.156.0 255.255.252.0 25.141.156.6

您有多个通往 SW1 的网络接口作为 VLAN。这些路由将存在于您的本地路由表中。

interface FastEthernet0/1
 ip address 25.141.156.1 255.255.255.224
 duplex auto
 speed auto
!
interface FastEthernet0/1.10
 encapsulation dot1Q 10
 ip address 25.141.156.98 255.255.255.224
!
interface FastEthernet0/1.20
 encapsulation dot1Q 20
 ip address 25.141.157.1 255.255.255.240
!
interface FastEthernet0/1.30
 encapsulation dot1Q 30
 ip address 25.141.157.140 255.255.255.192
!

您可以在 BGP 路由器配置中使用单独的网络语句:

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 25.141.156.0 mask 255.255.255.224
 network 25.141.156.96 mask 255.255.252.224
 network 25.141.157.0 mask 255.255.252.240
 network 25.141.157.128 mask 255.255.252.192
 neighbor 25.231.34.105 remote-as 65002
 neighbor 25.231.34.105 filter-list 150 out
 no auto-summary
!

您可以redistribute connected在 BGP 路由器配置中使用以下语句:

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 redistribute connected
 neighbor 25.231.34.105 remote-as 65002
 neighbor 25.231.34.105 filter-list 150 out
 no auto-summary
!

如果你被绑定并确定只有一个网络语句,那么你需要使用aggregate-address命令:

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 aggregate-address 25.141.156.0 255.255.252.0
 neighbor 25.231.34.105 remote-as 65002
 neighbor 25.231.34.105 filter-list 150 out
 no auto-summary
!

如果您希望它只宣传单个前缀,请使用以下summary-only选项:

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 aggregate-address 25.141.156.0 255.255.252.0 summary-only
 neighbor 25.231.34.105 remote-as 65002
 neighbor 25.231.34.105 filter-list 150 out
 no auto-summary
!

在进行这些更改时,您确实需要访问 R2 以查看路由表是什么。就目前而言,我不相信 R2 有返回 R1 另一侧网络的路由,因此您从这些网络发出的 ping应该无法发送到 R2。