zoukankan      html  css  js  c++  java
  • CCIE路由实验(1) BGP的基本配置

    路由要优的条件:
    1.下一跳可达
    2.同步,即从IBGP收到的路由条目,也要求从IGP协议学到

    BGP特性:
    1.当用了peer-group的方式去建立邻居关系后,就不能针对其中的某个邻居去做一个出方向的策略,只能针对这个组去做相同的策略。
    2.BGP打开自动汇总对宣告的影响是,此时可以去宣告一个主类路由了。
    3.重分布的时候,自动汇总是生效的。

    IBGP邻居水平分割:
    从一个IBGP邻居学到的路由不会传给另一个IBGP邻居。从而导致需要运行一个全互联的BGP邻居关系。

    1.建立基本的BGP邻居关系
    2.路由信息的通告
    3.理解同步及解决路由黑洞
    4.用peer-group的方法建立邻居关系
    5.BGP的自动汇总
    6.BGP手动汇总(地址汇聚)
    7.产生默认路由

    enable
    conf t
    no ip do lo
    enable pass cisco
    line con 0
    logg sync
    exec-t 0 0
    line vty 0 4
    pass cisco
    logg sync
    exit
    host

    1.建立基本的BGP邻居关系
    ----------------------------------------------------------------------------


    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit
    int l0
    ip add 22.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 22.1.1.0 0.0.0.255
    exit

    R1:
    ping 22.1.1.1 source 11.1.1.1

    R1:
    router bgp 100
    no synchronization
    no auto-summary
    bgp router-id 11.1.1.1
    neighbor 22.1.1.1 remote-as 100
    neighbor 22.1.1.1 update-source l0
    exit

    R2:
    router bgp 100
    bgp router-id 22.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    neighbor 23.1.1.3 remote-as 200
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit

    router bgp 200
    bgp router-id 33.1.1.1
    neighbor 23.1.1.2 remote-as 100
    exit

    R2:
    show ip bgp summary

    2.路由信息的通告
    ---------------------------------------------------------------------------
    R3:
    int l0
    ip add 33.1.1.1 255.255.255.0
    exit

    router bgp 200
    network 33.1.1.0 mask 255.255.255.0
    exit

    R1:
    router bgp 100
    redistribute eigrp 1
    exit

    R1/R2:
    show ip bgp

    R2:
    router bgp 100
    neighbor 11.1.1.1 next-hop-self
    exit

    3.理解同步及解决路由黑洞
    -------------------------------------------------------------------------------


    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 23.1.1.0 0.0.0.255
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit
    int l0
    ip add 33.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 23.1.1.0 0.0.0.255
    network 33.1.1.0 0.0.0.255
    exit

    R1:
    router bgp 100
    bgp router-id 11.1.1.1
    neighbor 33.1.1.1 remote-as 100
    neighbor 33.1.1.1 update-source l0
    exit

    R3:
    router bgp 100
    bgp router-id 33.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    exit

    R1:
    int l1
    ip add 100.1.1.1 255.255.255.0
    exit
    router bgp 100
    network 100.1.1.0 mask 255.255.255.0
    exit

    R3:
    show ip bgp
    ping 100.1.1.1

    R2:
    show ip route

    R3:
    router bgp 100
    synchronization
    exit

    clear ip bgp *
    show ip bgp

    R2:
    int l0
    ip add 22.1.1.1 255.255.255.0
    exit
    router eigrp 1
    network 22.1.1.0 0.0.0.255
    exit

    router bgp 100
    bgp router-id 22.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    neighbor 33.1.1.1 remote-as 100
    neighbor 33.1.1.1 update-source l0
    exit

    R1/R3:
    router bgp 100
    neighbor 22.1.1.1 remote-as 100
    neighbor 22.1.1.1 update-source l0
    exit

    R3:
    router bgp 100
    no synchronization
    exit

    ping 100.1.1.1

    4.用peer-group的方法建立邻居关系
    ---------------------------------------------------------------------------
    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit
    int l0
    ip add 22.1.1.1 255.255.255.0
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 23.1.1.0 0.0.0.255
    network 22.1.1.0 0.0.0.255
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit
    int l0
    ip add 33.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 23.1.1.0 0.0.0.255
    network 33.1.1.0 0.0.0.255
    exit

    R1:
    router bgp 100
    bgp router-id 11.1.1.1
    neighbor IBGP peer-group
    neighbor IBGP remote-as 100
    neighbor IBGP update-source l0
    neighbor IBGP next-hop-self
    neighbor 22.1.1.1 peer-group IBGP
    neighbor 33.1.1.1 peer-group IBGP
    exit

    R2:
    router bgp 100
    bgp router-id 22.1.1.1
    neighbor IBGP peer-group
    neighbor IBGP remote-as 100
    neighbor IBGP update-source l0
    neighbor IBGP next-hop-self
    neighbor 11.1.1.1 peer-group IBGP
    neighbor 33.1.1.1 peer-group IBGP
    exit

    R3:
    router bgp 100
    bgp router-id 33.1.1.1
    neighbor IBGP peer-group
    neighbor IBGP remote-as 100
    neighbor IBGP update-source l0
    neighbor IBGP next-hop-self
    neighbor 22.1.1.1 peer-group IBGP
    neighbor 11.1.1.1 peer-group IBGP
    exit

    5.BGP的自动汇总
    ----------------------------------------------------------------------------


    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int l0
    ip add 22.1.1.1 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 22.1.1.0 0.0.0.255
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit

    R1:
    router bgp 100
    no synchronization
    no auto-summary
    bgp router-id 11.1.1.1
    neighbor 22.1.1.1 remote-as 100
    neighbor 22.1.1.1 update-source l0
    neighbor 22.1.1.1 next-hop-self
    exit

    R2:
    router bgp 100
    bgp router-id 22.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    neighbor 11.1.1.1 next-hop-self
    neighbor 23.1.1.3 remote-as 200
    exit

    R3:
    router bgp 200
    bgp router-id 33.1.1.1
    neighbor 23.1.1.2 remote-as 100
    exit

    int l1
    ip add 100.1.1.1 255.255.255.0
    no shut
    exit
    int l2
    ip add 100.1.2.1 255.255.255.0
    no shut
    exit
    int l3
    ip add 100.1.3.1 255.255.255.0
    no shut
    exit

    router bgp 200
    auto-summary
    network 100.1.1.0 mask 255.255.255.0
    network 100.1.2.0 mask 255.255.255.0
    network 100.1.3.0 mask 255.255.255.0
    exit

    R2:
    show ip bgp

    R3:
    router bgp 200
    network 100.0.0.0
    exit

    R2:
    show ip bgp

    router bgp 100
    auto-summary
    redistribute eigrp 1
    exit

    show ip bgp

    6.BGP手动汇总(地址汇聚)
    ---------------------------------------------------------------------------
    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int l0
    ip add 22.1.1.1 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 22.1.1.0 0.0.0.255
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit

    R1:
    router bgp 100
    no auto-summary
    bgp router-id 11.1.1.1
    neighbor 22.1.1.1 remote-as 100
    neighbor 22.1.1.1 update-source l0
    neighbor 22.1.1.1 next-hop-self
    exit

    R2:
    router bgp 100
    no auto-summary
    bgp router-id 22.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    neighbor 11.1.1.1 next-hop-self
    neighbor 23.1.1.3 remote-as 200
    exit

    R3:
    router bgp 200
    no auto-summary
    bgp router-id 33.1.1.1
    neighbor 23.1.1.2 remote-as 100
    exit

    int l1
    ip add 100.1.1.1 255.255.255.0
    no shut
    exit
    int l2
    ip add 100.1.2.1 255.255.255.0
    no shut
    exit
    int l3
    ip add 100.1.3.1 255.255.255.0
    no shut
    exit

    router bgp 200
    network 100.1.1.0 mask 255.255.255.0
    network 100.1.2.0 mask 255.255.255.0
    network 100.1.3.0 mask 255.255.255.0
    exit

    R2:
    router bgp 100
    aggregate-address 100.1.0.0 255.255.0.0
    exit

    R1/R2:
    show ip bgp

    R2:
    router bgp 100
    aggregate-address 100.1.0.0 255.255.0.0 summary-only
    exit

    R1/R2:
    show ip bgp

    R2:
    ip prefix-list CISCO permit 100.1.1.0/24
    ip prefix-list CISCO permit 100.1.2.0/24
    route-map YESLAB permit 10
    match ip add prefix-list CISCO    
    exit
    router bgp 100
    aggregate-add 100.1.0.0 255.255.0.0 suppress-map YESLAB
    exit

    clear ip bgp *

    R1/R3:
    show ip bgp

    R2:
    router bgp 100
    aggregate-add 100.1.0.0 255.255.0.0 suppress-map YESLAB as-set
    exit

    R1/R3:
    show ip bgp

    R3:
    ip prefix-list CISCO1 permit 100.1.1.0/24
    ip prefix-list CISCO2 permit 100.1.2.0/24
    route-map YESLAB permit 10
    match ip add prefix-list CISCO1
    set community 200:1
    match ip add prefix-list CISCO2
    set community 200:2
    exit
    route-map YESLAB permit 9999
    exit

    router bgp 200
    neighbor 23.1.1.2 route-map YESLAB out
    neighbor 23.1.1.2 send-community
    exit
    ip bgp-community new-format

    clear ip bgp * soft out

    R2:
    ip bgp-community new-format
    show ip bgp 100.1.1.0    
    show ip bgp 100.1.2.0    
    show ip bgp 100.1.0.0    

    R1:
    show ip bgp 100.1.0.0

    R2:
    ip prefix-list 200.1 deny 100.1.2.0/24
    ip prefix-list 200.1 permit 0.0.0.0/0 le 32
    route-map ADV permit 10
    match ip address prefix-list 200.1
    exit

    router bgp 100
    aggregate-add 100.1.0.0 255.255.0.0 as-set advertise-map ADV suppress-map YESLAB

    show ip bgp

    R2:
    route-map SET permit 10
    set community 100:100 additive
    exit

    router bgp 100
    aggregate-add 100.1.0.0 255.255.0.0 as-set attribute-map SET advertise-map ADV suppress-map YESLAB
    exit

    show ip bgp 100.1.0.0

    7.产生默认路由
    -----------------------------------------------------------------
    R1:
    int f0/0
    ip add 12.1.1.1 255.255.255.0
    no shut
    exit
    int l0
    ip add 11.1.1.1 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 11.1.1.0 0.0.0.255
    exit

    R2:
    int f0/0
    ip add 12.1.1.2 255.255.255.0
    no shut
    exit
    int l0
    ip add 22.1.1.1 255.255.255.0
    no shut
    exit
    int f1/0
    ip add 23.1.1.2 255.255.255.0
    no shut
    exit

    router eigrp 1
    no auto-summary
    network 12.1.1.0 0.0.0.255
    network 22.1.1.0 0.0.0.255
    exit

    R3:
    int f0/0
    ip add 23.1.1.3 255.255.255.0
    no shut
    exit

    R1:
    router bgp 100
    no auto-summary
    bgp router-id 11.1.1.1
    neighbor 22.1.1.1 remote-as 100
    neighbor 22.1.1.1 update-source l0
    neighbor 22.1.1.1 next-hop-self
    exit

    R2:
    router bgp 100
    no auto-summary
    bgp router-id 22.1.1.1
    neighbor 11.1.1.1 remote-as 100
    neighbor 11.1.1.1 update-source l0
    neighbor 11.1.1.1 next-hop-self
    neighbor 23.1.1.3 remote-as 200
    exit

    R3:
    router bgp 200
    no auto-summary
    bgp router-id 33.1.1.1
    neighbor 23.1.1.2 remote-as 100
    exit

    R1:
    ip route 0.0.0.0 0.0.0.0 null 0
    router bgp 100
    redistribute static
    exit

    show ip bgp


    R1:
    router bgp 100
    default-information originate
    exit

    show ip bgp

    R1:
    no ip route 0.0.0.0 0.0.0.0 null 0
    router bgp 100
    no redistribute static
    no default-information originate
    exit

    ip route 0.0.0.0 0.0.0.0 12.1.1.2
    router bgp 100
    network 0.0.0.0
    exit

    show ip bgp

    R1:
    no ip route 0.0.0.0 0.0.0.0 12.1.1.2
    router bgp 100
    no network 0.0.0.0
    exit

    router bgp 100
    neighbor 22.1.1.1 default-originate
    exit

    R2:
    show ip bgp
    用此命令时R1上并不会看到任何默认路由。

  • 相关阅读:
    Codeforces Round #340 (Div. 2)
    搞清楚一下格式化输出
    TYVJ P1091 等差数列 Label:dp
    TYVJ P1098 任务安排 Label:倒推dp 不懂
    TYVJ P1034 尼克的任务 Label:倒推dp
    TYVJ P1045 &&洛谷 1388 最大的算式 Label:dp
    TYVJ P1046 Blast Label:dp
    TYVJ P1051 选课 Label:多叉转二叉&&树形dp(虐心♥)
    TYVJ P1073 加分二叉树 Label:区间dp
    二叉树遍历入门 Lebal:research
  • 原文地址:https://www.cnblogs.com/thlzhf/p/3071307.html
Copyright © 2011-2022 走看看