• MPLS综合实验


    目录

     实验要求

    划分IP地址

    首先对MPLSVPN骨干网络进行配置

    首先配置IP地址

    启动IGP协议

    激活MPLS和LDP

    VRF空间的创建

    将接口划入到VRF空间中

    R1和R5通过静态路由在CE和PE上配置

    建立MP-BGP

    对站点R1和R5进行配置

    首先把IP给配置好

    在VRF空间中发布路由信息

    对站点R6和R7进行配置

    首先把IP给配置好

    CE和PE设备之间动态路由传递

    双向重发布的建立


     实验要求

    1,R1和R5是客户A两个站点的CE设备,R6和R7是客户b两个站点的CE设备。通过MPLSVPN骨干网络分别连接不同客户的不同站点

    2,R1和R5采用静态路由的方式传递私网路由;R6通过RIP将私网路由传递给PE设备;R7通过OSPF将私网路由传递给PE设备

    3,R7单独拉一根网线保证可以访问公网,R7可以访问R2/R3/R4环回

    划分IP地址

    如何我们按区域进行划分

    首先对MPLSVPN骨干网络进行配置

    首先配置IP地址

    因为我们等下还要创建VRF将接口划入VRF时会移除所配置的IP因此等下配置需要划分到VRF的接口

    1. [r2]int l0
    2. [r2-LoopBack0]ip add 2.2.2.2 24
    3. [r2-LoopBack0]int g0/0/2
    4. [r2-GigabitEthernet0/0/2]ip add 23.0.0.1 24
    5. [r3]int l0
    6. [r3-LoopBack0]ip add 3.3.3.3 24
    7. [r3-LoopBack0]int g0/0/0
    8. [r3-GigabitEthernet0/0/0]ip add 23.0.0.2 24
    9. [r3-GigabitEthernet0/0/0]int g0/0/1
    10. [r3-GigabitEthernet0/0/1]ip add 34.0.0.1 24
    11. [r4]int l0
    12. [r4-LoopBack0]ip add 4.4.4.4 24
    13. [r4-LoopBack0]int g0/0/0
    14. [r4-GigabitEthernet0/0/0]ip ad 34.0.0.2 24
    15. [r4-GigabitEthernet0/0/0]int g4/0/0
    16. [r4-GigabitEthernet4/0/0]ip add 47.0.0.1 24

    启动IGP协议

    这里我们选用ospf

    1. [r2]ospf 1 rou
    2. [r2]ospf 1 router-id 2.2.2.2
    3. [r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
    4. [r2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
    5. [r3]ospf 1 router-id 3.3.3.3
    6. [r3-ospf-1]area 0
    7. [r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
    8. [r3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
    9. [r4]ospf 1 router-id 4.4.4.4
    10. [r4-ospf-1]a 0
    11. [r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
    12. [r4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255

    此时骨干已通

    激活MPLS和LDP

    1. [r2]mpls lsr-id 2.2.2.2
    2. [r2]mpls
    3. Info: Mpls starting, please wait... OK!
    4. [r2-mpls]mpls ldp
    5. [r2-mpls-ldp]int g0/0/2
    6. [r2-GigabitEthernet0/0/2]mpls
    7. [r2-GigabitEthernet0/0/2]mpls ldp
    8. [r3]mpls lsr-id 3.3.3.3
    9. [r3]mpls
    10. Info: Mpls starting, please wait... OK!
    11. [r3-mpls]mpls ldp
    12. [r3-mpls-ldp]int g0/0/0
    13. [r3-GigabitEthernet0/0/0]mpls
    14. [r3-GigabitEthernet0/0/0]mpls ldp
    15. [r3-GigabitEthernet0/0/0]int g0/0/1
    16. [r3-GigabitEthernet0/0/1]mpls
    17. [r3-GigabitEthernet0/0/1]mpls ldp
    18. [r4]mpls lsr-id 4.4.4.4
    19. [r4]mpls
    20. Info: Mpls starting, please wait... OK!
    21. [r4-mpls]mpls ldp
    22. [r4-mpls-ldp]int g0/0/0
    23. [r4-GigabitEthernet0/0/0]mpls
    24. [r4-GigabitEthernet0/0/0]mpls ldp

    此时LDP对等体已成功建立

    VRF空间的创建

    1. [r2]ip vpn-instance a
    2. [r2-vpn-instance-a]route-distinguisher 100:1
    3. [r2-vpn-instance-a-af-ipv4]vpn-target 100:1 export-extcommunity
    4. [r2-vpn-instance-a-af-ipv4]vpn-target 100:2 import-extcommunity
    5. [r2-vpn-instance-a-af-ipv4]q
    6. [r2-vpn-instance-a]q
    7. [r2]ip vpn-instance b
    8. [r2-vpn-instance-b]route-distinguisher 200:1
    9. [r2-vpn-instance-b-af-ipv4]vpn-target 200:1 export-extcommunity
    10. [r2-vpn-instance-b-af-ipv4]vpn-target 200:2 import-extcommunity
    11. [r4]ip vpn-instance a
    12. [r4-vpn-instance-a]route-distinguisher 100:1
    13. [r4-vpn-instance-a-af-ipv4]vpn-target 100:2 export-extcommunity
    14. [r4-vpn-instance-a-af-ipv4]vpn-target 100:1 import-extcommunity
    15. [r4-vpn-instance-a-af-ipv4]q
    16. [r4-vpn-instance-a]q
    17. [r4]ip vpn-instance b
    18. [r4-vpn-instance-b]route-distinguisher 200:1
    19. [r4-vpn-instance-b-af-ipv4]vpn-target 200:2 export-extcommunity
    20. [r4-vpn-instance-b-af-ipv4]vpn-target 200:1 import-extcommunity

    两者的出入站RT值需要对应相同

    将接口划入到VRF空间中

    1. [r2]int g0/0/0
    2. [r2-GigabitEthernet0/0/0]ip binding vpn-instance a
    3. Info: All IPv4 related configurations on this interface are removed!
    4. Info: All IPv6 related configurations on this interface are removed!
    5. [r2-GigabitEthernet0/0/0]int g0/0/1
    6. [r2-GigabitEthernet0/0/1]ip binding vpn-instance b
    7. Info: All IPv4 related configurations on this interface are removed!
    8. Info: All IPv6 related configurations on this interface are removed!
    9. [r4]int g0/0/1
    10. [r4-GigabitEthernet0/0/1]ip binding vpn-instance a
    11. Info: All IPv4 related configurations on this interface are removed!
    12. Info: All IPv6 related configurations on this interface are removed!
    13. [r4-GigabitEthernet0/0/1]int g0/0/2
    14. [r4-GigabitEthernet0/0/2]ip binding vpn-instance b
    15. Info: All IPv4 related configurations on this interface are removed!
    16. Info: All IPv6 related configurations on this interface are removed!

    此时我们便可以对剩余的这些接口配置IP地址

    1. [r2-GigabitEthernet0/0/1]ip add 192.168.4.2 24
    2. [r2-GigabitEthernet0/0/1]int g0/0/0
    3. [r2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
    4. [r4-GigabitEthernet0/0/2]ip add 192.168.6.2 24
    5. [r4-GigabitEthernet0/0/0]int g0/0/1
    6. [r4-GigabitEthernet0/0/1]ip add 192.168.3.1 24

    R1和R5通过静态路由在CE和PE上配置

    1. [r1]ip route-static 192.168.3.0 24 192.168.2.2
    2. [r1]ip route-static 192.168.4.0 24 192.168.2.2
    3. [r2]ip route-static vpn-instance a 192.168.1.0 24 192.168.2.1
    4. [r4]ip route-static vpn-instance a 192.168.4.0 24 192.168.3.2
    5. [r5]ip route-static 192.168.1.0 24 192.168.3.1
    6. [r5]ip route-static 192.168.2.0 24 192.168.3.1

    建立MP-BGP

    首先R2和R4建立IBGP

    1. [r2]bgp 1
    2. [r2-bgp]router-id 2.2.2.2
    3. [r2-bgp]peer 4.4.4.4 as-number 1
    4. [r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
    5. [r2-bgp]peer 4.4.4.4 next-hop-local
    6. [r4]bgp 1
    7. [r4-bgp]router-id 4.4.4.4
    8. [r4-bgp]peer 2.2.2.2 as-number 1
    9. [r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
    10. [r4-bgp]peer 2.2.2.2 next-hop-local

    在BGP基础上建立MP-BGP

    1. [r2-bgp]ipv4-family vpnv4
    2. [r2-bgp-af-vpnv4]peer 4.4.4.4 enable
    3. [r4-bgp]ipv4-family vpnv4
    4. [r4-bgp-af-vpnv4]peer 2.2.2.2 enable

    此时建立完成

    对站点R1和R5进行配置

    首先把IP给配置好

    1. [r1]int l0
    2. [r1-LoopBack0]ip add 192.168.1.1 24
    3. [r1-LoopBack0]int g0/0/0
    4. [r1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
    5. [r5]int l0
    6. [r5-LoopBack0]ip add 192.168.4.1 24
    7. [r5-LoopBack0]int g0/0/0
    8. [r5-GigabitEthernet0/0/0]ip add 192.168.3.2 24

    VRF空间中发布路由信息

    1. [r2]bgp 1
    2. [r2-bgp]ipv4-family vpn-instance a
    3. [r2-bgp-a]import-route direct
    4. [r2-bgp-a]import-route static
    5. [r4]bgp 1
    6. [r4-bgp]ipv4-family vpn-instance a
    7. [r4-bgp-a]import-route direct
    8. [r4-bgp-a]import-route static

    对站点R6和R7进行配置

    首先把IP给配置好

    1. [r6]int l0
    2. [r6-LoopBack0]ip add 192.168.5.1 24
    3. [r6-LoopBack0]int g0/0/0
    4. [r6-GigabitEthernet0/0/0]ip add 192.168.24.1 24
    5. [r7]int l0
    6. [r7-LoopBack0]ip add 192.168.7.1 24
    7. [r7-LoopBack0]int g0/0/0
    8. [r7-GigabitEthernet0/0/0]ip add 192.168.6.1 24
    9. [r7-GigabitEthernet0/0/1]ip add 47.0.0.2 24

    CE和PE设备之间动态路由传递

    R6和R2配置RIP 

    1. [r2]rip 1 vpn-instance b
    2. [r2-rip-1]v 2
    3. [r2-rip-1]network 192.168.4.0
    4. [r6]rip 1
    5. [r6-rip-1]v 2
    6. [r6-rip-1]network 192.168.4.0
    7. [r6-rip-1]network 192.168.5.0

    R7和R4配置ospf

    1. [r4]ospf 2 vpn-instance b router-id 4.4.4.4
    2. [r4-ospf-2]area 0
    3. [r4-ospf-2-area-0.0.0.0]network 192.168.6.0 0.0.0.25
    4. [r7]ospf 2 router-id 7.7.7.7
    5. [r7-ospf-2]a 0
    6. [r7-ospf-2-area-0.0.0.0]network 192.168.6.0 0.0.0.255
    7. [r7-ospf-2-area-0.0.0.0]network 192.168.7.0 0.0.0.255

    双向重发布的建立

    1. [r2]bgp 1
    2. [r2-bgp]ipv4-family vpn-instance b
    3. [r2-bgp-b]import-route rip 1
    4. [r2]rip 1
    5. [r2-rip-1]import-route bgp
    6. [r4]bgp 1
    7. [r4-bgp]ipv4-family vpn-instance b
    8. [r4-bgp-b]import-route ospf 2
    9. [r4-bgp-b]ospf 2
    10. [r4-ospf-2]import-route bgp

    此时便建立成功

    最后写一条静态路由来使得R7可以和R234的环回相通

    [r7]ip route-static 0.0.0.0 0 47.0.0.1

    检查如下

     

  • 相关阅读:
    MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
    能带你起飞的【数据结构】成王第八篇:二叉树
    HDRP Water & 云影
    人工智能自学需要学什么?
    数据结构学习笔记——广义表、树和二叉树的基本知识
    akamai相关资料整理
    Oracle database 开启归档日志 archivelog
    台湾省九齐NY8A051G 内置MOS版本6 I/O 8-bit EPROM-Based MCU
    找到分析问题的起点:7 步追问法
    Springboot基于ElasticSearch全文搜索引擎策略实现
  • 原文地址:https://blog.csdn.net/weixin_64747212/article/details/127589575