MPLS basic experiment

Insert picture description here
[1] Configure IP address
[2] R2, R3, and R4 public networks can communicate with each other first.
Start OSPF protocol
Insert picture description here
Insert picture description here
Insert picture description here
[3] R2 and R4 configure BGP
Insert picture description here
Insert picture description here
because R3 is not configured with BGP, so there will be no subsequent BGP routes on R3. When a private network accesses another private network, because there is no BGP route when the traffic passes through R3, the traffic will be discarded, resulting in a routing black hole
Solution: MPLS

[r2]mpls lsr-id 2.2.2.2    
[r2]mpls            
[r2-mpls]mpls ldp      
[r2-mpls-ldp]q
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]mpls    
[r2-GigabitEthernet0/0/1]mpls ldp   
[r2] route recursive-lookup tunnel  
华为设备默认不为BGP协议执行下一跳标签机制,需要手工开启

R2, R3, and R4 need to be configured
[4] MPLS VPN
(1) Configure MPLS VPN

[r2]ip vpn-instance a    创建名为a的vrf空间
[r2-vpn-instance-a]ipv4-family    进入IPV4的配置模式下
[r2-vpn-instance-a-af-ipv4]route-distinguisher 1:1   RD值
[r2-vpn-instance-a-af-ipv4]vpn-target 1:1   RT值 必须对端的PE端一致
[r2]interface GigabitEthernet 0/0/0    进入链接CE端的接口
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a  关联到vrf空间
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24   配置私有ip地址
注:在关联到vrf空间前不能配置接口ip,否则该地址的直连路由将进入公有路由表;

Because there are two different private networks, both R2 and R4 need to create two VRF spaces

(2) Establish MP-BPG neighbor relationship between PE and PE

[r2-bgp]ipv4-family vpnv4 
[r2-bgp-af-vpnv4]peer 4.4.4.4 enable

Insert picture description here
(3) CE side and PE side interactive routing
static

CE端直接编写静态路由即可;
PE端编写到VRF空间内的静态路由
[r2]ip route-static vpn-instance  a 192.168.1.0 24 192.168.2.1
 将本地vrf空间内的静态和直连路由重发布到BGP协议传递到对端的PE
[r2]bgp 2
[r2-bgp]ipv4 vpn-instance a
[r2-bgp-a]import-route direct 
[r2-bgp-a]import-route static

Insert picture description here
RIP、OSPF

CE端正常启动RP、OSPF即可
PE端,启动VPNV4专用的ospf、RIP协议
[r4]ospf 2 vpn-instance b
[r4-ospf-2]area  0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.2 0.0.0.0
之后使用双向重发布,实现路由共享
[r4]bgp 1 
[r4-bgp]ipv4-family vpn-instance b
[r4-bgp-a]import-route ospf  2 
[r4]ospf 2 vpn-instance b
[r4-ospf-2]import-route bgp  

Insert picture description here

Test:
R1 can access R5 but not R7
Insert picture description here
Insert picture description here
[5] R7 can access R2, R3, R4 loopback
ACL NAT
because NAT cannot take effect on its own traffic, so add a PC simulation user after R7

Insert picture description here
Insert picture description here
test:
Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/m0_53065491/article/details/113481296