龙空技术网

BGP路由黑洞解决办法

让我再卷一分钟 1451

前言:

如今咱们对“lsr路由的缺点”大体比较关怀,各位老铁们都需要学习一些“lsr路由的缺点”的相关文章。那么小编也在网上收集了一些关于“lsr路由的缺点””的相关知识,希望看官们能喜欢,小伙伴们快快来了解一下吧!

BGP路由黑洞解决办法

1、BGP全互联;

2、BGP路由引入至IGP,实现BGP与IGP路由同步(不推荐,BGP路由条目过大,IGP无法承担BGP路由条目)

3、BGP对等体之间建立GRE隧道,让双方建立邻居的地址走隧道,BGP路由随下一跳迭代到隧道接口;

4、通过LSP隧道方式,为双方建立邻居的地址分配MPLS 标签形成LSP,BGP路由随下一跳迭代到LSP隧道。

实验一:BGP路由引入至IGP

1、实验拓扑

2、实验步骤

(1)所有基础预配置已提前完成,本次实验室验证192.168.1.1 能ping 通192.168.5.1,在R2、R4上未将BGP路由引入至IGP时,此时BGP与IGP路由时不同步的,在R3上是无去往192.168.1.0/24和192.168.5.0/24的路由,即将目的地址为192.168.1.0和192.168.5.0的报文发送至R3,R3收到后查看无路由,将报文丢弃。关闭BGP同步功能,R2、R4会把收到到的路由发送给其EBGP 对等体,开启BGP同步功能,此时IGP是无192.168.1.0/24和192.168.5.0/24的路由的,即BGP与IGP路由不同步,R2、R4不会把收到到的路由发送给其EBGP 对等体。

undo synchronization # 华为默认关闭BGP同步,且同步功能无法开启(思科可以)

2)在R2、R4上将BGP路由引入至IGP,实现BGP和IGP路由同步,R3有去往192.168.1.0/24和192.168.5.0/24的路由;

3、设备配置

R1配置:

sysname R1#interface GigabitEthernet0/0/0 ip address 10.1.12.1 255.255.255.0 #interface LoopBack0 ip address 1.1.1.1 255.255.255.255 #interface LoopBack10 ip address 192.168.1.1 255.255.255.0  ospf network-type broadcast#bgp 100 router-id 1.1.1.1 group EBGP external peer 10.1.12.2 as-number 200  peer 10.1.12.2 group EBGP  # ipv4-family unicast  undo synchronization  network 192.168.1.0   peer EBGP enable  peer 10.1.12.2 enable  peer 10.1.12.2 group EBGP 

R2配置:

# sysname R2interface GigabitEthernet0/0/0 ip address 10.1.12.2 255.255.255.0 #interface GigabitEthernet0/0/1 ip address 10.1.23.1 255.255.255.0  ospf network-type p2p#interface LoopBack0 ip address 2.2.2.2 255.255.255.255 #bgp 200 router-id 2.2.2.2 timer keepalive 10 hold 150 group EBGP external peer 10.1.12.1 as-number 100  peer 10.1.12.1 group EBGP  group IBGP internal peer IBGP connect-interface LoopBack0 peer 4.4.4.4 as-number 200  peer 4.4.4.4 group IBGP  # ipv4-family unicast  undo synchronization  peer EBGP enable  peer 10.1.12.1 enable  peer 10.1.12.1 group EBGP   peer IBGP enable  peer IBGP next-hop-local   peer 4.4.4.4 enable  peer 4.4.4.4 group IBGP #ospf 10 router-id 2.2.2.2  import-route bgp area 0.0.0.0   network 2.2.2.2 0.0.0.0   network 10.1.23.0 0.0.0.255 

R3配置:

sysname R3#interface GigabitEthernet0/0/0 ip address 10.1.23.2 255.255.255.0  ospf network-type p2p#interface GigabitEthernet0/0/1 ip address 10.1.34.1 255.255.255.0  ospf network-type p2p#interface LoopBack0 ip address 3.3.3.3 255.255.255.255 #ospf 10 router-id 3.3.3.3  area 0.0.0.0   network 3.3.3.3 0.0.0.0   network 10.1.23.0 0.0.0.255   network 10.1.34.0 0.0.0.255 

R4配置:

sysname R4#interface GigabitEthernet0/0/0 ip address 10.1.45.1 255.255.255.0 #interface GigabitEthernet0/0/1 ip address 10.1.34.2 255.255.255.0  ospf network-type p2p#interface LoopBack0 ip address 4.4.4.4 255.255.255.255 #bgp 200 router-id 4.4.4.4 timer keepalive 70 hold 210 group EBGP external peer 10.1.45.2 as-number 500  peer 10.1.45.2 group EBGP  group IBGP internal peer IBGP connect-interface LoopBack0 peer 2.2.2.2 as-number 200  peer 2.2.2.2 group IBGP  # ipv4-family unicast  undo synchronization  peer EBGP enable  peer 10.1.45.2 enable  peer 10.1.45.2 group EBGP   peer IBGP enable  peer IBGP next-hop-local   peer 2.2.2.2 enable  peer 2.2.2.2 group IBGP #ospf 10 router-id 4.4.4.4  import-route bgp area 0.0.0.0   network 4.4.4.4 0.0.0.0   network 10.1.34.0 0.0.0.255 

R5配置:

 sysname R5#interface GigabitEthernet0/0/0 ip address 10.1.45.2 255.255.255.0 #interface LoopBack0 ip address 5.5.5.5 255.255.255.255 #interface LoopBack10 ip address 192.168.5.1 255.255.255.0  ospf network-type broadcast#bgp 500 router-id 5.5.5.5 group EBGP external peer 10.1.45.1 as-number 200  peer 10.1.45.1 group EBGP  # ipv4-family unicast  undo synchronization  network 192.168.5.0   peer EBGP enable  peer 10.1.45.1 enable  peer 10.1.45.1 group EBGP #
实验二:R2和R4之间通过建立GRE隧道实现路由迭代

1、实验拓扑

2、实验步骤

(1)在R2和R4上创建GRE隧道接口Tunnel0/0/0

R2的Tunnel0/0/0配置:

interface Tunnel0/0/0 ip address 100.1.1.1 255.255.255.0  tunnel-protocol gre keepalive source 10.1.23.1 destination 10.1.34.2

R4的Tunnel0/0/0配置

interface Tunnel0/0/0 ip address 100.1.1.2 255.255.255.0  tunnel-protocol gre keepalive source 10.1.34.2 destination 10.1.23.1

2)在R2和R4上配置BGP路由下一跳的静态路由,走GRE隧道,优先级设置为1(比直连路由优先级高,比OSPF优先级低,0<1<10),后续BGP建立邻居的TCP连接也走隧道,BGP路由随下一跳迭代到隧道。

#设置去往4.4.4.4的路由下一跳为100.1.1.2(对端隧道接口地址,下一跳不要配置成Tunnel0/0/0方式,否则不通),且优先级为1

ip route-static 4.4.4.4 255.255.255.255 100.1.1.2 preference 1

#设置去往2.2.2.2 的路由下一跳为100.1.1.1(对端隧道接口地址,下一跳不要配置成Tunnel0/0/0方式,否则不通),且优先级为1

ip route-static 2.2.2.2 255.255.255.255 100.1.1.1 preference 1
实验三:通过建立LSP将BGP路由迭代到LSP隧道

1.实验拓扑

2.实验步骤

1)删除实验2中的GRE的配置,在R2、R3、R4上配置MPLS、MPLS LDP;后续在R2、R4上配置route recursive-lookup tunnel,即将路由迭代到LSP隧道;

R2配置:

[V200R003C00]# sysname R2# snmp-agent local-engineid 800007DB03000000000000 snmp-agent # clock timezone China-Standard-Time minus 08:00:00#portal local-server load flash:/portalpage.zip# drop illegal-mac alarm# wlan ac-global carrier id other ac id 0# set cpu-usage threshold 80 restore 75#mpls lsr-id 2.2.2.2mpls#mpls ldp##aaa  authentication-scheme default authorization-scheme default accounting-scheme default domain default  domain default_admin  local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http#firewall zone Local priority 15#interface GigabitEthernet0/0/0 ip address 10.1.12.2 255.255.255.0 #interface GigabitEthernet0/0/1 ip address 10.1.23.1 255.255.255.0  ospf network-type p2p mpls mpls ldp#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0 ip address 2.2.2.2 255.255.255.255 [R2]dis cur[V200R003C00]# sysname R2# snmp-agent local-engineid 800007DB03000000000000 snmp-agent # clock timezone China-Standard-Time minus 08:00:00#portal local-server load flash:/portalpage.zip# drop illegal-mac alarm# wlan ac-global carrier id other ac id 0# set cpu-usage threshold 80 restore 75#mpls lsr-id 2.2.2.2mpls#mpls ldp##aaa  authentication-scheme default authorization-scheme default accounting-scheme default domain default  domain default_admin  local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http#firewall zone Local priority 15#interface GigabitEthernet0/0/0 ip address 10.1.12.2 255.255.255.0 #interface GigabitEthernet0/0/1 ip address 10.1.23.1 255.255.255.0  ospf network-type p2p mpls mpls ldp#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0 ip address 2.2.2.2 255.255.255.255 #bgp 200 router-id 2.2.2.2 timer keepalive 10 hold 150 group EBGP external peer 10.1.12.1 as-number 100  peer 10.1.12.1 group EBGP  group IBGP internal peer IBGP connect-interface LoopBack0 peer 4.4.4.4 as-number 200  peer 4.4.4.4 group IBGP  # ipv4-family unicast  undo synchronization  peer EBGP enable  peer 10.1.12.1 enable  peer 10.1.12.1 group EBGP   peer IBGP enable  peer IBGP next-hop-local   peer 4.4.4.4 enable  peer 4.4.4.4 group IBGP #ospf 10 router-id 2.2.2.2  area 0.0.0.0   network 2.2.2.2 0.0.0.0   network 10.1.23.0 0.0.0.255 #route recursive-lookup tunnel   # 将路由迭代到隧道#user-interface con 0 authentication-mode passworduser-interface vty 0 4user-interface vty 16 20#wlan ac#return

R3配置:

<R3>dis cur[V200R003C00]# sysname R3# snmp-agent local-engineid 800007DB03000000000000 snmp-agent # clock timezone China-Standard-Time minus 08:00:00#portal local-server load flash:/portalpage.zip# drop illegal-mac alarm# wlan ac-global carrier id other ac id 0# set cpu-usage threshold 80 restore 75#mpls lsr-id 3.3.3.3mpls#mpls ldp##aaa  authentication-scheme default authorization-scheme default accounting-scheme default domain default  domain default_admin  local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http#firewall zone Local priority 15#interface GigabitEthernet0/0/0 ip address 10.1.23.2 255.255.255.0  ospf network-type p2p mpls mpls ldp#interface GigabitEthernet0/0/1 ip address 10.1.34.1 255.255.255.0  ospf network-type p2p mpls mpls ldp#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0 ip address 3.3.3.3 255.255.255.255 #ospf 10 router-id 3.3.3.3  area 0.0.0.0   network 3.3.3.3 0.0.0.0   network 10.1.23.0 0.0.0.255   network 10.1.34.0 0.0.0.255#user-interface con 0 authentication-mode passworduser-interface vty 0 4user-interface vty 16 20#wlan ac#return

R4配置:

[R4]dis cur[V200R003C00]# sysname R4# snmp-agent local-engineid 800007DB03000000000000 snmp-agent # clock timezone China-Standard-Time minus 08:00:00#portal local-server load flash:/portalpage.zip# drop illegal-mac alarm# wlan ac-global carrier id other ac id 0# set cpu-usage threshold 80 restore 75#mpls lsr-id 4.4.4.4mpls#mpls ldp##aaa  authentication-scheme default authorization-scheme default accounting-scheme default domain default  domain default_admin  local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http#firewall zone Local priority 15#interface GigabitEthernet0/0/0 ip address 10.1.45.1 255.255.255.0 #interface GigabitEthernet0/0/1 ip address 10.1.34.2 255.255.255.0  ospf network-type p2p mpls mpls ldp#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0 ip address 4.4.4.4 255.255.255.255 #bgp 200 router-id 4.4.4.4 timer keepalive 70 hold 210 group EBGP external peer 10.1.45.2 as-number 500  peer 10.1.45.2 group EBGP  group IBGP internal peer IBGP connect-interface LoopBack0 peer 2.2.2.2 as-number 200  peer 2.2.2.2 group IBGP  # ipv4-family unicast  undo synchronization  peer EBGP enable  peer 10.1.45.2 enable  peer 10.1.45.2 group EBGP   peer IBGP enable  peer IBGP next-hop-local   peer 2.2.2.2 enable  peer 2.2.2.2 group IBGP #ospf 10 router-id 4.4.4.4  area 0.0.0.0   network 4.4.4.4 0.0.0.0   network 10.1.34.0 0.0.0.255 #route recursive-lookup tunnel # 将路由迭代到隧道#user-interface con 0 authentication-mode passworduser-interface vty 0 4user-interface vty 16 20#wlan ac#return[R4]

(2)通过建立LSP,建立邻居的环回口通过LSP转发,BGP邻居的TCP连接也走LSP,后续的路由通过route recursive-lookup tunnel配置迭代到LSP隧道,在R1上ping -a 192.168.1.1 -c 1000 192.168.5.1,在R3的G0/0/0抓包,ICMP报文的确走LSP隧道;

标签: #lsr路由的缺点