CCNP课程实验-04-BGP_CFG

news2024/9/24 9:24:52

目录

  • 实验条件
    • 网络拓朴
  • 基础配置
  • 需求实现
    • 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.coloradmin.cn/o/1353215.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

react-hooks-kit v1 正式发布

evanpatchouli/react-hooks-kit - (npmjs.com) v1.0.0 正式发布! 下载安装 npm i evanpatchouli/react-hooks-it -S官方文档 在 Gitee 阅读在 Github 阅读 概览 这是一个无依赖的轻量级 React Hooks 库,总共有 60 hooks。 它包含了一系列易于使用…

linux 内核链表操作

操作系统内核, 如同其他程序, 常常需要维护数据结构的列表. 有时, Linux 内核已经同 时有几个列表实现. 为减少复制代码的数量, 内核开发者已经创建了一个标准环形的, 双 链表; 鼓励需要操作列表的人使用这个设施. 当使用链表接口时, 你应当一直记住列表函数不做加锁. 如果你的…

小妙招:教你如何查询获取企业工商数据

在行业互联网领域,工商数据的运用场景多种多样。无论是对产业链的上下游企业,还是为企业背景调查、客户获取、财税服务、知识产权服务,乃至于外贸企业,商品批发等业务,TO B服务型企业都离不开工商数据的支持。这些五花…

主动IRS(Active IRS)模型总结

文章目录 A Framework for Transmission Design for Active RIS-Aided Communication with Partial CSIHybrid active and passive IRS从已有passive IRS算法拓展到active IRS算法 active IRS 与 passive IRS模型的区别 A Framework for Transmission Design for Active RIS-Ai…

centos7 ping不通域名

如果ip能ping通,ping不通域名可以试试以下操作: 1.编辑resolv.conf文件 vi /etc/resolv.conf 添加 nameserver 8.8.8.8 2.编辑nsswitch.conf vi /etc/nsswitch.conf 改成下图所示: 3.编辑sysctl.conf vi /etc/sysctl.conf 加上两行内…

爬虫如何获取免费代理IP(二)

89ip代理爬取代码实现 一、代码实现 import requests import time import random from fake_useragent import UserAgent from lxml import etree import os import csv""" 89ip代理爬取 """class IPSipder(object):def __init__(self):self.u…

rime中州韵小狼毫 inputShow lua Translator 输入字符透传翻译器

在 rime中州韵小狼毫 help lua Translator 中我们分享了如何使用 lua 脚本定义一个 translator,并以 五笔・拼音 为例引用了该 translator,并且达到了预期的效果。 今天,我们继续通过 lua 脚本为 rime中州韵/小狼毫 输入法打造一个 translat…

【Linux Shell】1. Shell 简述

文章目录 【 1. Shell 解释器、Shell语言、Shell脚本 】【 2. Shell 环境 】【 3. 一个简单的 Shell 脚本 】3.1 Shell 脚本的编写3.2 Shell 脚本的运行3.2.1 作为可执行程序运行 Shell 脚本3.2.2 作为解释器参数运行 Shell 脚本 【 1. Shell 解释器、Shell语言、Shell脚本 】 …

C++学习(二)

我们是在学习过了C语言,基础上来看这篇文章的,如果你是直接学C,这篇文章不太适合你的,因为这里只讲C基础中与C语言不同之处。 一.main函数区别 在C语言中,我们写main函数是不是可以省略前面的int,但是在C中&#xff…

React(2): 使用 html2canvas 生成图片

使用 html2canvas 生成图片 需求 将所需的内容生成图片div 中包括 svg 等 前置准备 "react": "^18.2.0","react-dom": "^18.2.0","html2canvas": "^1.4.1",实现 <div ref{payRef}></div>const pa…

Character Controller Smooth

流畅的角色控制器 Unity的FPS解决方案&#xff01; 它是一种具有非常平滑运动和多种设置的解决方案&#xff1a; - 移动和跳跃 - 坐的能力 - 侧翻角度 - 不平整表面的处理 - 惯性守恒 - 重力 - 与物理物体的碰撞。 - 支持没有家长控制的平台 此解决方案适用于那些需要角色控制器…

Spring Boot 整合 MinIO自建对象存储服务

GitHub 地址&#xff1a;GitHub - minio/minio: The Object Store for AI Data Infrastructure 另外&#xff0c;MinIO 可以用来作为云原生应用的主要存储服务&#xff0c;因为云原生应用往往需要更高的吞吐量和更低的延迟&#xff0c;而这些都是 MinIO 的优势。安装过程跳过。…

(七)独立按键

文章目录 独立按键原理图三行代码法简单概述代码书写键码推算如何使用短按键长按键 状态机法简单概述代码书写键码推算如何使用短按键长按键 现象 独立按键原理图 三行代码法 简单概述 代码书写 u8 Trg 0x00;//短按键 u8 Cont 0x00;//长按键 void BtnThree(void) {u8 reada…

李沐机器学习系列2--- mlp

1 Introduction LP中有一个很强的假设&#xff0c;输入和输出是线性关系&#xff0c;这一般是不符合事实的。 通过几何的方式去对信息进行理解和压缩是比较高效的&#xff0c;MLP可以表示成下面的形式。 1.1 从线性到非线性 X ∈ R n d X \in R^{n \times d} X∈Rnd表示输入…

2023-12-26分割回文串和子集以及子集II

131. 分割回文串 思想&#xff1a;回溯三步骤&#xff01;① 传入参数 ② 回溯结束条件 ③ 单层搜索逻辑&#xff01;抽象成回溯树&#xff0c;树枝上是每次从头部穷举切分出的子串&#xff0c;节点上是待切分的剩余字符串【从头开始每次往后加一】 class Solution:def partiti…

基于混合蛙跳算法优化的Elman神经网络数据预测 - 附代码

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

ChatGPT持续火热,OpenAI年收入突破16亿美元

著名科技媒体The Information消息&#xff0c;由于OpenAI的ChatGPT等产品实现强劲增长&#xff0c;其年收入将突破16亿美元。 这主要得益于OpenAI在2023年发布了一系列重磅产品&#xff0c;包括GPT-4、ChatGPT企业版、GPT-4 Turbo、DALLE 3、苹果/安卓应用、自定义GPTs、Assis…

测试人必看,看完必会的fiddler抓包,抓包抓的好........

&#x1f4e2;专注于分享软件测试干货内容&#xff0c;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1f4dd; 如有错误敬请指正&#xff01;&#x1f4e2;交流讨论&#xff1a;欢迎加入我们一起学习&#xff01;&#x1f4e2;资源分享&#xff1a;耗时200小时精选的「软件测试」资…

ELF文件信息一览

准备开个专栏&#xff0c;记录《从零开始实现链接器》的学习过程&#xff0c;先占个坑。 之前一直想把自己的学习过程记录在个人博客网站上&#xff0c;但这个要自己维护&#xff0c;上传图片什么的比较麻烦。关键是没有人互动&#xff0c;自己也没有怎么去看&#xff0c;慢慢的…

麒麟云增加计算节点

一、安装基座系统并配置好各项设置 追加的计算节点服务器&#xff0c;安装好系统&#xff0c;把主机名、网络网线&#xff08;网线要和其他网线插的位置一样&#xff09;、hosts这些配置好&#xff0c;在所有节点的/etc/hosts里面添加信息 在控制节点添加/kylincloud/multinod…