
华为BGP与IGP路由互通(互相引入)配置示例
1、组网需求
图1 BGP与IGP互通组网示例图
如上图1所示,用户将网络划分为AS65008和AS65009,在AS65009内,使用IGP协议来计算路由(该例使用OSPF做为IGP协议)。
要求实现两个AS之间的互相通信。
2、配置思路
2.1、在SwitchB和SwitchC上配置OSPF协议,使SwitchB和SwitchC之间可以互访。
2.2、在SwitchA和SwitchB上配置EBGP连接,使SwitchA和SwitchB之间可以通过BGP相互传递路由。
2.3、在SwitchB上配置BGP与OSPF互相引入,实现两个AS之间的互相通信。
2.4、(可选)在SwitchB上配置BGP路由聚合,简化BGP路由表。
3、配置步骤
3.1、配置各接口所属的VLAN
# 配置SwitchA。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 30
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port link-type trunk
[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port link-type trunk
[SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 30
[SwitchA-GigabitEthernet1/0/2] quit
SwitchB和SwitchC的配置同SwitchA(略)
3.2、配置各VLANIF接口的IP地址
# 配置SwitchA。
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 10.3.1.2 24
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] ip address 10.8.1.1 24
[SwitchA-Vlanif30] quit
SwitchB和SwitchC的配置同SwitchA(略)
3.3、配置OSPF
# 配置SwitchB。
[SwitchB] ospf 1
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.9.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置SwitchC。
[SwitchC] ospf 1
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.9.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.9.2.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
3.4、配置EBGP连接
# 配置SwitchA。
[SwitchA] bgp 65008
[SwitchA-bgp] router-id 10.1.1.1
[SwitchA-bgp] peer 10.3.1.1 as-number 65009
[SwitchA-bgp] ipv4-family unicast
[SwitchA-bgp-af-ipv4] network 10.8.1.0 255.255.255.0
[SwitchA-bgp-af-ipv4] quit
[SwitchA-bgp] quit
# 配置SwitchB。
[SwitchB] bgp 65009
[SwitchB-bgp] router-id 10.2.2.2
[SwitchB-bgp] peer 10.3.1.2 as-number 65008
3.5、配置BGP与IGP互通
# 在SwitchB上配置BGP引入OSPF路由。
[SwitchB-bgp] ipv4-family unicast
[SwitchB-bgp-af-ipv4] import-route ospf 1
[SwitchB-bgp-af-ipv4] quit
[SwitchB-bgp] quit
# 查看SwitchA的路由表。
[SwitchA] display bgp routing-table
BGP Local router ID is 10.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.8.1.0/24 0.0.0.0 0 0 i
*> 10.9.1.0/24 10.3.1.1 0 0 65009?
*> 10.9.2.0/24 10.3.1.1 2 0 65009?
# 在SwitchB上配置OSPF引入BGP路由。
[SwitchB] ospf
[SwitchB-ospf-1] import-route bgp
[SwitchB-ospf-1] quit
# 查看SwitchC的路由表。
[SwitchC] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.8.1.0/24 O_ASE 150 1 D 10.9.1.1 Vlanif20
10.9.1.0/24 Direct 0 0 D 10.9.1.2 Vlanif20
10.9.1.2/32 Direct 0 0 D 127.0.0.1 Vlanif20
10.9.2.0/24 Direct 0 0 D 10.9.2.1 Vlanif40
10.9.2.1/32 Direct 0 0 D 127.0.0.1 Vlanif40
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
3.6、配置路由自动聚合
# 配置SwitchB。
[SwitchB] bgp 65009
[SwitchB-bgp] ipv4-family unicast
[SwitchB-bgp-af-ipv4] summary automatic
[SwitchB-bgp-af-ipv4] quit
[SwitchB-bgp] quit
# 查看SwitchA的BGP路由表。
[SwitchA] display bgp routing-table
BGP Local router ID is 10.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.8.1.0/24 0.0.0.0 0 0 i
*> 10.0.0.0 10.3.1.1 0 65009?
# 使用Ping进行验证。
[SwitchA] ping -a 10.8.1.1 10.9.2.1
PING 10.9.2.1: 56 data bytes, press CTRL_C to break
Reply from 10.9.2.1: bytes=56 Sequence=1 ttl=253 time=15 ms
Reply from 10.9.2.1: bytes=56 Sequence=2 ttl=253 time=31 ms
Reply from 10.9.2.1: bytes=56 Sequence=3 ttl=253 time=47 ms
Reply from 10.9.2.1: bytes=56 Sequence=4 ttl=253 time=46 ms
Reply from 10.9.2.1: bytes=56 Sequence=5 ttl=253 time=47 ms
--- 10.9.2.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/37/47 ms
4、配置文件
4.1、SwitchA的配置文件
#
sysname SwitchA
#
vlan batch 10 30
#
interface Vlanif10
ip address 10.3.1.2 255.255.255.0
#
interface Vlanif30
ip address 10.8.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk allow-pass vlan 30
#
bgp 65008
router-id 10.1.1.1
peer 10.3.1.1 as-number 65009
#
ipv4-family unicast
undo synchronization
network 10.8.1.0 255.255.255.0
peer 10.3.1.1 enable
#
return
4.2、SwitchB的配置文件
#
sysname SwitchB
#
vlan batch 10 20
#
interface Vlanif10
ip address 10.3.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.9.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
bgp 65009
router-id 10.2.2.2
peer 10.3.1.2 as-number 65008
#
ipv4-family unicast
undo synchronization
summary automatic
import-route ospf 1
peer 10.3.1.2 enable
#
ospf 1
import-route bgp
area 0.0.0.0
network 10.9.1.0 0.0.0.255
#
return
4.3、SwitchC的配置文件
#
sysname SwitchC
#
vlan batch 20 40
#
interface Vlanif20
ip address 10.9.1.2 255.255.255.0
#
interface Vlanif40
ip address 10.9.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1
area 0.0.0.0
network 10.9.1.0 0.0.0.255
network 10.9.2.0 0.0.0.255
#
return



本文地址:http://www.023wg.com/lypz/201.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

