华为设备配置IP和VPN混合FRR_华为

1. 配置接口IP地址

[PE1-LoopBack1]ip add 1.1.1.1 32

[PE1-GigabitEthernet0/0/0]ip add 10.3.1.1 24

[PE2-LoopBack1]ip add 2.2.2.2 32

[PE2-GigabitEthernet0/0/0]ip add 10.3.1.2 24

[CE-GigabitEthernet0/0/0]ip add 10.1.1.3 24

[CE-GigabitEthernet0/0/1]ip add 10.2.1.3 24  

[CE-GigabitEthernet0/0/2]ip add 10.5.1.3 24

2. 在MPLS骨干网上配置OSPF协议,实现骨干网PE互通

[PE1]ospf 1

[PE1-ospf-1]area 0

[PE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0

[PE1-ospf-1-area-0.0.0.0]network 10.3.1.0 0.0.0.255

[PE2]ospf 1

[PE2-ospf-1]area 0

[PE2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

[PE2-ospf-1-area-0.0.0.0]network 10.3.1.0 0.0.0.255

3. 在MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP

[PE1]mpls lsr-id 1.1.1.1

[PE1]mpls

[PE1]mpls ldp  

[PE1-GigabitEthernet0/0/0]mpls      

[PE1-GigabitEthernet0/0/0]mpls ldp

[PE2]mpls lsr-id 2.2.2.2

[PE2]mpls  

[PE2]mpls ldp  

[PE2-GigabitEthernet0/0/0]mpls      

[PE2-GigabitEthernet0/0/0]mpls ldp

 华为设备配置IP和VPN混合FRR_FRR_02

4. 在PE设备上配置VPN实例,将CE接入PE

[PE1]ip vpn-instance vpn1

[PE1-vpn-instance-vpn1]ipv4-family

[PE1-vpn-instance-vpn1-af-ipv4]route-distinguisher 100:1

[PE1-vpn-instance-vpn1-af-ipv4]vpn-target 1:1

[PE1-GigabitEthernet0/0/1]ip binding vpn-instance vpn1

[PE1-GigabitEthernet0/0/1]ip add 10.1.1.1 24

[PE2]ip vpn-instance vpn1

[PE2-vpn-instance-vpn1]ipv4-family  

100:2

[PE2-vpn-instance-vpn1-af-ipv4]vpn-target 1:1

[PE2-GigabitEthernet0/0/1]ip binding vpn-instance vpn1

[PE2-GigabitEthernet0/0/1]ip add 10.2.1.2 24

5. CE和PE之间配置静态路由。在PE1和PE2上引入直连VPN路由和静态路由

[PE1]ip route-static vpn-instance vpn1 10.1.5.0 24 g0/0/1 10.1.1.3

[PE1]bgp 100

[PE1-bgp]ipv4-family vpn-instance vpn1

[PE1-bgp-vpn1]import-route direct  

[PE1-bgp-vpn1]import-route static

[PE2]ip route-static vpn-instance vpn1 10.5.1.0 24 g0/0/1 10.2.1.3

[PE2]bgp 100

[PE2-bgp]ipv4-family vpn-instance vpn1

[PE2-bgp-vpn1]import-route direct  

[PE2-bgp-vpn1]import-route static

[CE]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1 preference 60

[CE]ip route-static 0.0.0.0 0.0.0.0 10.2.1.2 preference 100

6. 在PE之间建立BGP VPNv4对等体

[PE1]bgp 100

[PE1-bgp]peer 2.2.2.2 as-number 100

[PE1-bgp]peer 2.2.2.2 connect-interface LoopBack 1

[PE1-bgp]ipv4-family vpnv4

[PE1-bgp-af-vpnv4]peer 2.2.2.2 enable

[PE2]bgp 100

[PE2-bgp]peer 1.1.1.1 as-number 100

[PE2-bgp]peer 1.1.1.1 connect-interface LoopBack 1

[PE2-bgp]ipv4-family vpnv4

[PE2-bgp-af-vpnv4]peer 1.1.1.1 enable

7. 配置混合FRR路由策略

[PE1]ip ip-prefix f1 permit 10.1.1.3 32

[PE1]route-policy f1 permit node 10

[PE1-route-policy]if-match ip next-hop ip-prefix f1

[PE1-route-policy]apply backup-nexthop 2.2.2.2

8. 使能IP FRR

[PE1]ip vpn-instance vpn1

[PE1-vpn-instance-vpn1]ipv4-family

[PE1-vpn-instance-vpn1-af-ipv4]ip frr route-policy f1