在 BGP 中设置本地首选项

网络工程 路由 bgp
2021-08-02 02:37:26

我正在尝试为此配置设置本地首选项

在此处输入图片说明

通过 R3 建立从 R1 到 R4 的路由。这就是我配置 R3 的方式

R3#conf term
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#route-ma
R3(config)#route-map
% Incomplete command.

R3(config)#route-map bakatele permit 12
R3(config-route-map)#set local-preference 213
R3(config-route-map)#exit
R3(config)#exit
R3#
*Mar  1 05:28:42.506: %SYS-5-CONFIG_I: Configured from console by console
R3#conf ter
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#router bgp 230
R3(config-router)#neighbor 10.0.34.2 route-map bakatele in
R3(config-router)#exit
R3(config)#exit
R3#conf term

之后,我获得了本地首选项设置:

R3#show ip bgp
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i192.168.11.0     10.0.12.1                0    100      0 100 i
*  192.168.41.0     10.0.35.2                              0 500 400 i
*>                  10.0.34.2                0    213      0 400 i
* i                 10.0.24.2                0    100      0 400 i
*  192.168.51.0     10.0.35.2                0             0 500 i
*>                  10.0.34.2                     213      0 400 500 i
* i                 10.0.24.2                0    100      0 400 500 i

但是在检查 trace-route 命令之后似乎没有任何改变,因为在设置首选项之前和之后,trace-route 看起来完全一样:

R1#traceroute 192.168.41.1 source 192.168.11.1

Type escape sequence to abort.
Tracing the route to 192.168.41.1

  1 10.0.12.2 12 msec 12 msec 24 msec
  2 10.0.24.2 60 msec 28 msec 36 msec

路由器 1:

R1#show running-config
Building configuration...

Current configuration : 1325 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 icmp rate-limit unreachable
ip cef
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
 ip address 192.168.11.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.0.12.1 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 192.168.11.0
 neighbor 10.0.12.2 remote-as 230
 neighbor 10.0.12.2 update-source FastEthernet0/0
 no auto-summary
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
control-plane
!
banner motd ^C 2018-12-13 16:00:45 gMEZtcIf5EbHO75rQ3yVJYEW7chKAfPI ^C
!
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

路由器 2:

R2#show running-config
Building configuration...

Current configuration : 1780 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
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
!
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface Loopback1
 no ip address
 shutdown
!
interface FastEthernet0/0
 ip address 10.0.12.2 255.255.255.252
 duplex auto
 speed auto
!
interface Serial0/0
 no ip address
 shutdown
 clock rate 2000000
!
interface FastEthernet0/1
 ip address 10.0.24.1 255.255.255.252
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.0.23.1 255.255.255.252
 clock rate 2000000
!
router ospf 1
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 1
 network 10.0.23.0 0.0.0.3 area 1
!
router bgp 230
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 230
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 route-map bakatele in
 neighbor 10.0.12.1 remote-as 100
 neighbor 10.0.12.1 update-source FastEthernet0/0
 neighbor 10.0.24.2 remote-as 400
 neighbor 10.0.24.2 update-source FastEthernet0/1
 no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
control-plane
!
banner motd ^C 2018-12-13 16:00:45 ischKmPlaiSYFJOgOutRt7N5Ub3fCG4y ^C
!
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

路由器3:

R3#show running-config
Building configuration...

Current configuration : 1882 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
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.34.1 255.255.255.252
 duplex auto
 speed auto
!
interface Serial0/0
 no ip address
 shutdown
 clock rate 2000000
!
interface FastEthernet0/1
 ip address 10.0.35.1 255.255.255.252
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.0.23.2 255.255.255.252
 clock rate 2000000
!
router ospf 1
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 1
 network 10.0.23.0 0.0.0.3 area 1
!
router bgp 230
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 230
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 10.0.34.2 remote-as 400
 neighbor 10.0.34.2 update-source FastEthernet0/0
 neighbor 10.0.34.2 route-map bakatele in
 neighbor 10.0.35.2 remote-as 500
 neighbor 10.0.35.2 update-source FastEthernet0/1
 no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
route-map bakatele permit 12
 set local-preference 213
!
control-plane
!
banner motd ^C 2018-12-13 16:00:45 geN8EtGYiItCbAXA7DWB1qGLpc3bc268 ^C
!
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

路由器4:

R4#show running-config
Building configuration...

Current configuration : 1596 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
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
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
 ip address 192.168.41.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.0.34.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.0.24.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 10.0.45.1 255.255.255.252
 speed 100
 full-duplex
!
router bgp 400
 no synchronization
 bgp log-neighbor-changes
 network 192.168.41.0
 neighbor 10.0.24.1 remote-as 230
 neighbor 10.0.24.1 update-source FastEthernet0/1
 neighbor 10.0.34.1 remote-as 230
 neighbor 10.0.34.1 update-source FastEthernet0/0
 neighbor 10.0.45.2 remote-as 500
 neighbor 10.0.45.2 update-source FastEthernet1/0
 no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
control-plane
!
banner motd ^C 2018-12-13 16:00:45 KmdbwQMyWblS6qmtj5RKxbgkR4WXDKMf ^C
!
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

路由器5:

R5#show running-config
Building configuration...

Current configuration : 1421 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
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
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
!
ip tcp synwait-time 5
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.255
!
interface Loopback1
 ip address 192.168.51.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.0.45.2 255.255.255.252
 speed 100
 full-duplex
!
interface FastEthernet0/1
 ip address 10.0.35.2 255.255.255.252
 duplex auto
 speed auto
!
router bgp 500
 no synchronization
 bgp log-neighbor-changes
 network 192.168.51.0
 neighbor 10.0.35.1 remote-as 230
 neighbor 10.0.35.1 update-source FastEthernet0/1
 neighbor 10.0.45.1 remote-as 400
 neighbor 10.0.45.1 update-source FastEthernet0/0
 no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
control-plane
!
banner motd ^C 2018-12-13 16:00:45 abUopoUFfHVQgJ7DfCr6nU01jAhTGRg4 ^C
!
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

你能告诉我哪里出错了吗?

1个回答

这种情况下的问题是 R2 正在做出决定,而不是 r3。您需要从 r3 中取出路线图,并应用相同的路线图来设置本地偏好设置 On r2 inbound from r3。那当然是假设你改变了 ibgp 的距离。否则,您将仅限于几个选项,例如阻止 r2 上的入站路由。