BGP2

Posted mqqq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BGP2相关的知识,希望对你有一定的参考价值。

技术图片

1) 按照拓扑搭建网络,在所有AS间使用直连接口建立EBGP邻居关系;

2) 在公司总部AS400中,R4与R5,R5与R7,R7与R6,R6与R4间使用环回接口建立IBGP邻居关系,IGP协议使用OSPF;

3) 所有业务网段,与所有设备上的Loopback 0所在网段都能通过BGP路由实现互相访问;

4) 为了使网络资源能充分得到利用,要求业务网段A的流量通过运营商设备转发,业务网段B的流量通过专线转发;

5) 网络管理员进行定期线路检查,现通过适当调整IGP的链路开销值,使得所有经过总部AS的流量都沿着R4-R5-R7-R6路径转发;

6) 网络管理员在检查中发现业务网段B的流量非常大,决定将业务网段B的流量单独沿着R4-R6路径转发(要求BGP路由选路与实际转发路径一致);

7) 公司总部网络将进行改造,在不改变原有配置的基础上,通过增加少量配置实现,R5与R7不参与BGP路径选择。

 

 

1) 按照拓扑搭建网络,在所有AS间使用直连接口建立EBGP邻居关系;

R1:(为例)R1R2R3R4R6都做

bgp 100
 peer 12.1.1.2 as-number 200
 peer 14.1.1.4 as-number 400

2) 在公司总部AS400中,R4与R5,R5与R7,R7与R6,R6与R4间使用环回接口建立IBGP邻居关系,IGP协议使用OSPF;

R4为例(R4R5R6R7都做)bgp 400

 peer 5.5.5.5 as-number 400
 peer 5.5.5.5 connect-interface LoopBack0
 peer 6.6.6.6 as-number 400
 peer 6.6.6.6 connect-interface LoopBack0
 peer 7.7.7.7 as-number 400
 peer 7.7.7.7 connect-interface LoopBack0
 peer 14.1.1.1 as-number 100
  import-route ospf 1
  
ospf 1 router-id 4.4.4.4
 area 0.0.0.0
  network 4.4.4.0 0.0.0.255
  network 5.5.5.0 0.0.0.255
  network 45.1.1.0 0.0.0.255
  network 46.1.1.0 0.0.0.255

3) 所有业务网段,与所有设备上的Loopback 0所在网段都能通过BGP路由实现互相访问;

前3问之前R1到R7的所有命令:

R1: 

interface GigabitEthernet0/0/0
 ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 14.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.0
#
interface LoopBack1
 ip address 11.11.11.11 255.255.255.0
#
bgp 100
 peer 12.1.1.2 as-number 200
 peer 14.1.1.4 as-number 400
 #
 ipv4-family unicast
  undo synchronization
  network 1.1.1.0 255.255.255.0
  network 11.11.11.0 255.255.255.0
  peer 12.1.1.2 enable
  peer 14.1.1.4 enable
#
ip route-static 2.2.2.0 255.255.255.0 12.1.1.2
ip route-static 4.4.4.0 255.255.255.0 14.1.1.4
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

R2:

interface GigabitEthernet0/0/0
 ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.0
#
interface LoopBack1
 ip address 22.22.22.22 255.255.255.0
#
bgp 200
 peer 12.1.1.1 as-number 100
 peer 23.1.1.3 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  network 2.2.2.0 255.255.255.0
  network 22.22.22.0 255.255.255.0
  peer 12.1.1.1 enable
  peer 23.1.1.3 enable
#
ip route-static 1.1.1.0 255.255.255.0 12.1.1.1
ip route-static 3.3.3.0 255.255.255.0 23.1.1.3
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

R3:

interface GigabitEthernet0/0/0
 ip address 23.1.1.3 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 36.1.1.3 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.0
#
interface LoopBack1
 ip address 33.33.33.33 255.255.255.0
#
bgp 300
 peer 23.1.1.2 as-number 200
 peer 36.1.1.6 as-number 400
 #
 ipv4-family unicast
  undo synchronization
  network 3.3.3.0 255.255.255.0
  network 33.33.33.0 255.255.255.0
  peer 23.1.1.2 enable
  peer 36.1.1.6 enable
#
ip route-static 2.2.2.0 255.255.255.0 23.1.1.2
ip route-static 6.6.6.0 255.255.255.0 36.1.1.6
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#

R4:

interface GigabitEthernet0/0/0
 ip address 14.1.1.4 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 46.1.1.4 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 45.1.1.4 255.255.255.0
#
interface NULL0
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.0
#
interface LoopBack1
 ip address 44.44.44.44 255.255.255.0
#
bgp 400
 peer 5.5.5.5 as-number 400
 peer 5.5.5.5 connect-interface LoopBack0
 peer 6.6.6.6 as-number 400
 peer 6.6.6.6 connect-interface LoopBack0
 peer 7.7.7.7 as-number 400
 peer 7.7.7.7 connect-interface LoopBack0
 peer 14.1.1.1 as-number 100
 #
 ipv4-family unicast
  undo synchronization
  network 4.4.4.0 255.255.255.0
  network 44.44.44.0 255.255.255.0
  import-route ospf 1
  peer 5.5.5.5 enable
  peer 5.5.5.5 next-hop-local
  peer 6.6.6.6 enable
  peer 6.6.6.6 next-hop-local
  peer 7.7.7.7 enable
  peer 7.7.7.7 next-hop-local
  peer 14.1.1.1 enable
#
ospf 1 router-id 4.4.4.4
 area 0.0.0.0
  network 4.4.4.0 0.0.0.255
  network 5.5.5.0 0.0.0.255
  network 45.1.1.0 0.0.0.255
  network 46.1.1.0 0.0.0.255
#
ip route-static 1.1.1.0 255.255.255.0 14.1.1.1
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#

R5:

interface GigabitEthernet0/0/0
 ip address 45.1.1.5 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 57.1.1.5 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.0
#
bgp 400
 peer 4.4.4.4 as-number 400
 peer 4.4.4.4 connect-interface LoopBack0
 peer 6.6.6.6 as-number 400
 peer 6.6.6.6 connect-interface LoopBack0
 peer 7.7.7.7 as-number 400
 peer 7.7.7.7 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 4.4.4.4 enable
  peer 4.4.4.4 next-hop-local
  peer 6.6.6.6 enable
  peer 6.6.6.6 next-hop-local
  peer 7.7.7.7 enable
  peer 7.7.7.7 next-hop-local
#
ospf 1 router-id 5.5.5.5
 area 0.0.0.0
  network 4.4.4.0 0.0.0.255
  network 5.5.5.0 0.0.0.255
  network 7.7.7.0 0.0.0.255
  network 45.1.1.0 0.0.0.255
  network 57.1.1.0 0.0.0.255
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac

R6:

interface GigabitEthernet0/0/0
 ip address 36.1.1.6 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 46.1.1.6 255.255.255.0
#
interface GigabitEthernet0/0/2
 ip address 67.1.1.6 255.255.255.0
#
interface NULL0
#
interface LoopBack0
 ip address 6.6.6.6 255.255.255.0
#
interface LoopBack1
 ip address 66.66.66.66 255.255.255.0
#
bgp 400
 peer 4.4.4.4 as-number 400
 peer 4.4.4.4 connect-interface LoopBack0
 peer 5.5.5.5 as-number 400
 peer 5.5.5.5 connect-interface LoopBack0
 peer 7.7.7.7 as-number 400
 peer 7.7.7.7 connect-interface LoopBack0
 peer 36.1.1.3 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  network 6.6.6.0 255.255.255.0
  network 66.66.66.0 255.255.255.0
  import-route ospf 1
  peer 4.4.4.4 enable
  peer 4.4.4.4 next-hop-local
  peer 5.5.5.5 enable
  peer 5.5.5.5 next-hop-local
  peer 7.7.7.7 enable
  peer 7.7.7.7 next-hop-local
  peer 36.1.1.3 enable
#
ospf 1 router-id 6.6.6.6
 area 0.0.0.0
  network 6.6.6.0 0.0.0.255
  network 7.7.7.0 0.0.0.255
  network 46.1.1.0 0.0.0.255
  network 67.1.1.0 0.0.0.255
#
ip route-static 3.3.3.0 255.255.255.0 36.1.1.3
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return

R7:

#
interface GigabitEthernet0/0/0
 ip address 57.1.1.7 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 67.1.1.7 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 7.7.7.7 255.255.255.0
#
bgp 400
 peer 4.4.4.4 as-number 400
 peer 4.4.4.4 connect-interface LoopBack0
 peer 5.5.5.5 as-number 400
 peer 5.5.5.5 connect-interface LoopBack0
 peer 6.6.6.6 as-number 400
 peer 6.6.6.6 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 4.4.4.4 enable
  peer 4.4.4.4 next-hop-local
  peer 5.5.5.5 enable
  peer 5.5.5.5 next-hop-local
  peer 6.6.6.6 enable
  peer 6.6.6.6 next-hop-local
#
ospf 1 router-id 7.7.7.7
 area 0.0.0.0
  network 5.5.5.0 0.0.0.255
  network 6.6.6.0 0.0.0.255
  network 7.7.7.0 0.0.0.255
  network 57.1.1.0 0.0.0.255
  network 67.1.1.0 0.0.0.255
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac

4) 为了使网络资源能充分得到利用,要求业务网段A的流量通过运营商设备转发,业务网段B的流量通过专线转发;

 

以上是关于BGP2的主要内容,如果未能解决你的问题,请参考以下文章