第40章 MPLS VPN Hub-Spoke

图片[1]-第40章 MPLS VPN Hub-Spoke-大赛人网
图40-1 MPLS VPN Hub-Spoke配置网络拓扑

1.Hub-PE配置OSPF

[Hub-PE]ospf 1 router-id 2.2.2.2
[Hub-PE-ospf-1]area 0
[Hub-PE-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[Hub-PE-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255
[Hub-PE-ospf-1-area-0.0.0.0]network 24.1.1.0 0.255.255.255

2.Hub-Spoke1配置OSPF

[Spoke-PE1]ospf 1 router-id 3.3.3.3
[Spoke-PE1-ospf-1]area 0
[Spoke-PE1-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[Spoke-PE1-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255

3.Hub-Spoke2配置OSPF

[Spoke-PE2]ospf 1 router-id 4.4.4.4 
[Spoke-PE2-ospf-1]area 0
[Spoke-PE2-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[Spoke-PE2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.255.255.255

4.Hub-CE配置

[Hub-CE]bgp 100
[Hub-CE-bgp]peer 12.1.1.2 as-number 234
[Hub-CE-bgp]peer 21.1.1.2 as-number 234
[Hub-CE-bgp]import-route direct

5.Hub-PE配置VPN

[Hub-PE]ip vpn-instance dsrw_in
[Hub-PE-vpn-instance-dsrw_in]route-distinguisher 100:21
[Hub-PE-vpn-instance-dsrw_in-af-ipv4]vpn-target 100:1 import-extcommunity
 
[Hub-PE]ip vpn-instance dsrw_out            
[Hub-PE-vpn-instance-dsrw_out]route-distinguisher 100:22
[Hub-PE-vpn-instance-dsrw_out-af-ipv4]vpn-target 200:1 ex
[Hub-PE-vpn-instance-dsrw_out-af-ipv4]vpn-target 200:1 export-extcommunity

[Hub-PE]interface GigabitEthernet 0/0/0
[Hub-PE-GigabitEthernet0/0/0]ip binding vpn-instance dsrw_in
[Hub-PE-GigabitEthernet0/0/0]ip address 12.1.1.2 8
[Hub-PE]interface GigabitEthernet 1/0/0
[Hub-PE-GigabitEthernet1/0/0]ip binding vpn-instance dsrw_out
[Hub-PE-GigabitEthernet1/0/0]ip address 21.1.1.2 8

6.Hub-PE配置MPLS、LDP

[Hub-PE]mpls lsr-id 2.2.2.2
[Hub-PE]mpls
[Hub-PE]interface GigabitEthernet 0/0/1
[Hub-PE-GigabitEthernet0/0/1]mpls
[Hub-PE-GigabitEthernet0/0/1]mpls ldp
[Hub-PE]interface GigabitEthernet 0/0/2
[Hub-PE-GigabitEthernet0/0/2]mpls
[Hub-PE-GigabitEthernet0/0/2]mpls ldp

7.Hub-PE配置BGP

[Hub-PE]bgp 234
[Hub-PE-bgp]peer 3.3.3.3 as-number 234
[Hub-PE-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[Hub-PE-bgp]peer 4.4.4.4 as-number 234
[Hub-PE-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[Hub-PE-bgp]ipv4-family vpnv4
[Hub-PE-bgp-af-vpnv4]peer 3.3.3.3 enable 
[Hub-PE-bgp-af-vpnv4]peer 4.4.4.4 enable
[Hub-PE-bgp]ipv4-family vpn-instance dsrw_in
[Hub-PE-bgp-dsrw_in]peer 12.1.1.1 as-number 100
[Hub-PE-bgp-dsrw_in]import-route direct
[Hub-PE-bgp]ipv4-family vpn-instance dsrw_out
[Hub-PE-bgp-dsrw_out]peer 21.1.1.1 as-number 100
[Hub-PE-bgp-dsrw_out]import-route direct
[Hub-PE-bgp-dsrw_out]peer 21.1.1.1 allow-as-loop 

8.Spoke-PE1配置VPN

[Spoke-PE1]IP vpn-instance dsrw
[Spoke-PE1-vpn-instance-dsrw]route-distinguisher 100:1
[Spoke-PE1-vpn-instance-dsrw-af-ipv4]vpn-target 100:1 export-extcommunity 
[Spoke-PE1-vpn-instance-dsrw-af-ipv4]vpn-target 200:1 import-extcommunity
[Spoke-PE1]interface GigabitEthernet 0/0/0
[Spoke-PE1-GigabitEthernet0/0/0]ip binding vpn-instance dsrw
[Spoke-PE1-GigabitEthernet0/0/0]ip address 35.1.1.3 8

9.Spoke-PE1配置MPLS、LDP

[Spoke-PE1]mpls lsr-id 3.3.3.3
[Spoke-PE1]mpls
[Spoke-PE1]mpls ldp
[Spoke-PE1]interface GigabitEthernet 0/0/1
[Spoke-PE1-GigabitEthernet0/0/1]mpls
[Spoke-PE1-GigabitEthernet0/0/1]mpls ldp

10.Spoke-PE1配置BGP

[Spoke-PE1]bgp 234
[Spoke-PE1-bgp]peer 2.2.2.2 as-number 234
[Spoke-PE1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[Spoke-PE1-bgp]ipv4-family vpnv4
[Spoke-PE1-bgp-af-vpnv4]peer 2.2.2.2 enable

[Spoke-PE1-bgp]ipv4-family vpn-instance dsrw
[Spoke-PE1-bgp-dsrw]peer 35.1.1.5 as-number 500
[Spoke-PE1-bgp-dsrw]import-route direct  

11.Spoke-PE2配置VPN

[Spoke-PE2]ip vpn-instance dsrw
[Spoke-PE2-vpn-instance-dsrw]route-distinguisher 100:3
[Spoke-PE2-vpn-instance-dsrw-af-ipv4]vpn-target 100:1 export-extcommunity 
[Spoke-PE2-vpn-instance-dsrw-af-ipv4]vpn-target 200:1 import-extcommunity
[Spoke-PE2]interface GigabitEthernet 0/0/0
[Spoke-PE2-GigabitEthernet0/0/0]ip binding vpn-instance dsrw
[Spoke-PE2-GigabitEthernet0/0/0]ip address 46.1.1.4 8

12.Spoke-PE2配置MPLS、LDP

[Spoke-PE2]mpls lsr-id 4.4.4.4
[Spoke-PE2]mpls
[Spoke-PE2]mpls ldp
[Spoke-PE2]interface GigabitEthernet 0/0/2
[Spoke-PE2-GigabitEthernet0/0/2]mpls
[Spoke-PE2-GigabitEthernet0/0/2]mpls ldp
[Spoke-PE2]interface GigabitEthernet 0/0/0
[Spoke-PE2-GigabitEthernet0/0/0]ip binding vpn-instance dsrw
[Spoke-PE2-GigabitEthernet0/0/0]ip address 46.1.1.4 255.0.0.0 

13.Spoke-PE2配置BGP

[Spoke-PE2]bgp 234
[Spoke-PE2-bgp]peer 2.2.2.2 as-number 234
[Spoke-PE2-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[Spoke-PE2-bgp]ipv4-family vpnv4
[Spoke-PE2-bgp-af-vpnv4]peer 2.2.2.2 enable
[Spoke-PE2-bgp]ipv4-family vpn-instance dsrw
[Spoke-PE2-bgp-dsrw]peer 46.1.1.6 as-number 600
[Spoke-PE2-bgp-dsrw]import-route direct 

14.Spoke-CE1配置

[Spoke-CE1]bgp 500
[Spoke-CE1-bgp]peer 35.1.1.3 as-number 234
[Spoke-CE1-bgp]import-route direct

15.Spoke-CE2配置

[Spoke-CE2]bgp 600
[Spoke-CE2-bgp]peer 46.1.1.4 as-number 234
[Spoke-CE2-bgp]import-route direct

16.Spoke-CE1连通性测试

[Spoke-CE1]ping 6.6.6.6
  PING 6.6.6.6: 56  data bytes, press CTRL_C to break
    Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=250 time=110 ms
    Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=250 time=50 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=250 time=60 ms
    Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=250 time=40 ms
    Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=250 time=40 ms

17.Spoke-CE1路由跟踪

[Spoke-CE1]tracert 6.6.6.6
 traceroute to  6.6.6.6(6.6.6.6), max hops: 30 ,packet length: 40,press CTRL_C to break 
 1 35.1.1.3 20 ms  30 ms  20 ms 
 2 21.1.1.2 < AS=234 > 30 ms  30 ms  30 ms 
 3 21.1.1.1 < AS=234 > 30 ms  30 ms  30 ms 
 4 12.1.1.2 < AS=100 > 40 ms  20 ms  20 ms 
 5 46.1.1.4 < AS=234 > 40 ms  40 ms  50 ms 
 6 46.1.1.6 < AS=234 > 40 ms  40 ms  40 ms 

18.Spoke-CE1查看路由表

[Spoke-CE1]display bgp routing-table
 *>   1.1.1.1/32         35.1.1.3                              0      234 100?
 *>   5.5.5.5/32         0.0.0.0         0                     0      ?
 *>   6.6.6.6/32         35.1.1.3                              0      234 100 234 600?
 *>   12.0.0.0           35.1.1.3                              0      234 100?
 *>   21.0.0.0           35.1.1.3                              0      234?
 *>   35.0.0.0           0.0.0.0         0                     0      ?
                         35.1.1.3        0                     0      234?
 *>   35.1.1.5/32        0.0.0.0         0                     0      ?
 *>   46.0.0.0           35.1.1.3                              0      234 100 234?
 *>   127.0.0.0          0.0.0.0         0                     0      ?
 *>   127.0.0.1/32       0.0.0.0         0                     0      ?
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称

    请登录后查看评论内容