BGP防环,反射,联盟

BGP防环,反射,联盟
BGP防环,反射,联盟_第1张图片
需求:

  1. 如图配置IP地址和ospf协议;
  2. 配置AS之间的外部邻居,通过直连接口
  3. 配置AS之内部邻居,要求通过loopback 0 建立;
  4. 将R1的loopback 通过net宣告;
  5. 将R6的loopback 通过import-route宣告;
  6. 要求R1和R6可以互相学习路由并可以ping通
    思路:
  7. 进行设备基本配置以及IP地址配置;
  8. AS200中:
    @建立 ospf 邻居
    @通过 loopback 0 建立 IBGP 邻居;
    @与 AS 100/600 建立 EBGP 邻居;
  9. AS 100/600 :
    @与 AS 200 建立 EBGP 邻居;
    @宣告自己的接口进入 BGP
    R1
    sys
    [Huawei] sys R1
    [R1]int g0/0/0
    [R1-GigabitEthernet0/0/0]ip address 192.168.12.1 24
    [R1-GigabitEthernet0/0/0]q
    [R1]int loopback 0
    [R1-LoopBack0]ip address 10.10.1.1 24
    [R1-LoopBack0]q
    [R1]bgp 100
    [R1-bgp]router-id 1.1.1.1
    [R1-bgp]peer 192.168.12.2 as-number 200
    [R1-bgp]network 10.10.1.1 24
    dis bgp peer

BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 1 Peers in established state : 1

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

192.168.12.2 4 200 8 10 0 00:06:21 Established
0

R2
sys
[Huawei]sys R2
[R2]int LoopBack 0
[R2-LoopBack0]ip address 20.20.2.2 24
[R2-LoopBack0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.12.2 24
[R2-GigabitEthernet0/0/1]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.23.2 24
[R2-GigabitEthernet0/0/0]q
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.23.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 20.20.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 192.168.12.1 as-number 100
[R2-bgp]peer 20.20.3.3 as-number 200
[R2-bgp]peer 20.20.3.3 connect-interface LoopBack0 //使用回环接口建立邻居
[R2-bgp]peer 20.20.3.3 next-hop-local //告诉3.3 下一跳地址改为自己

[R2-bgp]dis bgp peer

BGP local router ID : 2.2.2.2
Local AS number : 200
Total number of peers : 2 Peers in established state : 2

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

20.20.3.3 4 200 5 7 0 00:00:51 Established
3
192.168.12.1 4 100 75 83 0 01:12:25 Established
1
[R2-bgp]q
[R2]dis ospf peer brief

 OSPF Process 1 with Router ID 2.2.2.2
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full

[R2]

R3
sys
[Huawei]sys R3
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.23.3 24
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.34.3 24
[R3-GigabitEthernet0/0/0]q
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]ar
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.23.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.34.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]q
[R3]bgp 200
[R3-bgp]peer 20.20.2.2 as-number 200
[R3-bgp]peer 20.20.2.2 connect-interface LoopBack 0
[R3-bgp]peer 20.20.4.4 as-number 200
[R3-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R3-bgp]dis bgp peer

BGP local router ID : 3.3.3.3
Local AS number : 200
Total number of peers : 2 Peers in established state : 2

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

20.20.2.2 4 200 6 5 0 00:00:57 Established
4
20.20.4.4 4 200 5 6 0 00:00:44 Established
3
[R3-bgp]q
[R3]dis ospf peer brief

 OSPF Process 1 with Router ID 3.3.3.3
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
0.0.0.0 GigabitEthernet0/0/0 4.4.4.4 Full
------------------------------------------------------------------- [R3]

R4
sys
[Huawei]sys R4
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.34.4 24
[R4-GigabitEthernet0/0/1]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.45.4 24
[R4-GigabitEthernet0/0/0]q
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]are
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.34.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 192.168.45.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1] bgp 200
[R4-bgp]peer 20.20.3.3 as-number 200
[R4-bgp]peer 20.20.3.3 connect-interface LoopBack 0
[R4-bgp]peer 20.20.5.5 as-number 200
[R4-bgp]peer 20.20.5.5 connect-interface LoopBack 0
[R4-bgp]dis bgp peer

BGP local router ID : 4.4.4.4
Local AS number : 200
Total number of peers : 2 Peers in established state : 2

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

20.20.3.3 4 200 5 5 0 00:00:51 Established
3
20.20.5.5 4 200 3 5 0 00:00:51 Established
1
[R4-bgp]q
[R4]dis ospf peer brief

 OSPF Process 1 with Router ID 4.4.4.4
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 3.3.3.3 Full
0.0.0.0 GigabitEthernet0/0/0 5.5.5.5 Full

[R4]

R5
sys
[Huawei]sys R5
[R2]int LoopBack 0
[R2-LoopBack0]ip address 20.20.5.5 24
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 192.168.45.5 24
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.56.5 24
[R5-GigabitEthernet0/0/0]q
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.45.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 20.20.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]q
[R5]bgp 200
[R5-bgp]route-select
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 192.168.56.6 as-number 600
[R5-bgp]peer 20.20.4.4 as-number 200
[R5-bgp]peer 20.20.4.4 connect-interface LoopBack0 //使用回环接口建立邻居
[R5-bgp]peer 20.20.4.4 next-hop-local //更改下一跳地址为自己
[R5-bgp]dis bgp peer

BGP local router ID : 5.5.5.5
Local AS number : 200
Total number of peers : 2 Peers in established state : 2

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

20.20.4.4 4 200 6 5 0 00:01:03 Established
3
192.168.56.6 4 600 77 83 0 01:12:54 Established
2
[R5-bgp]q
[R5]dis ospf peer brief

 OSPF Process 1 with Router ID 5.5.5.5
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 4.4.4.4 Full

[R5]

R6
sys
[Huawei]sys R6
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]ip address 192.168.56.6 24
[R6-GigabitEthernet0/0/1]int loopback 0
[R6-LoopBack0]ip address 10.10.2.1 24
[R6-LoopBack0]q
[R6]bgp 600
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 192.168.56.5 as-number 200
[R6]bgp 600
[R6-bgp]network 10.10.2.1 24

[R6-bgp]dis bgp peer

BGP local router ID : 6.6.6.6
Local AS number : 600
Total number of peers : 1 Peers in established state : 1

Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv

192.168.56.5 4 200 3 3 0 00:01:10 Established
0
[R6-bgp]

问题:
R3 ------>R4 传输路由表时,容易形成环路,为避免此情况:
引出IBGP水平分割机制:
-从内部邻居学习过来的路由不转发给另一个内部邻居
解决1----->问题
IBGP设备之间“全互联”两两互联
缺点:
@命令配置量大
@消耗大量的设备资源
解决2
BGP联盟(将原来的IBGP邻居,变成EBGP邻居)
缺点:
@每个小AS内部,只能有两个路由器
解决3:
BGP 路由反射器(route reflector 即RR)
#当我们将一个BGP路由器配置成“路由反射器”之后,该路由器就会临时关闭“水平分割”。
#路由反射器客户端(RR-C)

#总结:
反射器,仅仅为“反射器客户端”进行路由反射。

扩展:
在建立EBGP邻居时,必须满足两个机制:

  1. 更新源检测机制;
  2. 直连检测机制;
    -定义:
    建立RBGP林居士,本地设备去往peer后面的IP地址时使用的必须是直连路由。
    -在什么时候检查该机制
    1.在外部BGP邻居之间存在;
    2.外部BGP邻居之间的报文的TTL值为1是才会检查如果TTL不为1就不检查
    解决方案:
    R2:
    Bgp 64523
    router-id 2.2.2.2
    confederation id 200
    confederation peer-as 64545
    peer 192.168.12.1 as-number 100
    peer 10.10.3.3 as-number 64523
    peer 10.10.3.3 connect-interface loopback 0
    peer 10.10.3.3 next-hop-local
    quit

BGP防环,反射,联盟_第2张图片

在 R2 - R5 每个路由器上删除bgp 200
[R2]undo bgp 200
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
R2
Bgp 64523
router-id 2.2.2.2
confederation id 200
confederation peer-as 64545
peer 192.168.12.1 as-number 100
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0//更改连接端口
peer 20.20.3.3 next-hop-local //更改下一跳为自己
quit

R3
Bgp 64523
router-id 3.3.3.3
confederation id 200
confederation peer-as 64545
peer 20.20.2.2 as-number 64523
peer 20.20.2.2 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 as-number 64545
peer 20.20.4.4 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 ebgp-max-hop 255 //修改TTL为255
quit

R4
Bgp 64545
router-id 4.4.4.4
confederation id 200
confederation peer-as 64523
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0//更改连接端口
peer 20.20.5.5 as-number 64545
peer 20.20.5.5 connect-interface loopback 0//更改连接端口
peer 20.20.3.3 ebgp-max-hop 255 //修改TTL为255
quit

R5
Bgp 64545
router-id 5.5.5.5
confederation id 200
confederation peer-as 64523
peer 192.168.56.6 as-number 600
peer 20.20.4.4 as-number 64545
peer 20.20.4.4 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 next-hop-local // 更改下一跳地址为自己
quit

反射器配置
1.修改 R3/R4/R5 之间的邻居关系;
2.在R3 上配置,将 R4 指定为自己的 RR-C ;
R3:
Bgp 64523
Peer 20.20.4.4 reflect-client
//将20.20.4.4视为自己的路由反射客户端

BGP防环,反射,联盟_第3张图片

R3:
bgp 64523
undo peer 20.20.4.4
peer 20.20.4.4 as-number 64523
peer 20.20.4.4 connect-interface loopback 0
quit

R4:
undo bgp 64545
Warning: All BGP configurations will be deleted. Continue? [Y/N]:y
bgp 64523
router-id 4.4.4.4
confederation id 200
confederation peer-as 64545
peer 20.20.5.5 as-number 64545
peer 20.20.5.5 connect-interface loopback 0
peer 20.20.5.5 ebgp-max-hop 2
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0
quit

R5:
bgp 64545
router-id 5.5.5.5
confederation id 200
confederation peer-as 64523
peer 192.168.56.6 as-number 600
peer 20.20.4.4 as-number 64523
peer 20.20.4.4 connect-interface loopback 0
peer 20.20.4.4 ebgp-max-hop 2
peer 10.10.4.4 next-hop-local
quit

R3:

Bgp 64523
Peer 20.20.4.4 reflect-client

需求:
取消联盟,利用路由反射器实现R1与R6通信
思路:

  1. 删除联盟
  2. 选择反射器与客户端
  3. 首次使用R3作为反射器 R4 做为客户端,发现路由单向发送
  4. 补充R4为R3 的反射器 R3作为客户端实现通信
  5. 思考R3 R4分别为 R2 与 R5 的反射器
    BGP防环,反射,联盟_第4张图片
    R2
    [R2]un bgp 64523
    Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
    [R2]bgp 200
    [R2-bgp]router-id 2.2.2.2
    [R2-bgp]peer 192.168.12.1 as-number 100
    [R2-bgp]peer 20.20.3.3 as-number 200
    [R2-bgp]peer 20.20.3.3 connect-interface LoopBack 0
    [R2-bgp]peer 20.20.3.3 next-hop-local
    [R2-bgp]import-route direct

R3
[R4]un bgp 64523
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 20.20.2.2 as-number 200
[R4-bgp]peer 20.20.2.2 connect-interface LoopBack 0
[R4-bgp]peer 20.20.4.4 as-number 200
[R4-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R4-bgp]import-route direct

R4
[R4]un bgp 64523
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 20.20.3.3 as-number 200
[R4-bgp]peer 20.20.3.3 connect-interface LoopBack 0
[R4-bgp]peer 20.20.5.5 as-number 200
[R4-bgp]peer 20.20.5.5 connect-interface LoopBack 0
[R4-bgp]import-route direct

R5
[R5]un bgp 64545
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R5]bgp 200
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 192.168.56.6 as-number 600
[R5-bgp]peer 20.20.4.4 as-number 200
[R5-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R5-bgp]peer 20.20.4.4 next-hop-local
[R5-bgp]import-route direct

R3 R4 分别建立反射器互为反射器和客户端

R3
Bgp 200
Peer 20.20.4.4 reflect-client

R4
Bgp 200
Peer 20.20.3.3 reflect-client

Save
Y

你可能感兴趣的:(IT,路由交换配置,华为,运维)