2021-04-28

2021-04-28
题目要求:
1、R1与R5 MPLS VPN
2、R6与R7 MPLS VPN
3、R7可以访问R2/3/4的环回

一、拓扑搭建
2021-04-28

二、底层配置
1、简单IP配置
[R1]int lo0
[R1-LoopBack0]ip address 192.168.1.1 24
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.2.1 24

[R2-GigabitEthernet0/0/1]int lo0
[R2-LoopBack0]ip address 2.2.2.2 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 23.1.1.1 24

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 23.1.1.2 24
[R3-GigabitEthernet0/0/1]int lo0
[R3-LoopBack0]ip address 3.3.3.3 24
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 34.1.1.1 24

[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 34.1.1.2 24
[R4-GigabitEthernet0/0/1]int lo0
[R4-LoopBack0]ip address 4.4.4.4 24

[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 192.168.3.2 24
[R5-GigabitEthernet0/0/1]int lo0
[R5-LoopBack0]ip address 192.168.4.1 24

[R6]int lo0
[R6-LoopBack0]ip address 192.168.1.3 24
[R6]int g0/0/2
[R6-GigabitEthernet0/0/2]ip address 192.168.2.3 24

[R7-GigabitEthernet0/0/2]int lo0
[R7-LoopBack0]ip address 192.168.4.2 24
[R7-LoopBack0]int g0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.1.1.2 24
[R7-LoopBack0]int g0/0/2
[R7-GigabitEthernet0/0/2]ip address 192.168.3.4 24

2、配置VRF空间
[R2]ip vpn-instance a
[R2-vpn-instance-a]ipv4-family
[R2-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[R2-vpn-instance-a-af-ipv4]vpn-target 1:1
[R2-vpn-instance-a-af-ipv4]int g0/0/1
[R2-GigabitEthernet0/0/1]ip binding vpn-instance a
[R2-GigabitEthernet0/0/1]ip address 192.168.2.2 24

[R2]ip vpn-instance b
[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]int g0/0/2
[R2-GigabitEthernet0/0/2]ip binding vpn-instance b
[R2-GigabitEthernet0/0/2]ip address 192.168.2.4 24

[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]int g0/0/0
[R4-GigabitEthernet0/0/0]ip binding vpn-instance a
[R4-GigabitEthernet0/0/0]ip address 192.168.3.1 24

[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]int g0/0/2
[R4-GigabitEthernet0/0/2]ip binding vpn-instance b
[R4-GigabitEthernet0/0/2]ip address 192.168.3.3 24

2、MPLS配置
[R4]mpls lsr-id 4.4.4.4
[R4-mpls]mpls ldp
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]mpls
[R4-GigabitEthernet0/0/1]mpls ldp

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

[R2]mpls lsr-id 2.2.2.2
[R2]mpls
[R2-mpls]mpls ldp
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]mpls
[R2-GigabitEthernet0/0/0]mpls ldp

[R2]mpls
[R2-mpls]lsp-trigger all

[R4]mpls
[R4-mpls]lsp-trigger all

四、BGP配置
[R2]bgp 2
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 4.4.4.4 as-number 2
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]ipv4
[R2-bgp]ipv4-family vpnv4
[R2-bgp-af-vpnv4]peer 4.4.4.4 enable
[R2-bgp]display bgp vpnv4 all peer

[R4]bgp 2
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 2.2.2.2 as-number 2
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[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
五、私网配置
[R1]ip route-static 192.168.1.0 24 192.168.2.2
[R2]ip route-static vpn-instance a 192.168.1.0 24 192.168.2.1
[R2]bgp 2
[R2-bgp]ipv4-family
[R2-bgp]ipv4 vpn-instance a
[R2-bgp-a]import-route direct
[R2-bgp-a]import-route static
[R5]ip route-static 192.168.4.0 24 192.168.3.1
[R4]ip route-static vpn-instance a 192.168.4.0 24 192.168.3.2
[R4]bgp 2
[R4-bgp]ipv4 vpn-instance a
[R4-bgp-a]import-route direct
[R4-bgp-a]import-route static
[R4-bgp-a]q
[R6]rip 1
[R6-rip-1]version 2
[R6-rip-1]network 192.168.1.0
[R6-rip-1]network 192.168.2.0
[R7]ospf 2
[R7-ospf-2]area 0
[R7-ospf-2-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[R7-ospf-2-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R2]rip 1 vpn-instance b
[R2-rip-1]network 192.168.2.0
[R2-rip-1]version 2
[R2-rip-1]undo summary
[R2-rip-1]import-route bgp
[R2]bgp 2
[R2-bgp]ipv4-family vpn-instance b
[R2-bgp-b]import-route rip 1

[R4]ospf 2 vpn-instance b
[R4-ospf-2]area 0
[R4-ospf-2-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R4-ospf-2]import-route bgp
[R4]bgp 2
[R4-bgp]ipv4-family vpn-instance b
[R4-bgp-b]import-route ospf 2

第二个私网接通公网,实验完成。
————————————————
版权声明:本文为CSDN博主「一起看日落啊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44642263/article/details/109407181

上一篇:计算机网络 互联网的路由选择——BGP


下一篇:主流商用SD-WAN方案真的算是SDN吗?