实验拓扑图;
实验要求:
1.R1-R5为公网,运行ospf
2.R7-R9为私网,做mplsvpn打通私网
3.私网地址基于192.168.0.0划分
实验过程;
1.IP地址规划
规划如图:
2.基础配置(配置IP)
R1;
[Huawei]int l0
[Huawei-LoopBack0]ip add 1.1.1.1 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 13.1.1.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 12.1.1.1 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 15.1.1.1 24
[Huawei-GigabitEthernet0/0/2]int g4/0/0
[Huawei-GigabitEthernet4/0/0]ip add 14.1.1.1 24
R2;
[Huawei]int l0
[Huawei-LoopBack0]ip add 2.2.2.2 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.1.1.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 12.1.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 24.1.1.1 24
[Huawei-GigabitEthernet0/0/2]int g4/0/0
[Huawei-GigabitEthernet4/0/0]ip add 25.1.1.1 24
R3;
[Huawei]int l0
[Huawei-LoopBack0]ip add 3.3.3.3 32
[Huawei-LoopBack0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 13.1.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 23.1.1.2 24
R4;
[Huawei]int l0
[Huawei-LoopBack0]ip add 4.4.4.4 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 24.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 14.1.1.2 24
R5;
[Huawei]int l0
[Huawei-LoopBack0]ip add 5.5.5.5 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 15.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 25.1.1.2 24
R6;
[Huawei]int l0
[Huawei-LoopBack0]ip add 192.168.1.1 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.0.2 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.0.5 30
R7;
[Huawei]int l0
[Huawei-LoopBack0]ip add 192.168.4.1 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.3.2 30
R8;
[Huawei]int l0
[Huawei-LoopBack0]ip add 192.168.6.1 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.5.2 30
R9;
[Huawei]int l0
[Huawei-LoopBack0]ip add 192.168.2.1 24
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.0.6 30
3.公网启OSPF实现公网全通
R1:
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 12.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 13.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 15.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 14.1.1.1 0.0.0.0
R2:
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 25.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0
R3:
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 13.1.1.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
R4:
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
R5:
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 15.1.1.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 25.1.1.2 0.0.0.0
此时,公网全通:
4.公网跑BGP,做MPLS
BGP:
R4:
[Huawei]bgp 2
[Huawei-bgp]peer 3.3.3.3 as-number 2
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[Huawei-bgp]peer 3.3.3.3 next-hop-local
[Huawei-bgp]peer 5.5.5.5 as-number 2
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[Huawei-bgp]peer 5.5.5.5 next-hop-local
[Huawei]route recursive-lookup tunnel
R5:
[Huawei]bgp 2
[Huawei-bgp]peer 3.3.3.3 as-number 2
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[Huawei-bgp]peer 3.3.3.3 next-hop-local
[Huawei-bgp]peer 4.4.4.4 as-number 2
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[Huawei-bgp]peer 4.4.4.4 next-hop-local
[Huawei]route recursive-lookup tunnel
R3:
[Huawei]bgp 2
[Huawei-bgp]peer 4.4.4.4 as-number 2
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[Huawei-bgp]peer 4.4.4.4 next-hop-local
[Huawei-bgp]peer 4.4.4.4 reflect-client
[Huawei-bgp]peer 5.5.5.5 as-number 2
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[Huawei-bgp]peer 5.5.5.5 next-hop-local
[Huawei-bgp]q
[Huawei]route recursive-lookup tunnel
MPLS:
配置命令相似,只给出R3的配置,注意要在公网的所有接口上开启mpls
R3:
[Huawei]mpls lsr-id 3.3.3.3
[Huawei]mpls
[Huawei-mpls]mpls ldp
[Huawei-mpls-ldp]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]mpls
[Huawei-GigabitEthernet0/0/0]mpls ldp
[Huawei-GigabitEthernet0/0/0]q
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]mpls
[Huawei-GigabitEthernet0/0/2]mpls ldp
5.MPLSVPN
R4:
[Huawei]ip vpn-instance a
[Huawei-vpn-instance-a]ipv4-family
[Huawei-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[Huawei-vpn-instance-a-af-ipv4]vpn-target 1:1
[Huawei-vpn-instance-a-af-ipv4]q
[Huawei-vpn-instance-a]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip binding vpn-instance a
[Huawei-GigabitEthernet0/0/1]ip add 192.168.3.1 30
R5:
[Huawei]ip vpn-instance a
[Huawei-vpn-instance-a]ipv4-family
[Huawei-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[Huawei-vpn-instance-a-af-ipv4]vpn-target 1:1
[Huawei-vpn-instance-a-af-ipv4]q
[Huawei-vpn-instance-a]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip binding vpn-instance a
[Huawei-GigabitEthernet0/0/1]ip add 192.168.5.1 30
R3:
[Huawei]ip vpn-instance a
[Huawei-vpn-instance-a]ipv4-family
[Huawei-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[Huawei-vpn-instance-a-af-ipv4]vpn-target 1:1
[Huawei-vpn-instance-a-af-ipv4]q
[Huawei-vpn-instance-a]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip binding vpn-instance a
[Huawei-GigabitEthernet0/0/0]ip add 192.168.0.1 30
6.PE之间建立MP-BGP邻居关系
R4:
[Huawei]bgp 2
[Huawei-bgp]ipv4-family vpnv4
[Huawei-bgp-af-vpnv4]peer 3.3.3.3 enable
[Huawei-bgp-af-vpnv4]peer 5.5.5.5 enable
R5:
[Huawei]bgp 2
[Huawei-bgp]ipv4-family vpnv4
[Huawei-bgp-af-vpnv4]peer 3.3.3.3 enable
[Huawei-bgp-af-vpnv4]peer 4.4.4.4 enable
R3:
[Huawei]bgp 2
[Huawei-bgp]ipv4-family vpnv4
[Huawei-bgp-af-vpnv4]peer 4.4.4.4 enable
[Huawei-bgp-af-vpnv4]peer 5.5.5.5 enable
7.私网启协议,做重发布,要求完成
给出一个区域的示例,其余相似
R7:
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]network 192.168.4.0
[Huawei-rip-1]network 192.168.3.0
R4:
[Huawei]rip 1 vpn-instance a
[Huawei-rip-1]version 2
[Huawei-rip-1]network 192.168.3.0
[Huawei-rip-1]import bgp
[Huawei-rip-1]q
[Huawei]bgp 2
[Huawei-bgp]ipv4-family vpn-instance a
[Huawei-bgp-a]import-route rip 1
效果图: