配置目的
掌握路由聚合的原则和方法、反射器的原理和配置方法、 BGP 认证的配置方法、团体属性以及 Community-Filter 的原理和使用方法、 BGP 负载分担的配置方法、 常见属性的用途以及用法路由聚合的原则和方法、路由反射器的原理和配置方法、BGP 认证的配置方法、团体属性以及 Community-Filter 的原理和使用方法、 BGP 负载分担的配置方法,常见属性的用途以及用法。
端口地址规划
设备 | 端口 | 地址 |
R1 | GE0/0/0 | IPv4:10.0.12.1/24 IPv6:2000::1201/120 |
GE0/0/1 | IPv4:10.0.13.1/24 IPv6:2000::1301/120 |
|
LoopBack 0 | IPv4:10.0.1.1/32 IPv6:2000::1/128 |
|
Vlanif1 | IPv4:221.12.128.1/24 | |
Vlanif2 | IPv4:115.192.0.1/24 | |
Vlanif3 | IPv4:10.1.1.1/24 IPv6: 2000:0:0:11::1/64 |
|
R2 | GE0/0/0 | IPv4:10.0.12.2/24 IPv6:2000::1202/120 |
GE0/0/1 | IPv4:10.0.24.2/24 IPv6:2000::2402/120 |
|
LoopBack 0 | IPv4:10.0.2.2/32 IPv6:2000::2/128 |
|
R3 | GE0/0/0 | IPv4:10.0.13.3/24 IPv6:2000::1303/120 |
GE0/0/1 | IPv4:10.0.35.3/24 IPv6:2000::3503/120 |
|
LoopBack 0 | IPv4:10.0.3.3/32 IPv6:2000::3/128 |
|
R4 | GE0/0/0 | IPv4:10.0.46.4/24 IPv6:2000::4604/120 |
GE0/0/1 | IPv4:10.0.24.4/24 IPv6:2000::2404/120 |
|
LoopBack 0 | IPv4:10.0.4.4/32 IPv6:2000::4/128 |
|
R5 | GE0/0/0 | IPv4:10.0.35.5/24 IPv6:2000::3505/120 |
GE0/0/1 | IPv4:10.0.58.5/24 IPv6:2000::5805/120 |
|
LoopBack 0 | IPv4:10.0.5.5/32 IPv6:2000::5/128 |
|
R6 | GE0/0/0 | IPv4:10.0.67.6/24 IPv6:2000::6706/120 |
GE0/0/1 | IPv4:10.0.46.6/24 IPv6:2000::4606/120 |
|
LoopBack 0 | IPv4:10.0.6.6/32 IPv6:2000::6/128 |
|
Vlanif1 | IPv4: 10.1.6.1/24 | |
R7 | GE0/0/0 | IPv4:10.0.67.7/24 IPv6:2000::6707/120 |
GE0/0/1 | IPv4:10.0.78.7/24 IPv6:2000::7807/120 |
|
LoopBack 0 | IPv4:10.0.7.7/32 IPv6:2000::7/128 |
|
Vlanif1 | IPv4:10.1.7.1/24 | |
Vlanif2 | IPv6:2000:0:0:70::1 | |
Vlanif3 | IPv6:2000:0:0:71::1 | |
Vlani4 | IPv6:2000:0:0:72::1 | |
Vlanif5 | IPv6:2000:0:0:73::1 | |
R8 | GE0/0/0 | IPv4:10.0.78.8/24 IPv6:2000::7808/120 |
GE0/0/1 | IPv4:10.0.58.8/24 IPv6:2000::5808/120 |
|
LoopBack 0 | IPv4:10.0.8.8/32 IPv6:2000::8/128 |
|
Vlanif1 | IPv4: 10.1.8.1/24 |
详细配置及思路注释
【R1】
#
sysname R1
#
ipv6 //使能设备 IPv6 地址
#
vlan batch 2 to 6
#
ospfv3 1 //OSPFv3 做为 IGP 协议
router-id 10.0.1.1
#
interface Vlanif1
ip address 221.12.128.1 255.255.255.0
#
interface Vlanif2
ip address 115.192.0.1 255.255.255.0
#
interface Vlanif3
ipv6 enable
ip address 10.1.1.1 255.255.255.0
ipv6 address 2000:0:0:11::1/64
#
interface Ethernet0/0/0
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/0 // 配置设备接口 IPv4 和 IPv6 地址。 在 AS 100 使用 OSPF 和 OSPFv3 做为 IGP 协议。
ipv6 enable
ip address 10.0.12.1 255.255.255.0
ipv6 address 2000::1201/120
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ipv6 enable
ip address 10.0.13.1 255.255.255.0
ipv6 address 2000::1301/120
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
interface LoopBack0
ipv6 enable
ip address 10.0.1.1 255.255.255.255
ipv6 address 2000::1/128
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
bgp 100 //配置 BGP 邻居关系,AS100 内用 LoopBack 0 建立 IBGP 邻居关系,其他 EBGP 邻居关系均使用直连接口地址建立
router-id 10.0.1.1
peer 10.0.2.2 as-number 100
peer 10.0.2.2 connect-interface LoopBack0
peer 10.0.3.3 as-number 100
peer 10.0.3.3 connect-interface LoopBack0
peer 2000::2 as-number 100
peer 2000::2 connect-interface LoopBack0
peer 2000::3 as-number 100
peer 2000::3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 10.0.1.0 255.255.255.0
network 10.0.1.1 255.255.255.255
network 10.1.1.0 255.255.255.0
network 115.192.0.0 255.255.255.0 route-policy add_community
network 221.12.128.0 route-policy add_community //在配置路由策略,在引入 221.12.128.1/24 和 115.192.0.0/24 这两条路由时,附加上相应的 community 属性
maximum load-balancing ibgp 2 //配置 IBGP 邻居的负载分担功能,同时由于两条 10.1.7.0/24 路由的 AS_Path 属性内容不同,需要关闭形成负载分担时比较 AS_Path 属性的机制
load-balancing as-path-ignore
peer 10.0.2.2 enable
peer 10.0.2.2 reflect-client //为了 BGP 路由能在 AS 100 内能够顺利传递 R1 同时作为 R2 和 R3 的反射器。
peer 10.0.2.2 advertise-community
peer 10.0.3.3 enable
peer 10.0.3.3 reflect-client
peer 10.0.3.3 advertise-community
#
ipv6-family unicast
undo synchronization
network 2000:0:0:11:: 64
peer 2000::2 enable
peer 2000::2 reflect-client
peer 2000::3 enable
peer 2000::3 reflect-client
#
ospf 1
area 0.0.0.0
#
route-policy add_community permit node 10
if-match ip-prefix not_to_200
apply community 100:200 additive //将相应的路由引入到 BGP,并使用 Community 属性按照要求进行路由过滤100:200 表示此路由不传递给 AS 200
#
route-policy add_community permit node 20
if-match ip-prefix not_to_400
apply community 100:400 //100:400 表示不传递给 AS 400
#
route-policy add_community permit node 30
#
ip ip-prefix not_to_200 index 10 permit 115.192.0.0 24
ip ip-prefix not_to_400 index 10 permit 221.12.128.0 24
【R2】
#
sysname R2
#
ipv6
#
ospfv3 1
router-id 10.0.2.2
#
interface GigabitEthernet0/0/0
ipv6 enable
ip address 10.0.12.2 255.255.255.0
ipv6 address 2000::1202/120
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ipv6 enable
ip address 10.0.24.2 255.255.255.0
ipv6 address 2000::2402/120
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
interface LoopBack0
ipv6 enable
ip address 10.0.2.2 255.255.255.255
ipv6 address 2000::2/128
ospfv3 1 area 0.0.0.0
ospf enable 1 area 0.0.0.0
#
bgp 100
router-id 10.0.2.2
peer 10.0.1.1 as-number 100
peer 10.0.1.1 connect-interface LoopBack0
peer 10.0.4.4 as-number 100
peer 10.0.4.4 connect-interface LoopBack0
peer 2000::1 as-number 100
p