CCNP课程实验-04-BGP_CFG

目录

  • 实验条件
    • 网络拓朴
  • 基础配置
  • 需求实现
    • IGP部分
      • 1. 按照图示配置OSPF区域,RID为Loopback 0地址。其中Area 146要配置为OSPF的特殊区域。
      • 2. 配置其它路由协议,重分布使得路由互相注入,实现全网互通。
      • 3. R1配置策略路由,使得R2经R1去往Area 57的数据流走R6;R2经R1去往EIGRP 35的数据流走R4。 (请在R2采用针对3.3.3.3和5.5.5.5进行Traceroute测试)
      • 4. 在R3的EIGRP 35上增加以下网段:
    • BGP部分
      • 1. 如图按红色字体规划配置BGP,RID为Loopback 0地址。
      • 2. 配置AS 146的R1为路由反射器,R4/R6为客户端。要求采用peer-group的方式配置。
      • 3. 在R2上增加以下网段,并发布到BGP:
      • 4. 在适当路由器上修改BGP路由属性,使得R2前往30.30.30.30/27的路径为:R1-R6-R7-R5-R3。

实验条件

网络拓朴

在这里插入图片描述
拓扑中的IP地址段采用:172.8.AB.X/24,其中AB为两台路由器编号组合。
例如:R3-R5之间的AB为35,X为路由器编号,例如R3的X=3
所有路由器都有一个Loopback 0接口,地址格式为:X.X.X.X/32,其中X为路由器编号。
R1/R4/R6之间的网段为:172.8.146.X/24,其中X为路由器编号。
没有特殊要求,不允许使用静态路由。

基础配置

R1

interface Loopback0
 ip address 1.1.1.1 255.255.255.255
interface Ethernet0/0
 ip address 172.8.12.1 255.255.255.0
interface Ethernet0/1
 ip address 172.8.146.1 255.255.255.0

R2

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
interface Ethernet0/0
 ip address 172.8.12.2 255.255.255.0

R3

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
interface Ethernet0/0
 ip address 172.8.35.3 255.255.255.0

R4

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
interface Ethernet0/0
 ip address 172.8.47.4 255.255.255.0
interface Ethernet0/1
 ip address 172.8.146.4 255.255.255.0

R5

interface Loopback0
 ip address 5.5.5.5 255.255.255.255
interface Ethernet0/0
 ip address 172.8.35.5 255.255.255.0
interface Ethernet0/1
 ip address 172.8.57.5 255.255.255.0

R6

interface Loopback0
 ip address 6.6.6.6 255.255.255.255
interface Ethernet0/1
 ip address 172.8.146.6 255.255.255.0
interface Ethernet0/2
 ip address 172.8.67.6 255.255.255.0

R7

interface Loopback0
 ip address 7.7.7.7 255.255.255.255
interface Ethernet0/0
 ip address 172.8.47.7 255.255.255.0
interface Ethernet0/1
 ip address 172.8.57.7 255.255.255.0
interface Ethernet0/2
 ip address 172.8.67.7 255.255.255.0

需求实现

IGP部分

1. 按照图示配置OSPF区域,RID为Loopback 0地址。其中Area 146要配置为OSPF的特殊区域。

R1

router eigrp 12
 network 172.8.12.1 0.0.0.0
 eigrp router-id 1.1.1.1
router ospf 100
 router-id 1.1.1.1
 area 146 nssa	// 非ABR,配置NSSA区域,只要配置成nssa即可
 network 1.1.1.1 0.0.0.0 area 146

interface Ethernet0/1
 ip ospf 100 area 146

R2

router eigrp 12
 network 2.2.2.2 0.0.0.0
 network 172.8.12.2 0.0.0.0
 eigrp router-id 2.2.2.2

R3

router eigrp 35
 network 3.3.3.3 0.0.0.0
 network 172.8.35.3 0.0.0.0
 eigrp router-id 3.3.3.3

R4

router ospf 100
 router-id 4.4.4.4
 //需要引入外部的路由。所以特殊区域只能选择NSSA,由于NSSA默认不会下发默认路由,这样的话,会影响访问外部路由
 //因此,需要配置成Totally NSSA, 或是配置default-information-originate, 
 area 146 nssa default-information-originate
 network 4.4.4.4 0.0.0.0 area 0

R5

router eigrp 35
 network 172.8.35.5 0.0.0.0
 eigrp router-id 5.5.5.5
router ospf 100
 router-id 5.5.5.5
 network 5.5.5.5 0.0.0.0 area 57

interface Ethernet0/1
 ip ospf 100 area 57

R6

router ospf 100
 router-id 6.6.6.6
 //需要引入外部的路由。所以特殊区域只能选择NSSA,由于NSSA默认不会下发默认路由,这样的话,会影响访问外部路由
 //因此,需要配置成Totally NSSA, 或是配置default-information-originate, 
 area 146 nssa default-information-originate
 network 6.6.6.6 0.0.0.0 area 0

interface Ethernet0/1
 ip ospf 100 area 146
interface Ethernet0/2
 ip ospf 100 area 0

R7

router ospf 100
 network 7.7.7.7 0.0.0.0 area 0

interface Ethernet0/0
 ip ospf 100 area 0
interface Ethernet0/1
 ip ospf 100 area 57
interface Ethernet0/2
 ip ospf 100 area 0

2. 配置其它路由协议,重分布使得路由互相注入,实现全网互通。

R1 ASBR配置 双向重分布路由
OSPF重分布进eigrp的时候,默认的metric值无穷大,导致路由无效,因此需要特别指定引入的路由的metric计算值。

router eigrp 12
 redistribute ospf 100 metric 10000 100 255 255 1500
router ospf 100
 redistribute eigrp 12 metric-type 1 subnets

R5 ASBR配置双向重分布路由

router eigrp 35
 redistribute ospf 100 metric 10000 100 255 255 1500
router ospf 100
 redistribute eigrp 35 metric-type 1 subnets

全网互通结果检测

R3#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 = 1/1/1 ms
R3#ping 2.2.2.2 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R3#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/6 ms
R3#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R3#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R3#ping 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R3#ping 7.7    
% Unrecognized host or address, or protocol not running.

R3#ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

3. R1配置策略路由,使得R2经R1去往Area 57的数据流走R6;R2经R1去往EIGRP 35的数据流走R4。 (请在R2采用针对3.3.3.3和5.5.5.5进行Traceroute测试)

  1. R2经R1去往Area 57的数据流走R6;
    R2的ip是2.2.2.2,AREA 57的目标网段是:172.8.57.0 0.0.0.255
    access-list 125 permit ip host 2.2.2.2 172.8.57.0 0.0.0.255
    access-list 125 permit ip host 2.2.2.2 host 5.5.5.5
  2. R2经R1去往EIGRP 35的数据流走R4;
    R2的ip是2.2.2.2,EIGRP 35的目标网段是:172.8.35.0 0.0.0.255
    access-list 123 permit ip host 2.2.2.2 172.8.35.0 0.0.0.255
    access-list 123 permit ip host 2.2.2.2 host 3.3.3.3

在R1上进行配置

access-list 123 permit ip host 2.2.2.2 172.8.35.0 0.0.0.255
access-list 123 permit ip host 2.2.2.2 host 3.3.3.3
access-list 125 permit ip host 2.2.2.2 172.8.57.0 0.0.0.255
access-list 125 permit ip host 2.2.2.2 host 5.5.5.5

 ip policy route-map PBR
route-map PBR permit 10
 match ip address 123
 // 配置策略,由2.2.2.2发起,前往EIGRP35区域的,走R4
 set ip next-hop 172.8.146.4
route-map PBR permit 20
 match ip address 125
 // 配置策略,由2.2.2.2发起,前往AREA57区域的,走R6 
 set ip next-hop 172.8.146.6
route-map PBR permit 30

//在R1入口方向配置策略
interface Ethernet0/0
 ip policy route-map PBR

效果测试

R2#traceroute 3.3.3.3 source 2.2.2.2
Type escape sequence to abort.
Tracing the route to 3.3.3.3
VRF info: (vrf in name/id, vrf out name/id)
  1 172.8.12.1 0 msec 1 msec 0 msec
  2 172.8.146.4 0 msec 0 msec 0 msec
  3 172.8.47.7 0 msec 0 msec 1 msec
  4 172.8.57.5 0 msec 1 msec 0 msec
  5 172.8.35.3 1 msec *  1 msec
R2#traceroute 5.5.5.5 source 2.2.2.2
Type escape sequence to abort.
Tracing the route to 5.5.5.5
VRF info: (vrf in name/id, vrf out name/id)
  1 172.8.12.1 1 msec 0 msec 0 msec
  2 172.8.146.6 0 msec 1 msec 0 msec
  3 172.8.67.7 1 msec 0 msec 0 msec
  4 172.8.57.5 1 msec *  1 msec
R2#

4. 在R3的EIGRP 35上增加以下网段:

		Loopback17:17.17.17.17/32,Loopback101:100.100.100.101/32
		Loopback18:18.18.18.18/32,Loopback102:100.100.100.102/32
a.配置使得Loopback 18网段只能在EIGRP 35内传输,其它地址要求全网Ping通。
b.配置Loopback 100和Loopback 101最精确的路由汇总,隐藏明细路由,且汇总路由不允许在EIGRP 35出现。

R3配置环回口地址

interface Loopback1
 ip address 17.17.17.17 255.255.255.255
interface Loopback2
 ip address 18.18.18.18 255.255.255.255
interface Loopback3
 ip address 100.100.100.101 255.255.255.255
interface Loopback4
 ip address 100.100.100.102 255.255.255.255

宣告到EIGRP

router eigrp 35
 network 17.17.17.17 0.0.0.0
 network 18.18.18.18 0.0.0.0
 network 100.100.100.101 0.0.0.0
 network 100.100.100.102 0.0.0.0

a.配置使得Loopback 18网段只能在EIGRP 35内传输,其它地址要求全网Ping通。
在重分布进ospf时拦截掉18网段路由
在R5的路由器上配置

access-list 18 permit 18.18.18.18

route-map R3-18 deny 10
 match ip address 18
route-map R3-18 permit 20

router ospf 100
 redistribute eigrp 35 metric-type 1 subnets route-map R3-18

在R1上测试网络结果

R1#ping 18.18.18.18
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 18.18.18.18, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R1#ping 17.17.17.17
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 17.17.17.17, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 100.100.100.101
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.101, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 100.100.100.102
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.102, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#

b.配置Loopback 100和Loopback 101最精确的路由汇总,隐藏明细路由,且汇总路由不允许在EIGRP 35出现。
在R5的路由器上配置

ip prefix-list deny_100 seq 5 permit 100.100.100.100/30

route-map deny_100 deny 10
 match ip address prefix-list deny_100
route-map deny_100 permit 20

router eigrp 35
 redistribute ospf 100 metric 10000 100 255 255 1500 route-map deny_100

查看R7的路由表信息

R7(config-router)#do show ip route
......
O E1     17.17.17.17 [110/30] via 172.8.57.5, 00:56:47, Ethernet0/1
      100.0.0.0/30 is subnetted, 1 subnets
O E1     100.100.100.100 [110/30] via 172.8.57.5, 00:24:01, Ethernet0/1
      172.8.0.0/16 is variably subnetted, 9 subnets, 2 masks
......
R7(config-router)#

查看EIGRP 35内的路由表信息

R3(config)#do show 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
       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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
D EX     1.1.1.1 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      2.0.0.0/32 is subnetted, 1 subnets
D EX     2.2.2.2 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
C        3.3.3.3 is directly connected, Loopback0
      4.0.0.0/32 is subnetted, 1 subnets
D EX     4.4.4.4 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
D EX     5.5.5.5 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
D EX     6.6.6.6 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      7.0.0.0/32 is subnetted, 1 subnets
D EX     7.7.7.7 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
      17.0.0.0/32 is subnetted, 1 subnets
C        17.17.17.17 is directly connected, Loopback1
      18.0.0.0/32 is subnetted, 1 subnets
C        18.18.18.18 is directly connected, Loopback2
      100.0.0.0/32 is subnetted, 2 subnets
C        100.100.100.101 is directly connected, Loopback3
C        100.100.100.102 is directly connected, Loopback4
      172.8.0.0/16 is variably subnetted, 7 subnets, 2 masks
D EX     172.8.12.0/24 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
C        172.8.35.0/24 is directly connected, Ethernet0/0
L        172.8.35.3/32 is directly connected, Ethernet0/0
D EX     172.8.47.0/24 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
D EX     172.8.57.0/24 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
D EX     172.8.67.0/24 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
D EX     172.8.146.0/24 [170/307200] via 172.8.35.5, 00:18:35, Ethernet0/0
R3(config)#

R3的路由表并没有汇总的100网段路由。

BGP部分

1. 如图按红色字体规划配置BGP,RID为Loopback 0地址。

R1

router bgp 146
 bgp router-id 1.1.1.1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 146
 neighbor IBGP update-source Loopback0
 neighbor IBGP route-reflector-client
 neighbor IBGP next-hop-self
 neighbor 4.4.4.4 peer-group IBGP
 neighbor 6.6.6.6 peer-group IBGP
 neighbor 172.8.12.2 remote-as 22

R2

router bgp 22
 bgp router-id 2.2.2.2
 neighbor 172.8.12.1 remote-as 146

R3

router bgp 33
 bgp router-id 3.3.3.3
 neighbor 172.8.35.5 remote-as 57

R4

router bgp 146
 bgp router-id 4.4.4.4
 neighbor IBGP peer-group
 neighbor IBGP remote-as 146
 neighbor IBGP update-source Loopback0
 neighbor IBGP next-hop-self
 neighbor 1.1.1.1 peer-group IBGP
 neighbor 6.6.6.6 peer-group IBGP
 neighbor 172.8.47.7 remote-as 57

R5

router bgp 57
 bgp router-id 5.5.5.5
 neighbor 7.7.7.7 remote-as 57
 neighbor 7.7.7.7 update-source Loopback0
 neighbor 7.7.7.7 next-hop-self
 neighbor 172.8.35.3 remote-as 33

R6

router bgp 146
 bgp router-id 6.6.6.6
 bgp log-neighbor-changes
 neighbor IBGP peer-group
 neighbor IBGP remote-as 146
 neighbor IBGP update-source Loopback0
 neighbor IBGP next-hop-self
 neighbor 1.1.1.1 peer-group IBGP
 neighbor 4.4.4.4 peer-group IBGP
 neighbor 172.8.67.7 remote-as 57

R7

router bgp 57
 bgp router-id 7.7.7.7
 neighbor 5.5.5.5 remote-as 57
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 5.5.5.5 next-hop-self
 neighbor 172.8.47.4 remote-as 146
 neighbor 172.8.67.6 remote-as 146

2. 配置AS 146的R1为路由反射器,R4/R6为客户端。要求采用peer-group的方式配置。

R1配置路由反射器

router bgp 146
 neighbor IBGP route-reflector-client
 或
 neighbor 4.4.4.4 route-reflector-client
 neighbor 6.6.6.6 route-reflector-client

3. 在R2上增加以下网段,并发布到BGP:

	Loopback24:192.168.24.1/24			Loopback25:192.168.25.1/24			Loopback26:192.168.26.1/24
	在R3上增加以下网段,Loopback30:30.30.30.30/27,并发布到BGP:
	配置使得R2的BGP表如下:

在这里插入图片描述
R2配置3个环回口

interface Loopback24
 ip address 192.168.24.1 255.255.255.0
interface Loopback25
 ip address 192.168.25.1 255.255.255.0
interface Loopback26
 ip address 192.168.26.1 255.255.255.0

R3配置1个环回口

interface Loopback30
 ip address 30.30.30.30 255.255.255.224

查看R2的BGP路由表

R2(config-router)#do show ip bgp
BGP table version is 5, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   30.30.30.0/27    172.8.12.1                             0 146 57 33 i
 *>   192.168.24.0     0.0.0.0                  0         32768 i
 *>   192.168.25.0     0.0.0.0                  0         32768 i
 *>   192.168.26.0     0.0.0.0

对比截图,发现在多了一条掩码长度为22的汇聚路由。而24,25,26三条路由被镇压。第3字节的二进制如下:
24的二进制为 00001100
25的二进制为 00001101
26的二进制为 00001110
变动的位数是最后的2位,固定不变的高6位的值为:24,因此聚合的路由就为:192.168.24.0/22。
执行以下命令

router bgp 22
 // 不带参数summary-only的话,不会镇压其它明细路由,根据图片的要求,所以需要带上summary-only
 aggregate-address 192.168.24.0 255.255.252.0 as-set summary-only

再次查看BGP路由表

R2(config-router)#do show ip bgp      
BGP table version is 19, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   30.30.30.0/27    172.8.12.1                             0 146 57 33 i
 s>   192.168.24.0     0.0.0.0                  0         32768 i
 *>   192.168.24.0/22  0.0.0.0                       100  32768 i
 s>   192.168.25.0     0.0.0.0                  0         32768 i
 s>   192.168.26.0     0.0.0.0                  0         32768 i
R2(config-router)#

比对图片,目的达到。

4. 在适当路由器上修改BGP路由属性,使得R2前往30.30.30.30/27的路径为:R1-R6-R7-R5-R3。

注:此时R2的BGP表仍如上面所示不变,并且不改变R4路由器的BGP选路。
查看当前R2到R3的选路路径。

R2#traceroute 30.30.30.30
Type escape sequence to abort.
Tracing the route to 30.30.30.30
VRF info: (vrf in name/id, vrf out name/id)
  1 172.8.12.1 0 msec 0 msec 1 msec
  2 172.8.146.4 0 msec 0 msec 1 msec
  3 172.8.47.7 0 msec 0 msec 0 msec
  4 172.8.57.5 0 msec 1 msec 0 msec
  5 172.8.35.3 1 msec *  2 msec

当前的路径为:R1-R4-R7-R5-R3
要达成目标则可以以下的几个策略来达到目的

  1. 修改Weight权重值
    修改邻居R6的weight权重值
router bgp 146
 neighbor 6.6.6.6 weight 1000

查看BGP路由表

R1(config-router)#do show ip bgp
BGP table version is 40, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i  30.30.30.0/27    6.6.6.6                  0    100   1000 57 33 i
 * i                   4.4.4.4                  0    100      0 57 33 i
 *>   192.168.24.0/22  172.8.12.2               0             0 22 i

测试R2到R3的路径

R2#traceroute 30.30.30.30
Type escape sequence to abort.
Tracing the route to 30.30.30.30
VRF info: (vrf in name/id, vrf out name/id)
  1 172.8.12.1 1 msec 0 msec 0 msec
  2 172.8.146.6 0 msec 0 msec 0 msec
  3 172.8.67.7 1 msec 0 msec 1 msec
  4 172.8.57.5 0 msec 1 msec 0 msec
  5 172.8.35.3 1 msec *  2 msec
  1. 修改local-preference
    确定30网段路由传递方向。R3 -> R5 -> R7 -> [ R4或R6 ] -> R1 -> R2
    将来数据的传递方向则是反过来,因此在R1将会有多条可选路径去往R3,那么要影响R1选择R4和R6(除了上面的weight)就是调整R4和R6传递过来的路由在R1上的local-preference值。默认是不传递该值的。直接就是默认值100,可以进行的操作有如下方法
    a. 调小R4或调大R6的bgp default local-preference 值。不过这样的话,R4所有过来的路由的local-preference都会受到影响。范围太大。
    b. 使用route-map调整R4/R6,对R1出方向的local-preference值
    c. 因为要求对R4不做改动,因此可以在R1路由器上对R4-R1-in方向 或 R6-R1-in方向的local-preference值。
    R1上配置in方向的local-preference值修改
ip prefix-list 30 seq 5 permit 30.30.30.0/27

route-map R4-R1-in permit 10
 match ip address prefix-list 30
 set local-preference 99
route-map R4-R1-in permit 20

router bgp 146
 neighbor 4.4.4.4 route-map R4-R1-in in

查询local-preference值

R1(config-router)#do show ip bgp
BGP table version is 58, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i  30.30.30.0/27    4.4.4.4                  0     99      0 57 33 i
 *>i                   6.6.6.6                  0    100      0 57 33 i
 *>   192.168.24.0/22  172.8.12.2               0             0 22 i
R1(config-router)# 

在R2测试配置结果

R2#traceroute 30.30.30.30
Type escape sequence to abort.
Tracing the route to 30.30.30.30
VRF info: (vrf in name/id, vrf out name/id)
  1 172.8.12.1 0 msec 0 msec 1 msec
  2 172.8.146.6 0 msec 0 msec 1 msec
  3 172.8.67.7 0 msec 1 msec 0 msec
  4 172.8.57.5 1 msec 1 msec 0 msec
  5 172.8.35.3 1 msec *  1 msec
R2#

目标达成:R1-> R6-> R7-> R5-> R3

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/288728.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

openmmlab大模型实战营01

与环境进行交互——智能体更合适 模型微调常见方式 模型评测 模型部署常见问题你 大语言模型本身不具备最新信息和知识的获取,此时需要搭建包含不同模块的智能体框架 智能体:以大语言模型为核心,进行规划、推理和执行

Hive09_函数

HIVE函数 系统内置函数 1)查看系统自带的函数 hive> show functions;2)显示自带的函数的用法 hive> desc function upper;3)详细显示自带的函数的用法 hive> desc function extended upper;hive函数分类 1、UDF:用…

贪心算法part05 435无重叠区间

435无重叠区间 763 划分字母区间 56合并区间

nginx访问路径匹配方法

目录 一:匹配方法 二:location使用: 三:rewrite使用 一:匹配方法 location和rewrite是两个用于处理请求的重要模块,它们都可以根据请求的路径进行匹配和处理。 二:location使用: 1:简单匹配…

打造专业开发者指南:针对ShardingProxy分库分表解决策略的深度剖析 – 详解部署、使用、服务治理与优化技巧

一、 ShardingProxy快速使用 ShardingProxy的功能同样是分库分表,但是他是一个独立部署的服务端,提供 统一的数据库代理服务。注意,ShardingProxy目前只支持MySQL和PostgreSQL。并且,客户端连接ShardingProxy时,最好使…

主流桌面浏览器Chrome,FireFox和Edge等如何禁用弹出式窗口阻止程序,这里有详细步骤

为什么你想知道如何禁用浏览器中的弹出式窗口阻止程序?毕竟,弹出式窗口是网络的祸害:显示烦人的广告、虚假的安全消息和其他刺激,会分散你的浏览注意力,甚至可能包含恶意代码。 所有主要的桌面浏览器现在都默认阻止弹出式窗口,那么你到底为什么要取消阻止这些害虫呢?事…

人机协同的关键

逻辑和实验是现代科学研究的两个支柱,这是因为科学研究需要不断地进行理论和实践的相互验证和修正,而逻辑和实验则分别代表了这两个方面的重要性和必要性。只有将逻辑和实验有效结合起来,它们相辅相成,互相促进,共同推…

【论文阅读】AADiff: Audio-Aligned Video Synthesis with Text-to-Image Diffusion

AADiff:基于文本到图像扩散的音频对齐视频合成。 code:没开源 paper:[2305.04001] AADiff: Audio-Aligned Video Synthesis with Text-to-Image Diffusion (arxiv.org) 一种新的T2V框架,额外使用音频信号来控制时间动态,使现成的…

快速入门ESP32——点亮你的第一个LCD屏幕

相关文章 快速入门ESP32——开发环境配置Arduino IDE 快速入门ESP32——开发环境配置PlatformIO IDE 快速入门ESP32—— platformIO添加开源库和自己的开发库 快速入门ESP32—— 解决platformIO添加开源库下载失败的问题 快速入门ESP32——点亮你的第一个LCD屏幕 前言一、移植T…

Python 流程控制结构(1)

# 在Python主要分为3大流程结构:顺序结构、分支结构、循环结构 Python顺序结构:从头到尾依次执行每一条 , 不需要判断 Python分支结构:程序会拐弯,有选择性的执行代码 ,到某个节点后,会根据一次判断结果来决定之后走哪…

【损失函数】Cross Entropy Loss 交叉熵损失

1、介绍 主页介绍的几种损失函数都是适用于回归问题损失函数,对于分类问题,最常用的损失函数是交叉熵损失函数 Cross Entropy Loss。它用于测量两个概率分布之间的差异,通常用于评估分类模型的性能。 2、公式 对于二分类问题,交…

DolphinScheduler实际应用

前言 最近公司新启动了一个项目,然后领导想用一下新技术,并且为公司提供多个大数据调度解决方案,我呢就根据领导要求调研了下当前的开源调度工具,最终决定采用DolphinScheduler, 因此研究了一下DolphinScheduler &…

基于头脑风暴算法优化的Elman神经网络数据预测 - 附代码

基于头脑风暴算法优化的Elman神经网络数据预测 - 附代码 文章目录 基于头脑风暴算法优化的Elman神经网络数据预测 - 附代码1.Elman 神经网络结构2.Elman 神经用络学习过程3.电力负荷预测概述3.1 模型建立 4.基于头脑风暴优化的Elman网络5.测试结果6.参考文献7.Matlab代码 摘要&…

QProgressDialog用法及结合QThread用法,四种线程使用

1 QProgressDialog概述 QProgressDialog类提供耗时操作的进度条。 进度对话框用于向用户指示操作将花费多长时间,并演示应用程序没有冻结。此外,QPorgressDialog还可以给用户一个中止操作的机会。 进度对话框的一个常见问题是很难知道何时使用它们;操作…

ASP.NET Core基础之图片文件(一)-WebApi访问静态图片

阅读本文你的收获: 学会在WebApi项目中访问静态图片了解静态文件中间件UseStaticFiles的用法 系统中免不了要去处理图片文件,比如上传商品的图片、显示商品的图片,访问系统中的图片等等,根据微软官网描述: 静态文件&a…

阿里巴巴开源异构数据源离线/全量/增量同步工具 - DataX

😄 19年之后由于某些原因断更了三年,23年重新扬帆起航,推出更多优质博文,希望大家多多支持~ 🌷 古之立大事者,不惟有超世之才,亦必有坚忍不拔之志 🎐 个人CSND主页——Mi…

android——自定义TextView

效果展示&#xff1a; 代码解析&#xff1a; 1、首先设置自定义属性&#xff08;res/values下新建一个attrs.xml文件&#xff09; <?xml version"1.0" encoding"utf-8"?> <resources><!-- name 自定义view的名字 CustomTextView--&…

假期归来必看!2023年9月份,爆款论文总结,了解最新学术进展!

以下文章来源于AINLPer &#xff0c;作者ShuYini 十一假期结束了&#xff0c;十月基本上算是过了一半了&#xff0c;小伙伴们收收心准备开始学习工作吧。按照惯例&#xff0c;月初继续带到家盘一下上个月(九月份)的热点论文。本月论文主要分为大模型微调、大模型发布、大模型应…

jmeter线程组

特点&#xff1a;模拟用户&#xff0c;支持多用户操作&#xff1b;可以串行也可以并行 分类&#xff1a; setup线程组&#xff1a;初始化 类似于 unittest中的setupclass 普通线程组&#xff1a;字面意思 teardown线程组&#xff1a;环境恢复&#xff0c;后置处理

泰国Cafe Racer卖到日本去了还限量150台?

GPX推出日本限定 GTM250R Cafe Racer&#xff0c;复古小车卖到日本去了&#xff0c;限量150台&#xff0c;不得不说这台小车还是挺有味道的。现代的复古风格摩托车也是永远都不会落伍&#xff0c;即使没有什么品牌背书&#xff0c;喜欢这种车型的人&#xff0c;对于配置动力都不…
最新文章