• HCIP实验6


    目录

    1.首先配置MPLS VPN的骨干网络

    (1)配置

    (2)测试

    2.将公网网段划分到OSPF中,保证公网内路由通达

    (1)配置

    (2)查看和测试

    3.而后在公网开启MPLS协议和LDP协议

    4.在R2和R4上创建VRF空间

    (1)配置

    (2)将接口划入空间

    5.配置私网网段的IP地址

    (1)配置

    (2)查看和测试

    6.在CE和PE设备上通过静态路由进行配置(R1,R2,R4,R5)

    (1)配置

    (2)在R2和R4上运行IBGP对等体关系

    (3)在VRF空间中发布路由

    (4)测试

    7.在CE和PE设备上通过动态路由进行配置(R5,R2,R4,R7)

    (1)进行RIP和OSPF宣告

    (2)在VRF空间中双向重发布BGP和RIP/OSPF

    (3)测试

    8.测试


    IP地址划分

    1.首先配置MPLS VPN的骨干网络

    (1)配置

    1. [r2]int g0/0/2
    2. [r2-GigabitEthernet0/0/2]ip add 23.1.1.1 24
    3. [r2]int lo0
    4. [r2-LoopBack0]ip add 2.2.2.2 24
    5. [r3]int g0/0/0
    6. [r3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
    7. [r3]int g0/0/1
    8. [r3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
    9. [r3]int lo0
    10. [r3-LoopBack0]ip add 3.3.3.3 24
    11. [r4]int g0/0/0
    12. [r4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
    13. [r4]int lo0
    14. [r4-LoopBack0]ip add 4.4.4.4 24

    由于实验要求R7单独的一根网线可以访问公网,所以我们在这里把R7的g0/0/1接口和R4的g4/0/0接口宣告在公网网段

    1. [r4]int g4/0/0
    2. [r4-GigabitEthernet4/0/0]ip add 47.1.1.1 24
    3. [r7]int g0/0/1
    4. [r7-GigabitEthernet0/0/1]ip add 47.1.1.2 24

    (2)测试



    2.将公网网段划分到OSPF中,保证公网内路由通达

    (1)配置

    1. [r2]ospf 1 router-id 2.2.2.2
    2. [r2-ospf-1]a 0
    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.1.1.0 0.0.0.255
    5. [r3]ospf 1 router-id 3.3.3.3
    6. [r3-ospf-1]a 0
    7. [r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
    8. [r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
    9. [r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
    10. [r4]ospf 1 router-id 4.4.4.4
    11. [r4-ospf-1]a 0
    12. [r4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
    13. [r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
    14. [r4-ospf-1-area-0.0.0.0]network 47.1.1.1 0.0.0.0

    在此处我们需要将R4的g4/0/0接口也宣告到OSPF中,这是为了保证R2和R3能访问R7,宣告R4的g4/0/0接口不是为了让R7运行OSPF协议。R7是客户站点,不能配置OSPF,所以要将R4的g4/0/0接口沉默。

    [r4-ospf-1]silent-interface GigabitEthernet 4/0/0

    而将接口沉默的效果是只收不发hello包,为了保证不接受hello包,我们也需要加个认证。

    1. [r4]int g4/0/0
    2. [r4-GigabitEthernet4/0/0]ospf authentication-mode md5 1 cipher 123456

    为了让R7访问公网环回网段,需要配置静态路由

    [r7]ip route-static 0.0.0.0 0 47.1.1.1

    (2)查看和测试



    3.而后在公网开启MPLS协议和LDP协议

    1. [r2]mpls lsr-id 2.2.2.2
    2. [r2]mpls
    3. [r2-mpls]q
    4. [r2]mpls ldp
    5. [r2-mpls-ldp]q
    6. [r2]int g0/0/2
    7. [r2-GigabitEthernet0/0/2]mpls
    8. [r2-GigabitEthernet0/0/2]mpls ldp
    9. [r3]mpls lsr-id 3.3.3.3
    10. [r3]mpls
    11. [r3-mpls]q
    12. [r3]mpls ldp
    13. [r3-mpls-ldp]q
    14. [r3]int g0/0/0
    15. [r3-GigabitEthernet0/0/0]mpls
    16. [r3-GigabitEthernet0/0/0]mpls ldp
    17. [r3]int g0/0/1
    18. [r3-GigabitEthernet0/0/1]mpls
    19. [r3-GigabitEthernet0/0/1]mpls ldp
    20. [r4]mpls lsr-id 4.4.4.4
    21. [r4]mpls
    22. [r4-mpls]q
    23. [r4]mpls ldp
    24. [r4-mpls-ldp]q
    25. [r4]int g0/0/0
    26. [r4-GigabitEthernet0/0/0]mpls
    27. [r4-GigabitEthernet0/0/0]mpls ldp

    4.在R2和R4上创建VRF空间

    (1)配置

    1. [r2]ip vpn-instance a1---VRF空间在命名时,大小写敏感
    2. [r2-vpn-instance-a1]route-distinguisher 100:1---配置RD值,不同VRF空间的RD值不能相同
    3. [r2-vpn-instance-a1-af-ipv4]vpn-target 100:1 export-extcommunity---配置出站RD值
    4. [r2-vpn-instance-a1-af-ipv4]vpn-target 100:2 import-extcommunity---配置入站RD值
    5. [r2]ip vpn-instance b1
    6. [r2-vpn-instance-b1]route-distinguisher 200:1
    7. [r2-vpn-instance-b1-af-ipv4]vpn-target 200:1 export-extcommunity
    8. [r2-vpn-instance-b1-af-ipv4]vpn-target 200:2 import-extcommunity
    9. [r4]ip vpn-instance a2
    10. [r4-vpn-instance-a2]route-distinguisher 100:1
    11. [r4-vpn-instance-a2-af-ipv4]vpn-target 100:1 import-extcommunity
    12. [r4-vpn-instance-a2-af-ipv4]vpn-target 100:2 export-extcommunity
    13. [r4]ip vpn-instance b2
    14. [r4-vpn-instance-b2]route-distinguisher 200:1
    15. [r4-vpn-instance-b2-af-ipv4]vpn-target 200:1 import-extcommunity
    16. [r4-vpn-instance-b2-af-ipv4]vpn-target 200:2 export-extcommunity

    (2)将接口划入空间

    1. [r2]int g0/0/0
    2. [r2-GigabitEthernet0/0/0]ip binding vpn-instance a1
    3. [r2]int g0/0/1
    4. [r2-GigabitEthernet0/0/1]ip binding vpn-instance b1
    5. [r4]int g0/0/1
    6. [r4-GigabitEthernet0/0/1]ip binding vpn-instance a2
    7. [r4]int g0/0/2
    8. [r4-GigabitEthernet0/0/2]ip binding vpn-instance b2

    (PS:未绑定VRF关系前配置IP地址,绑定后配置的IP地址将会被移出,所以只能在绑定VRF关系后才能配置该接口的IP地址)

    5.配置私网网段的IP地址

    (1)配置

    1. [r1]int lo0
    2. [r1-LoopBack0]ip add 192.168.1.1 24
    3. [r1]int g0/0/0
    4. [r1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
    5. [r2]int g0/0/0
    6. [r2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
    7. [r4]int g0/0/1
    8. [r4-GigabitEthernet0/0/1]ip add 192.168.3.1 24
    9. [r5]int g0/0/0
    10. [r5-GigabitEthernet0/0/0]ip add 192.168.3.2 24
    11. [r5]int lo0
    12. [r5-LoopBack0]ip add 192.168.4.1 24
    13. [r6]int lo0
    14. [r6-LoopBack0]ip add 192.168.5.1 24
    15. [r6]int g0/0/0
    16. [r6-GigabitEthernet0/0/0]ip add 192.168.6.1 24
    17. [r2]int g0/0/1
    18. [r2-GigabitEthernet0/0/1]ip add 192.168.6.2 24
    19. [r4]int g0/0/2
    20. [r4-GigabitEthernet0/0/2]ip add 192.168.7.1 24
    21. [r7]int g0/0/0
    22. [r7-GigabitEthernet0/0/0]ip add 192.168.7.2 24
    23. [r7]int lo0
    24. [r7-LoopBack0]ip add 192.168.8.1 24

    (2)查看和测试

    查看



    测试

    6.在CE和PE设备上通过静态路由进行配置(R1,R2,R4,R5)

    (1)配置

    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 a1 192.168.1.0 24 192.168.2.1
    4. [r5]ip route-static 192.168.1.0 24 192.168.3.1
    5. [r5]ip route-static 192.168.2.0 24 192.168.3.1
    6. [r4]ip route-static vpn-instance a2 192.168.4.0 24 192.168.3.2

    (2)在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 1
    4. [r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
    5. [r2-bgp]ipv4-family vpnv4
    6. [r2-bgp-af-vpnv4]peer 4.4.4.4 enable
    7. ---PE设备之间传递的不是IPV4的路由信息,而是VPNV4的路由信息,
    8. 所以在普通的BGPV4邻居关系建立的基础上,需要在VPNV4的地址族中激活邻居关系。
    9. [r4]bgp 1
    10. [r4-bgp]router-id 4.4.4.4
    11. [r4-bgp]peer 2.2.2.2 as 1
    12. [r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
    13. [r4-bgp]ipv4-family vpnv4
    14. [r4-bgp-af-vpnv4]peer 2.2.2.2 enable

    (3)在VRF空间中发布路由

    1. [r2-bgp]ipv4-family vpn-instance a1
    2. [r2-bgp-a1]network 192.168.1.0 24
    3. [r2-bgp-a1]network 192.168.2.0 24
    4. [r4-bgp]ipv4-family vpn-instance a2
    5. [r4-bgp-a2]network 192.168.3.0 24
    6. [r4-bgp-a2]network 192.168.4.0 24

    查看路由发布情况

    (4)测试


    7.在CE和PE设备上通过动态路由进行配置(R5,R2,R4,R7)

    (1)进行RIP和OSPF宣告

    1. [r6]rip 1
    2. [r6-rip-1]v 2
    3. [r6-rip-1]network 192.168.5.0
    4. [r6-rip-1]network 192.168.6.0
    5. [r2]rip 1 vpn-instance b1---在VRF空间中启动RIP进程
    6. [r2-rip-1]v 2
    7. [r2-rip-1]network 192.168.6.0
    8. [r2-rip-1]network 192.168.5.0
    9. [r7]ospf 1 router-id 7.7.7.7
    10. [r7-ospf-1]a 0
    11. [r7-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
    12. [r7-ospf-1-area-0.0.0.0]network 192.168.8.0 0.0.0.255
    13. [r4]ospf 2 vpn-instance b2 router-id 4.4.4.4---在VRF空间中启动OSPF进程
    14. [r4-ospf-2]a 0
    15. [r4-ospf-2-area-0.0.0.0]network 192.168.7.0 0.0.0.255

    (2)在VRF空间中双向重发布BGP和RIP/OSPF

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

    (3)测试




    8.测试



  • 相关阅读:
    在vue项目中iconfont 图标组件的使用方法(详细步骤)
    Linux之ssh
    求职攻略| 硬核公司的硬件笔试题长什么样?先来5道选择题
    贴近摄影测量 | 重建花山岩画只需两步!
    博弈论入门
    Java语法之继承
    新闻管理系统(SpringBoot+Vue)
    蓝桥杯-星期一
    数据结构前瞻
    Feign负载均衡
  • 原文地址:https://blog.csdn.net/weixin_62443409/article/details/127616061