1、H3C BGP配置1.14BGP典型配置举例1.14.1BGP基本配置1.组网需求如图1-15所示,所有路由器均运行BGP协议。要求Router A和Router B之间建立EBGP连接,Router B和Router C之间建立IBGP连接,使得Router C能够访问Router A直连的8.1.1.0/24网段。2.组网图图1-15BGP基本配置组网图3.配置步骤(1)配置各接口的IP地址(略)(2)配置IBGP连接为了防止端口状态不稳定引起路由震荡,本举例使用Loopback接口来创建IBGP对等体。使用Loopback接口创建IBGP对等体时,因为Loopback接口不是两对等体实际
2、连接的接口,所以,必须使用peer connect-interface命令将Loopback接口配置为BGP连接的源接口。在AS 65009内部,使用OSPF协议,保证Router B到Router C的Loopback接口路由可达。#配置Router B。 system-viewRouterB bgp 65009RouterB-bgp router-id 2.2.2.2RouterB-bgp peer 3.3.3.3 as-number 65009RouterB-bgp peer 3.3.3.3 connect-interface loopback 0RouterB-bgp quitRout
3、erB ospf 1RouterB-ospf-1 area 0RouterB-ospf-1-area-0.0.0.0 network 2.2.2.2 0.0.0.0RouterB-ospf-1-area-0.0.0.0 network 9.1.1.1 0.0.0.255RouterB-ospf-1-area-0.0.0.0 quitRouterB-ospf-1 quit#配置Router C。 system-viewRouterC bgp 65009RouterC-bgp router-id 3.3.3.3RouterC-bgp peer 2.2.2.2 as-number 65009Rout
4、erC-bgp peer 2.2.2.2 connect-interface loopback 0RouterC-bgp quitRouterC ospf 1RouterC-ospf-1 area 0RouterC-ospf-1-area-0.0.0.0 network 3.3.3.3 0.0.0.0RouterC-ospf-1-area-0.0.0.0 network 9.1.1.0 0.0.0.255RouterC-ospf-1-area-0.0.0.0 quitRouterC-ospf-1 quitRouterC display bgp peerBGP local router ID :
5、 3.3.3.3Local AS number : 65009Total number of peers : 1 Peers in established state : 1 Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State 2.2.2.2 65009 7 10 0 0 00:06:09 Established以上显示信息表明Router B和Router C之间的IBGP连接已经建立。(3)配置EBGP连接EBGP邻居关系的两台路由器(通常属于两个不同运营商),处于不同的AS域,对端的Loopback接口一般路由不可达,所以一般使用直连地址
6、建立BGP邻居。因为要求Router C能够访问Router A直连的8.1.1.0/24网段,所以,建立EBGP连接后,需要将8.1.1.0/24网段路由通告到BGP路由表中。#配置Router A。 system-viewRouterA bgp 65008RouterA-bgp router-id 1.1.1.1RouterA-bgp peer 3.1.1.1 as-number 65009RouterA-bgp network 8.1.1.1 24RouterA-bgp quit#配置Router B。RouterB bgp 65009RouterB-bgp peer 3.1.1.2 a
7、s-number 65008RouterB-bgp quit#查看Router B的BGP对等体的连接状态。RouterB display bgp peerBGP local router ID : 2.2.2.2Local AS number : 65009Total number of peers : 2 Peers in established state : 2 Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State 3.3.3.3 65009 12 10 0 3 00:09:16 Established 3.1.1.2 65008 3 3
8、 0 1 00:00:08 Established可以看出,Router B与Router C、Router B与Router A之间的BGP连接均已建立。#查看Router A的BGP路由表。RouterA display bgp routing-tableTotal Number of Routes: 1BGP Local router ID is 1.1.1.1Status codes: * - valid, - VPNv4 best, - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Ori
9、gin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn* 8.1.1.0/24 0.0.0.0 0 0 i#显示Router B的BGP路由表。RouterB display bgp routing-tableTotal Number of Routes: 1BGP Local router ID is 2.2.2.2Status codes: * - valid, - VPNv4 best, - best, d - damped, h - history, i - internal,
10、 s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn* 8.1.1.0/24 3.1.1.2 0 0 65008i#显示Router C的BGP路由表。RouterC display bgp routing-tableTotal Number of Routes: 1BGP Local router ID is 3.3.3.3Status codes: * - valid, - VPNv4 best, - best, d -
11、 damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn i 8.1.1.0/24 3.1.1.2 0 100 0 65008i从路由表可以看出,Router A没有学到AS 65009内部的任何路由,Router C虽然学到了AS 65008中的8.1.1.0的路由,但因为下一跳3.1.1.2不可达,所以也不是有效路由。(4)配置BGP引入直连路由在Rout
12、er B上配置BGP引入直连路由,以便Router A能够获取到网段9.1.1.0/24的路由,Router C能够获取到网段3.1.1.0/24的路由。#配置Router B。RouterB bgp 65009RouterB-bgp import-route direct#显示Router A的BGP路由表。RouterA display bgp routing-tableTotal Number of Routes: 4BGP Local router ID is 1.1.1.1Status codes: * - valid, - VPNv4 best, - best, d - dampe
13、d, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? incomplete Network NextHop MED LocPrf PrefVal Path/Ogn* 2.2.2.2/32 3.1.1.1 0 0 65009?* 3.1.1.0/24 3.1.1.1 0 0 65009?* 8.1.1.0/24 0.0.0.0 0 0 i* 9.1.1.0/24 3.1.1.1 0 0 65009?以上显示信息表明,在Router B上引入直连路由后,Router A新增了到2.2
14、.2.2/32和9.1.1.0/24两条路由。#显示Router C的BGP路由表。RouterC display bgp routing-tableTotal Number of Routes: 4BGP Local router ID is 3.3.3.3Status codes: * - valid, - VPNv4 best, - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop
15、MED LocPrf PrefVal Path/Ogn i 2.2.2.2/32 2.2.2.2 0 100 0 ?*i 3.1.1.0/24 2.2.2.2 0 100 0 ?*i 8.1.1.0/24 3.1.1.2 0 100 0 65008i* i 9.1.1.0/24 2.2.2.2 0 100 0 ?以上显示信息表明,到8.1.1.0的路由变为有效路由,下一跳为Router A的地址。(5)验证配置结果#使用Ping进行验证。RouterC ping 8.1.1.1 PING 8.1.1.1: 56 data bytes, press CTRL_C to break Reply f
16、rom 8.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms Reply from 8.1.1.1: bytes=56 Sequence=2 ttl=254 time=2 ms Reply from 8.1.1.1: bytes=56 Sequence=3 ttl=254 time=2 ms Reply from 8.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms Reply from 8.1.1.1: bytes=56 Sequence=5 ttl=254 time=2 ms - 8.1.1.1 ping st
17、atistics - 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 2/2/2 ms1.14.2BGP与IGP交互配置1.组网需求如图1-16所示,公司A的所有设备在AS 65008内,公司B的所有设备在AS 65009内,AS 65008和AS 65009通过设备Router A和Router B相连。现要求实现Router A能够访问AS 65009内的网段9.1.2.0/24,Router C能够访问AS 65008内的网段8.1.1.0/24。2.组网图图1
18、-16BGP与IGP交互配置组网图3.配置步骤(1)配置各接口的IP地址(略)(2)配置OSPF在AS 65009内配置OSPF,使得Router B能获取到到9.1.2.0/24网段的路由。#配置Router B。 system-viewRouterB ospf 1RouterB-ospf-1 area 0RouterB-ospf-1-area-0.0.0.0 network 2.2.2.2 0.0.0.0RouterB-ospf-1-area-0.0.0.0 network 9.1.1.0 0.0.0.255RouterB-ospf-1-area-0.0.0.0 quitRouterB-o
19、spf-1 quit#配置Router C。 system-viewRouterC ospf 1RouterC-ospf-1 import-route directRouterC-ospf-1 area 0RouterC-ospf-1-area-0.0.0.0 network 9.1.1.0 0.0.0.255RouterC-ospf-1-area-0.0.0.0 quitRouterC-ospf-1 quit(3)配置EBGP连接配置EBGP连接,并在Router A上将8.1.1.0/24网段通告到BGP路由表中,以便Router B获取到网段8.1.1.0/24的路由。#配置Router
20、 A。 system-viewRouterA bgp 65008RouterA-bgp router-id 1.1.1.1RouterA-bgp peer 3.1.1.1 as-number 65009RouterA-bgp network 8.1.1.0 24RouterA-bgp quit#配置Router B。RouterB bgp 65009RouterB-bgp router-id 2.2.2.2RouterB-bgp peer 3.1.1.2 as-number 65008(4)配置BGP与IGP交互在Router B上配置BGP引入OSPF路由,以便Router A能够获取到到9
21、.1.2.0/24网段的路由。在Router B上配置OSPF引入BGP路由,以便Router C能够获取到到8.1.1.0/24网段的路由。#在Router B上配置BGP引入OSPF路由。RouterB-bgp import-route ospf 1RouterB-bgp quitRouterB ospf 1RouterB-ospf-1 import-route bgpRouterB-ospf-1 quit#查看Router A的BGP路由表。RouterA display bgp routing-tableTotal Number of Routes: 3BGP Local router
22、 ID is 1.1.1.1Status codes: * - valid, - VPNv4 best, - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn* 3.3.3.3/32 3.1.1.1 1 0 65009?* 8.1.1.0/24 0.0.0.0 0 0 i* 9.1.2.0/24 3.1.1.1 1 0 65009?#
23、查看RouterC的路由表。RouterC display ip routing-tableRouting Tables: Public Destinations : 9 Routes : 9Destination/Mask Proto Pre Cost NextHop Interface2.2.2.2/32 OSPF 10 1 9.1.1.1 S2/03.3.3.3/32 Direct 0 0 127.0.0.1 InLoop08.1.1.0/24 O_ASE 150 19.1.1.1S2/09.1.1.0/24 Direct 0 0 9.1.1.2 S2/09.1.1.2/32 Direc
24、t 0 0 127.0.0.1 InLoop09.1.2.0/24 Direct 0 0 9.1.2.1 Eth1/19.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0(5)验证配置结果#使用Ping进行验证。RouterA ping -a 8.1.1.1 9.1.2.1 PING 9.1.2.1: 56 data bytes, press CTRL_C to break Reply from 9.1.2.
25、1: bytes=56 Sequence=1 ttl=254 time=15 ms Reply from 9.1.2.1: bytes=56 Sequence=2 ttl=254 time=31 ms Reply from 9.1.2.1: bytes=56 Sequence=3 ttl=254 time=47 ms Reply from 9.1.2.1: bytes=56 Sequence=4 ttl=254 time=46 ms Reply from 9.1.2.1: bytes=56 Sequence=5 ttl=254 time=47 ms - 9.1.2.1 ping statistics - 5 packet(s) transmitted 5 pa
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1