MPLA实验

ISP部分配置ospf公网互通,再起bgp

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0

[R2]bgp 1
[R2-bgp]peer 4.4.4.4 as-number 1
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0

[R4]bgp 1
[R4-bgp]peer 2.2.2.2 as-number 1
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0

搭建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

[R3]mpls lsr-id 3.3.3.3
[R3]mpls
[R3-mpls]mpls ldp
[R3-mpls-ldp]q
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]mpls 
[R3-GigabitEthernet0/0/0]mpls ldp
[R3-GigabitEthernet0/0/0]q
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]mpls ld    
[R3-GigabitEthernet0/0/1]mpls ldp 

[R4]mpls lsr-id 4.4.4.4
[R4]mpls 
[R4-mpls]mpls ldp
[R4-mpls-ldp]q
[R4]interface g0/0/0    
[R4-GigabitEthernet0/0/0]mpls 
[R4-GigabitEthernet0/0/0]mpls ldp

配置MPLS VPN到私网路由器上

连接R1接口
[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地址
连接R5接口
[R4]ip vpn-instance a
[R4-vpn-instance-a]ipv4-family
[R4-vpn-instance-a-af-ipv4]route-distinguisher 1:1    
[R4-vpn-instance-a-af-ipv4]vpn-target 1:1    
[R4-vpn-instance-a-af-ipv4]q
[R4-vpn-instance-a]q
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip binding vpn-instance a
[R4-GigabitEthernet0/0/1]ip address 192.168.3.2 24
连接R6接口:
[R2]ip vpn-instance b
[R2-vpn-instance-b]ipv    
[R2-vpn-instance-b]ipv4-family
[R2-vpn-instance-b-af-ipv4]route-distinguisher 2:2
[R2-vpn-instance-b-af-ipv4]vpn-target 2:2
[R2-vpn-instance-b-af-ipv4]q
[R2-vpn-instance-b]q
[R2]interface GigabitEthernet 0/0/2
[R2-GigabitEthernet0/0/2]ip binding vpn-instance b
[R2-GigabitEthernet0/0/2]ip address 192.168.2.2 24
连接R7接口
[R4]ip vpn-instance b
[R4-vpn-instance-b]ipv4-family 
[R4-vpn-instance-b-af-ipv4]route-distinguisher 2:2
[R4-vpn-instance-b-af-ipv4]vpn-target 2:2
[R4-vpn-instance-b-af-ipv4]q
[R4-vpn-instance-b]q
[R4]interface g0/0/2
[R4-GigabitEthernet0/0/2]ip binding vpn-instance b
[R4-GigabitEthernet0/0/2]ip address 192.168.3.1 24
建立 MP-BGP邻居关系

[R2]bgp 1
[R2-bgp]router-id 2.2.2.2
[R2-bgp]pe 4.4.4.4 as-number 1
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]ipv4-family vpnv4
[R2-bgp-af-vpnv4]peer 4.4.4.4 enable 
[R4]bgp 1
[R4-bgp]p    
[R4-bgp]preference
[R4-bgp]pe2.2.2.2  as-number 1
[R4-bgp]peer 2.2.2.2 next-hop-local    
[R4-bgp]ipv4-family vpnv4
[R4-bgp-af-vpnv4]peer 2.2.2.2 enable 
交换路由 PE - CE端
R2上要在vpn空间里写静态 并在BGP里进行双向重发布,使R2学习到R1路由通过标签传递给R4的vpn空间,实际传给了R5

[R2]ip route-static vpn-instance a 192.168.1.0 24 192.168.2.1
[R2]ip route-static vpn-instance a 192.168.2.0 24 192.168.2.1
[R2]bgp 1
[R2-bgp]ipv4 vpn-instance a
[R2-bgp-a]import-route direct 
[R2-bgp-a]import-route static 

R4和R5
R5手写到分公司R1的静态:
[R5]ip route-static 192.168.1.0 24 192.168.3.2
[R5]ip route-static 192.168.2.0 24 192.168.3.2

[R4]ip route-static vpn-instance a 192.168.3.0 24 192.168.3.1
[R4]ip route-static vpn-instance a 192.168.4.0 24 192.168.3.1
[R4]bgp 1
[R4-bgp]ipv4 vpn-instance a
[R4-bgp-a]import-route direct 
[R4-bgp-a]import-route static 

R6与R2之间:R6上使用rip宣告自己的环回和网段
[R6]rip 1
[R6-rip-1]version 2
[R6-rip-1]undo summary
[R6-rip-1]network 192.168.1.0
[R6-rip-1]network 192.168.2.0

R2
[R2]rip    
[R2]rip 1 vpn-instance b  在VPN空间上起rip
[R2-rip-1]version 2
[R2-rip-1]undo summary 
[R2-rip-1]network 192.168.2.0 进行双向重发布
[R2]rip 1 vpn-instance b
[R2-rip-1]import-route bgp
[R2-rip-1]q
[R2]bgp 1    
[R2-bgp]import-route rip 1    
R7
使用ospf宣告环回和网段
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 192.168.3.2 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 192.168.4.2 0.0.0.0
R4
[R4]bgp 1
[R4-bgp]ipv4-family vpn-instance b
[R4-bgp-b]import-route ospf 2
[R4-bgp-b]q
[R4-bgp]q
[R4]ospf 2 vpn    
[R4]ospf 2 vpn-instance b
[R4-ospf-2]import-route bgp
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值