25-BGP典型配置举例
本章节下载: 25-BGP典型配置举例 (212.92 KB)
目 录
本章介绍了BGP路由协议的各种典型配置。
表1 配置适用的产品与软件版本关系
产品 |
软件版本 |
S5830V2&S5820V2系列以太网交换机 |
Release 2208P01,Release 2210 |
如图1所示网络,通过配置BGP基本功能实现不同AS区域下设备之间的路由连通,每台设备都能学习到网络中所有网段的路由,其中两个AS区域间设备通过EBGP连接,同一个AS区域下的设备通过IBGP连接。
图1 BGP基本配置组网图
· 为了防止端口状态不稳定引起路由震荡,本举例使用Loopback接口来创建IBGP对等体。
· 使用Loopback接口创建IBGP对等体时,因为Loopback接口不是两对等体实际连接的接口,所以,必须使用peer connect-interface命令将Loopback接口配置为BGP连接的源接口。
· 在AS 65009内部,使用OSPF协议,保证Switch B到Switch C的Loopback接口路由可达, Switch C到Switch B的Loopback接口路由可达。
· EBGP邻居关系的两台路由器(通常属于两个不同运营商),处于不同的AS域,对端的Loopback接口一般路由不可达,所以一般使用直连地址建立BGP邻居。
· 因为要求Switch C能够访问Switch A直连的8.1.1.0/24网段,所以建立EBGP连接后需要将8.1.1.0/24网段路由通告到BGP路由表中。
(1) 配置各接口的IP地址(略)
# 配置Switch B。
<SwitchB> system-view
[SwitchB] bgp 65009
[SwitchB-bgp] router-id 2.2.2.2
[SwitchB-bgp] peer 3.3.3.3 as-number 65009
[SwitchB-bgp] peer 3.3.3.3 connect-interface loopback 0
[SwitchB-bgp] ipv4-family unicast
[SwitchB-bgp-ipv4] peer 3.3.3.3 enable
[SwitchB-bgp-ipv4] quit
[SwitchB-bgp] quit
[SwitchB] ospf 1
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[SwitchB-ospf-1-area-0.0.0.0] network 9.1.1.1 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] bgp 65009
[SwitchC-bgp] router-id 3.3.3.3
[SwitchC-bgp] peer 2.2.2.2 as-number 65009
[SwitchC-bgp] peer 2.2.2.2 connect-interface loopback 0
[SwitchC-bgp] ipv4-family unicast
[SwitchC-bgp-ipv4] peer 2.2.2.2 enable
[SwitchC-bgp-ipv4] quit
[SwitchC-bgp] quit
[SwitchC] ospf 1
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[SwitchC-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 查看Switch C的BGP对等体的连接状态。
[SwitchC] display bgp peer ipv4
BGP local router ID : 3.3.3.3
Local AS number : 65009
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2.2.2.2 65009 2 2 0 0 00:00:13 Established
以上显示信息表明Switch B和Switch C之间的IBGP连接已经建立。
(3) 配置EBGP连接
# 配置Switch A。
<SwitchA> system-view
[SwitchA] bgp 65008
[SwitchA-bgp] router-id 1.1.1.1
[SwitchA-bgp] peer 3.1.1.1 as-number 65009
[SwitchA-bgp] ipv4-family unicast
[SwitchA-bgp-ipv4] peer 3.1.1.1 enable
[SwitchA-bgp-ipv4] network 8.1.1.0 24
[SwitchA-bgp-ipv4] quit
[SwitchA-bgp] quit
# 配置Switch B。
[SwitchB] bgp 65009
[SwitchB-bgp] peer 3.1.1.2 as-number 65008
[SwitchB-bgp] ipv4-family unicast
[SwitchB-bgp-ipv4] peer 3.1.1.2 enable
[SwitchB-bgp-ipv4] quit
[SwitchB-bgp] quit
# 查看Switch B的BGP对等体的连接状态。
[SwitchB] display bgp peer ipv4
BGP local router ID : 2.2.2.2
Local AS number : 65009
Total number of peers : 2 Peers in established state : 2
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
3.3.3.3 65009 4 4 0 0 00:02:49 Established
3.1.1.2 65008 2 2 0 0 00:00:05 Established
可以看出,Switch B与Switch C、Switch B与Switch A之间的BGP连接均已建立。
# 查看Switch A的BGP路由表。
[SwitchA] display bgp routing-table ipv4
Total number of routes: 1
BGP local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, h - history,
s - suppressed, S - Stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
> 8.1.1.0/24 8.1.1.1 0 0 i
# 显示Switch B的BGP路由表。
[SwitchB] display bgp routing-table ipv4
Total number of routes: 1
BGP local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped, h - history,
s - suppressed, S - Stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
>e 8.1.1.0/24 3.1.1.2 0 0 65008i
# 显示Switch C的BGP路由表。
[SwitchC] display bgp routing-table ipv4
Total number of routes: 1
BGP local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped, h - history,
s - suppressed, S - Stale, i - internal, e - external
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
从路由表可以看出,Switch A没有学到AS 65009内部的任何路由,Switch C虽然学到了AS 65008中的8.1.1.0的路由,但因为下一跳3.1.1.2不可达,所以也不是有效路由。
(4) 配置BGP引入直连路由
在Switch B上配置BGP引入直连路由,以便Switch A能够获取到网段9.1.1.0/24的路由,Switch C能够获取到网段3.1.1.0/24的路由。
# 配置Switch B。
[SwitchB] bgp 65009
[SwitchB-bgp] ipv4-family unicast
[SwitchB-bgp-ipv4] import-route direct
[SwitchB-bgp-ipv4] quit
[SwitchB-bgp] quit
# 显示Switch A的BGP路由表。
[SwitchA] display bgp routing-table ipv4
Total number of routes: 4
BGP local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped, h - history,
s - suppressed, S - Stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
>e 2.2.2.2/32 3.1.1.1 0 0 65009?
e 3.1.1.0/24 3.1.1.1 0 0 65009?
> 8.1.1.0/24 8.1.1.1 0 0 i
>e 9.1.1.0/24 3.1.1.1 0 0 65009?
以上显示信息表明,在Switch B上引入直连路由后,Switch A新增了到达2.2.2.2/32和9.1.1.0/24的两条路由。
# 显示Switch C的BGP路由表。
[SwitchC] display bgp routing-table ipv4
Total number of routes: 4
BGP local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped, h - history,
s - suppressed, S - Stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop 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的路由变为有效路由,下一跳为Switch A的地址。
# 使用Ping进行验证。
[SwitchC] ping 8.1.1.1
PING 8.1.1.1 (8.1.1.1): 56 data bytes
56 bytes from 8.1.1.1: icmp_seq=0 ttl=254 time=10.000 ms
56 bytes from 8.1.1.1: icmp_seq=1 ttl=254 time=4.000 ms
56 bytes from 8.1.1.1: icmp_seq=2 ttl=254 time=4.000 ms
56 bytes from 8.1.1.1: icmp_seq=3 ttl=254 time=3.000 ms
56 bytes from 8.1.1.1: icmp_seq=4 ttl=254 time=3.000 ms
--- 8.1.1.1 ping statistics ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.000/4.800/10.000/2.638 ms
· Switch A
#
vlan 100
#
vlan 200
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
interface Vlan-interface100
ip address 8.1.1.1 255.255.255.0
#
interface Vlan-interface200
ip address 3.1.1.2 255.255.255.0
#
bgp 65008
router-id 1.1.1.1
peer 3.1.1.1 as-number 65009
#
ipv4-family unicast
network 8.1.1.0 255.255.255.0
peer 3.1.1.1 enable
#
· Switch B
#
vlan 200
#
vlan 300
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
interface Vlan-interface200
ip address 3.1.1.1 255.255.255.0
#
interface Vlan-interface300
ip address 9.1.1.1 255.255.255.0
#
bgp 65009
router-id 2.2.2.2
peer 3.1.1.2 as-number 65008
peer 3.3.3.3 as-number 65009
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
import-route direct
peer 3.1.1.2 enable
peer 3.3.3.3 enable
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 9.1.1.0 0.0.0.255
#
· Switch C
#
vlan 300
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
interface Vlan-interface300
ip address 9.1.1.2 255.255.255.0
#
bgp 65009
router-id 3.3.3.3
peer 2.2.2.2 as-number 65009
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
peer 2.2.2.2 enable
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 9.1.1.0 0.0.0.255
#
表2 配置适用的产品与软件版本关系
产品 |
软件版本 |
S5830V2&S5820V2系列以太网交换机 |
Release 2208P01,Release 2210 |
如图2所示网络,Switch B为两台设备形成的IRF,与Switch A和Switch C均通过跨设备的聚合链路连接。通过配置GR(Graceful Restart,平滑重启)功能实现Switch B在主备倒换过程中不会产生路由振荡,报文转发路径也没有任何改变,整个系统可以不间断地转发数据。
图2 BGP GR配置组网图
(1) Switch A的配置
# 配置各接口的IP地址(略)。
# 配置Switch A与Switch B的EBGP连接。
<SwitchA> system-view
[SwitchA] bgp 65008
[SwitchA-bgp] router-id 1.1.1.1
[SwitchA-bgp] peer 200.1.1.1 as-number 65009
# 使能BGP GR功能。
[SwitchA-bgp] graceful-restart
# 将8.0.0.0/8网段路由通告到BGP路由表中。
[SwitchA-bgp] ipv4-family
[SwitchA-bgp-ipv4] network 8.0.0.0
# 使能与Switch B交换BGP IPv4单播路由的能力。
[SwitchA-bgp-ipv4] peer 200.1.1.1 enable
(2) Switch B的配置
# 配置各接口的IP地址(略)。
# 配置Switch B与Switch A的EBGP连接。
<SwitchB> system-view
[SwitchB] bgp 65009
[SwitchB-bgp] router-id 2.2.2.2
[SwitchB-bgp] peer 200.1.1.2 as-number 65008
# 配置Switch B与Switch C的IBGP连接。
[SwitchB-bgp] peer 9.1.1.2 as-number 65009
# 使能BGP GR功能。
[SwitchB-bgp] graceful-restart
# 将200.1.1.0/24和9.1.1.0/24网段路由通告到BGP路由表中。
[SwitchB-bgp] ipv4-family
[SwitchB-bgp-ipv4] network 200.1.1.0 24
[SwitchB-bgp-ipv4] network 9.1.1.0 24
# 使能与Switch A、Switch C交换BGP IPv4单播路由的能力。
[SwitchB-bgp-ipv4] peer 200.1.1.2 enable
[SwitchB-bgp-ipv4] peer 9.1.1.2 enable
(3) Switch C的配置
# 配置各接口的IP地址(略)。
# 配置Switch C与Switch B的IBGP连接。
<SwitchC> system-view
[SwitchC] bgp 65009
[SwitchC-bgp] router-id 3.3.3.3
[SwitchC-bgp] peer 9.1.1.1 as-number 65009
# 使能BGP GR功能。
[SwitchC-bgp] graceful-restart
# 使能与Switch B交换BGP IPv4单播路由的能力。
[SwitchC-bgp] ipv4-family
[SwitchC-bgp-ipv4] peer 9.1.1.1 enable
在Switch A上ping Switch C,同时在Switch B上触发主备倒换,可以发现在整个倒换过程中Switch A都可以ping通Switch C。
· Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 8.1.1.1 255.0.0.0
#
interface Vlan-interface200
ip address 200.1.1.2 255.0.0.0
#
bgp 65008
graceful-restart
router-id 1.1.1.1
peer 200.1.1.1 as-number 65009
#
ipv4-family unicast
network 8.0.0.0 255.0.0.0
peer 200.1.1.1 enable
#
· Switch B
#
vlan 200
#
vlan 400
#
interface Vlan-interface200
ip address 200.1.1.1 255.255.255.0
#
interface Vlan-interface400
ip address 9.1.1.1 255.255.255.0
#
bgp 65009
graceful-restart
router-id 2.2.2.2
peer 9.1.1.2 as-number 65009
peer 200.1.1.2 as-number 65008
#
ipv4-family unicast
network 9.1.1.0 255.255.255.0
network 200.1.1.0 255.255.255.0
peer 9.1.1.2 enable
peer 200.1.1.2 enable
#
· Switch C
vlan 400
#
interface Vlan-interface400
ip address 9.1.1.2 255.255.255.0
#
bgp 65009
graceful-restart
router-id 3.3.3.3
peer 9.1.1.1 as-number 65009
#
ipv4-family unicast
peer 9.1.1.1 enable
#
表3 配置适用的产品与软件版本关系
产品 |
软件版本 |
S5830V2&S5820V2系列以太网交换机 |
Release 2208P01,Release 2210 |
如图3所示网络,在AS 200内使用OSPF作为IGP协议,实现AS内网络层相互可达。AS200内Switch A与Switch C之间存在两条通信链路,在Switch A与Switch C上配置BGP BFD功能来监测通信链路;当Switch A-B-C链路出现故障时设备能够快速感知并通告BGP协议,快速切换到Switch A-D-C链路进行通信。
图3 配置BGP与BFD联动组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Switch A |
Vlan-int100 |
3.0.1.1/24 |
Switch C |
Vlan-int101 |
3.0.2.2/24 |
|
Vlan-int200 |
2.0.1.1/24 |
|
Vlan-int201 |
2.0.2.2/24 |
Switch B |
Vlan-int100 |
3.0.1.2/24 |
Switch D |
Vlan-int200 |
2.0.1.2/24 |
|
Vlan-int101 |
3.0.2.1/24 |
|
Vlan-int201 |
2.0.2.1/24 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF,保证Switch A和Switch C之间路由可达(略)
(3) Switch A上的IBGP配置
# 配置Switch A和Switch C建立两条IBGP连接。
<SwitchA> system-view
[SwitchA] bgp 200
[SwitchA-bgp] peer 3.0.2.2 as-number 200
[SwitchA-bgp] peer 2.0.2.2 as-number 200
[SwitchA-bgp] ipv4-family unicast
[SwitchA-bgp-ipv4] peer 3.0.2.2 enable
[SwitchA-bgp-ipv4] peer 2.0.2.2 enable
[SwitchA-bgp-ipv4] quit
[SwitchA-bgp] quit
# 配置当Switch A与Switch C之间的两条路径均连通时,Switch C与1.1.1.0/24之间的报文使用Switch A<->Switch B<->Switch C这条路径转发。(在Switch A上对发布给对等体2.0.2.2的1.1.1.0/24路由配置较高的MED属性值)
· 定义编号为2000的ACL,允许路由1.1.1.0/24通过。
[SwitchA] acl number 2000
[SwitchA-acl-basic-2000] rule permit source 1.1.1.0 0.0.0.255
[SwitchA-acl-basic-2000] quit
· 定义两个Route-policy,一个名为apply_med_50,为路由1.1.1.0/24设置MED属性值为50;另一个名为apply_med_100,为路由1.1.1.0/24设置MED属性值为100。
[SwitchA] route-policy apply_med_50 permit node 10
[SwitchA-route-policy-apply_med_50-10] if-match ip address acl 2000
[SwitchA-route-policy-apply_med_50-10] apply cost 50
[SwitchA-route-policy-apply_med_50-10] quit
[SwitchA] route-policy apply_med_100 permit node 10
[SwitchA-route-policy-apply_med_100-10] if-match ip address acl 2000
[SwitchA-route-policy-apply_med_100-10] apply cost 100
[SwitchA-route-policy-apply_med_100-10] quit
· 对发布给对等体3.0.2.2的路由应用名为apply_med_50的Route-policy,对发布给对等体2.0.2.2的路由应用名为apply_med_100的Route-policy。
[SwitchA] bgp 200
[SwitchA-bgp] ipv4-family unicast
[SwitchA-bgp-ipv4] peer 3.0.2.2 route-policy apply_med_50 export
[SwitchA-bgp-ipv4] peer 2.0.2.2 route-policy apply_med_100 export
[SwitchA-bgp-ipv4] quit
# 配置当Switch A<->Switch B<->Switch C这条路径发生故障时,BFD能够快速检测并通告BGP协议,使得Switch A<->Switch D<->Switch C这条路径能够迅速生效。
[SwitchA-bgp] peer 3.0.2.2 bfd
[SwitchA-bgp] quit
(4) Switch C上的IBGP配置。
# 配置Switch A和Switch C建立两条IBGP连接。
<SwitchC> system-view
[SwitchC] bgp 200
[SwitchC-bgp] peer 3.0.1.1 as-number 200
[SwitchC-bgp] peer 2.0.1.1 as-number 200
[SwitchC-bgp] ipv4-family unicast
[SwitchC-bgp-ipv4] peer 3.0.1.1 enable
[SwitchC-bgp-ipv4] peer 2.0.1.1 enable
[SwitchC-bgp-ipv4] quit
# 配置当Switch A<->Switch B<->Switch C这条路径发生故障时,BFD能够快速检测并通告BGP协议,使得Switch A<->Switch D<->Switch C这条路径能够迅速生效。
[SwitchC-bgp] peer 3.0.1.1 bfd
[SwitchC-bgp] quit
[SwitchC] quit
(5) Switch A上的EBGP配置(略)
下面以Switch C为例,Switch A和Switch C类似,不再赘述。
# 显示Switch C的BFD信息。
<SwitchC> display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 Session Working Under Ctrl Mode:
Local Discr: 513 Remote Discr: 513
Source IP: 3.0.2.2 Destination IP: 3.0.1.1
Session State: Up Interface: N/A
Min Tx Inter: 500ms Act Tx Inter: 500ms
Min Rx Inter: 500ms Detect Inter: 2500ms
Rx Count: 135 Tx Count: 135
Connect Type: Indirect Running Up for: 00:00:58
Hold Time: 2457ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: BGP
Diag Info: No Diagnostic
以上显示信息表明:Switch A和Switch C之间已经建立了BFD连接,而且BFD协议运行正常。
# 在Switch C上查看BGP邻居信息,可以看出Switch A和Switch C之间建立两条BGP连接,且均处于Established状态。
<SwitchC> display bgp peer ipv4
BGP local router ID: 3.3.3.3
Local AS number: 200
Total number of peers: 2 Peers in established state: 2
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2.0.1.1 200 4 5 0 0 00:01:55 Established
3.0.1.1 200 4 5 0 0 00:01:52 Established
# 在Switch C上查看1.1.1.0/24的路由信息,可以看出Switch C通过Switch A<->Switch B<->Switch C这条路径与1.1.1.0/24网段通信。
<SwitchC> display ip routing-table 1.1.1.0 24 verbose
Summary Count : 1
Destination: 1.1.1.0/24
Protocol: BGP Process ID: 0
SubProtID: 0x1 Age: 00h00m09s
Cost: 50 Preference: 255
Tag: 0 State: Active Adv
OrigTblID: 0x1 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NBRID: 0x15000001 LastAs: 0
AttrID: 0x1 Neighbor: 3.0.1.1
Flags: 0x10060 OrigNextHop: 3.0.1.1
Label: NULL RealNextHop: 3.0.2.1
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface101
BkTunnel ID: Invalid BkInterface: N/A
# 打开Switch C的调试信息开关。
<SwitchC> debugging bgp event
<SwitchC> terminal monitor
<SwitchC> terminal logging level 7
# Switch A和Switch B之间的链路发生故障后,打印如下信息。可以看到,Switch C上BFD能够快速检测到链路故障,并通知BGP协议改变相应的IBGP会话的状态。
%Mar 12 19:02:59:241 2012 SwitchC BFD/6/FSM: -VDC=1; Sess[3.0.2.2/3.0.1.1, LD/RD:
513/513, Interface:N/A, SessType:Ctrl, LinkType:INET], Sta: UP->DOWN, Diag: 1
*Mar 12 19:02:59:242 2012 SwitchC BGP/7/DEBUG: -VDC=1;
BGP.: 3.0.1.1 Receive ManualStop event in ESTABLISHED state.
*Mar 12 19:02:59:242 2012 SwitchC BGP/7/DEBUG: -VDC=1;
BGP.: 3.0.1.1 Send NOTIFICATION
Err/SubErr: 6/0 (Cease/ErrSubCode Unspecified)
Error data NULL.
*Mar 12 19:02:59:243 2012 SwitchC BGP/7/DEBUG: -VDC=1;
BGP.: 3.0.1.1 State is changed from ESTABLISHED to IDLE.
# 在Switch C上查看1.1.1.0/24的路由信息,可以看出Switch C通过Switch A<->Switch D<->Switch C这条路径与1.1.1.0/24网段通信。
<SwitchC> display ip routing-table 1.1.1.0 24 verbose
Summary Count : 1
Destination: 1.1.1.0/24
Protocol: BGP Process ID: 0
SubProtID: 0x1 Age: 00h03m08s
Cost: 100 Preference: 255
Tag: 0 State: Active Adv
OrigTblID: 0x1 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NBRID: 0x15000000 LastAs: 0
AttrID: 0x0 Neighbor: 2.0.1.1
Flags: 0x10060 OrigNextHop: 2.0.1.1
Label: NULL RealNextHop: 2.0.2.1
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface201
BkTunnel ID: Invalid BkInterface: N/A
· Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 3.0.1.1 255.255.255.0
#
interface Vlan-interface200
ip address 2.0.1.2 255.255.255.0
#
bgp 200
router-id 1.1.1.1
peer 3.0.2.2 as-number 200
peer 2.0.2.2 as-number 200
peer 3.0.2.2 bfd
#
ipv4-family unicast
peer 3.0.2.2 enable
peer 2.0.2.2 enable
peer 3.0.2.2 route-policy apply_med_50 export
peer 2.0.2.2 route-policy apply_med_100 export
#
acl number 2000
rule permit source 1.1.1.0 0.0.0.255
#
route-policy apply_med_50 permit node 10
if-match ip address acl 2000
apply cost 50
#
route-policy apply_med_100 permit node 10
if-match ip address acl 2000
apply cost 100
#
ospf 1
area 0.0.0.0
network 3.0.1.1 0.0.0.255
network 2.0.1.1 0.0.0.255
#
· Switch B
#
vlan 100
#
vlan 101
#
interface Vlan-interface100
ip address 3.0.1.2 255.255.255.0
#
interface Vlan-interface101
ip address 3.0.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 3.0.1.2 0.0.0.255
network 3.0.2.1 0.0.0.255
#
· Switch C
#
vlan 101
#
vlan 201
#
interface Vlan-interface101
ip address 3.0.2.2 255.255.255.255
#
interface Vlan-interface201
ip address 2.0.2.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 3.0.1.1 as-number 200
peer 2.0.1.1 as-number 200
peer 3.0.1.1 bfd
#
ipv4-family unicast
peer 3.0.1.1 enable
peer 2.0.1.1 enable
#
ospf 1
area 0.0.0.0
network 3.0.2.2 0.0.0.255
network 2.0.2.2 0.0.0.255
#
#
vlan 200
#
vlan 201
#
interface Vlan-interface200
ip address 2.0.1.2 255.255.255.255
#
interface Vlan-interface201
ip address 2.0.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 2.0.1.2 0.0.0.255
network 2.0.2.1 0.0.0.255
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!