• HCIA实验(07)



    1.配置IP地址和环回

    [r1]int lo0
    [r1-LoopBack0]ip add 1.1.1.1 32
    [r1]int lo1
    [r1-LoopBack1]ip add 1.1.10.1 24
    [r1]int g0/0/0
    [r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
    [r2]int lo0
    [r2-LoopBack0]ip add 1.1.1.2 32
    [r2]int lo1
    [r2-LoopBack1]ip add 2.2.2.2 24
    [r2]int g0/0/0
    [r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
    [r2]int g0/0/1
    [r2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
    [r3]int lo0
    [r3-LoopBack0]ip add 1.1.1.3 32
    [r3]int lo1
    [r3-LoopBack1]ip add 3.3.3.3 24
    [r3]int g0/0/0
    [r3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
    [r3]int g0/0/1
    [r3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
    [r4]int lo0
    [r4-LoopBack0]ip add 1.1.1.4 32
    [r4]int lo1
    [r4-LoopBack1]ip add 4.4.4.4 24
    [r4]int g0/0/0
    [r4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
    [r4]int g0/0/1
    [r4-GigabitEthernet0/0/1]ip add 45.1.1.1 24
    [r4]int g4/0/0
    [r4-GigabitEthernet4/0/0]ip add 54.1.1.1 24
    [r5]int lo0
    [r5-LoopBack0]ip add 1.1.1.5 32
    [r5]int lo1
    [r5-LoopBack1]ip add 5.5.5.5 24
    [r5]int g0/0/0
    [r5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
    [r5]int g0/0/1
    [r5-GigabitEthernet0/0/1]ip add 54.1.1.2 24

    (测试)

    2.进行OSPF宣告

    [r2]ospf 1 router-id 2.2.2.2 
    [r2-ospf-1]area 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 1.1.1.2 0.0.0.0
    [r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
    [r3]OSPF 1 router-id 3.3.3.3
    [r3-ospf-1]area 0  
    [r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
    [r3-ospf-1-area-0.0.0.0]network 1.1.1.3 0.0.0.0
    [r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
    [r3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
    [r4]ospf 1 router-id 4.4.4.4
    [r4-ospf-1]area 0
    [r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
    [r4-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
    [r4-ospf-1-area-0.0.0.0]network 1.1.1.4 0.0.0.0

    (查看)

    (修改为broadcast)

    [r2]int lo1
    [r2-LoopBack1]ospf network-type broadcast 
    [r3]int lo1  
    [r3-LoopBack1]ospf network-type broadcast 
    [r4]int lo1 
    [r4-LoopBack1]ospf network-type broadcast 

    3.建立邻居关系(配置EBGP和IBGP)

    [r1]bgp 1
    [r1-bgp]router-id 1.1.1.1
    [r1-bgp]peer 12.1.1.2 as-number 2
    [r2]bgp 2
    [r2-bgp]router-id 2.2.2.2
    [r2-bgp]peer 12.1.1.1 as-number 1

    (测试)

    [r2]bgp 2
    [r2-bgp]peer 1.1.1.3 as-number 2
    [r2-bgp]peer 1.1.1.3 connect-interface LoopBack 0
    [r3]bgp 2
    [r3-bgp]router-id 3.3.3.3
    [r3-bgp]peer 1.1.1.2 as-number 2
    [r3-bgp]peer 1.1.1.2 connect-interface LoopBack 0
    [r3-bgp]peer 1.1.1.4 as-number 2
    [r3-bgp]peer 1.1.1.4 connect-interface LoopBack 0
    [r4]bgp 2
    [r4-bgp]router-id 4.4.4.4
    [r4-bgp]peer 1.1.1.3 as-number 2
    [r4-bgp]peer 1.1.1.3 connect-interface LoopBack 0

    (配置静态路由,使得R4和R5有建立邻居的条件)

    [r4]ip route-static 1.1.1.5 32 45.1.1.2
    [r4]ip route-static 1.1.1.5 32 54.1.1.2
    [r5]ip route-static 1.1.1.4 32 45.1.1.1 
    [r5]ip route-static 1.1.1.4 32 54.1.1.1
    (测试)

    [r4]bgp 2   
    [r4-bgp]peer 1.1.1.5 as-number 3
    [r4-bgp]peer 1.1.1.5 connect-interface LoopBack 0
    [r4-bgp]peer 1.1.1.5 ebgp-max-hop 2
    [r5]bgp 3
    [r5-bgp]router-id 5.5.5.5
    [r5-bgp]peer 1.1.1.4 as-number 2
    [r5-bgp]peer 1.1.1.4 connect-interface LoopBack 0
    [r5-bgp]peer 1.1.1.4 ebgp-max-hop 2

    (查看)

    4.配置BGP路由

    (1)
    [r1]bgp 1
    [r1-bgp]network 1.1.10.0 24
    (查看)

    (完善)

    [r2]bgp 2
    [r2-bgp]peer 1.1.1.3 next-hop-local

    [r2]bgp 2
    [r2-bgp]peer 1.1.1.4 as-number 2
    [r2-bgp]peer 1.1.1.4 connect-interface LoopBack 0

    [r4]bgp 2
    [r4-bgp]peer 1.1.1.2 as-number 2
    [r4-bgp]peer 1.1.1.2 connect-interface LoopBack 0
    (测试)


    (2)
    [r5]bgp 3
    [r5-bgp]network 5.5.5.0 24
    [r4-bgp]peer 1.1.1.3 next-hop-local
    [r4-bgp]peer 1.1.1.2 next-hop-local
    (查看)


    5.进行BGP宣告

    [r2]bgp 2
    [r2-bgp]network 2.2.2.0 24
    [r3]bgp 2
    [r3-bgp]network 3.3.3.0 24
    [r4]bgp 2
    [r4-bgp]network 4.4.4.0 24

    (查看)

    (测试)

  • 相关阅读:
    Linux搭建GitLab私有仓库,并内网穿透实现公网访问
    python装饰器
    8.7 迁移学习域适应
    如何空手套白狼?一口气省7K再抓住一个7K起步的工作?
    c语言进制的转换16进制转换2进制
    k8s相关命令-命名空间
    Notepad++插件 Hex-Edit
    ACID ,你还在为了八股文而背吗
    品牌赋能之道:体育冠军代言与祝福视频的妙用
    kubernetes数据持久化PV-PVC详解(一)
  • 原文地址:https://blog.csdn.net/weixin_62443409/article/details/126121675