H3C BGP實驗集合

 

實驗目錄:網絡

1.BGP基本實驗tcp

2.非等級負載分擔oop

3.LOCAL_PREF屬性學習

實現離開本地AS時的最佳路由spa

4.MED屬性code

實現進入AS時的最佳路徑router

5.Prefered-value(首選值)屬性ip

6.BGP反射ci

7.同步路由

實驗拓撲:

 

 

 

 

1.EBGP對等體之間的基本配置

[R1]bgp 10

[R1-bgp]router-id 1.1.1.1

[R1-bgp]peer 192.168.1.2 as-number 20

[R1-bgp]peer 192.168.4.1 as-number 20(沒用到)

[R1-bgp]net 1.1.1.1 32

[R1-bgp]q

 

[R2]bgp 20

[R2-bgp]router-id 2.2.2.2

[R2-bgp]peer 192.168.1.1 as-number 10        

[R2-bgp]network 2.2.2.2 32

 

 

 

2.創建鄰居關係必需要求tcp可達,ospf宣告直連網段

[R2]ospf

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255  

[R2-ospf-1-area-0.0.0.0]q

[R2-ospf-1]q

 

[R3]ospf

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255

[R3-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255

[R3-ospf-1-area-0.0.0.0]q

[R3-ospf-1]q

 

[R4]ospf

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255

[R4-ospf-1-area-0.0.0.0]q

[R4-ospf-1]q

 

 

 

3.R2R3是創建鄰居關係

[R2-bgp]peer 192.168.2.2 as-number 20

[R3]bgp 20

[R3-bgp]router-id 3.3.3.3

[R3-bgp]peer 192.168.2.1 as-number 20

[R3-bgp]network 3.3.3.3 32

 

[R2-bgp]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 2.2.2.2

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         192.168.1.1     0                     0       10i

 *>  2.2.2.2/32         0.0.0.0         0                     0       i

 *>i 3.3.3.3/32         192.168.2.2     0          100        0       i

*表明有效路由

>表明最有路由

 

 

[R3-bgp]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 3.3.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

   i 1.1.1.1/32         192.168.1.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>  3.3.3.3/32         0.0.0.0         0                     0       i

關於到1.1.1。1的無效咱們下面講

 

 

4.R3R4開啓鄰居關係

[R3-bgp]peer 192.168.3.2 as-number 20

[R4-bgp]peer 192.168.3.1 as-number 20

 

R2上學不到R4的4.4.4.4,一樣R4也學不到R2的路由

 

 

[R3-bgp]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 3.3.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

   i 1.1.1.1/32         192.168.1.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>  3.3.3.3/32         0.0.0.0         0                     0       i

上面能夠看到,R3已經有到1.1.1.1、2.2.2.2網絡的路由,R3不會發給R4嗎??

看R4的,答案是沒有把路由信息發給R4

緣由是:BGP遵循AS_PATH屬性。

AS_PATH屬性是公認比遵循屬性。該屬性主要解決環路問題,BGP發言者從IBGP得到的路由不向它的IBGP對等實體發送!

 

[R4-bgp]display bgp routing-table

 

 Total Number of Routes: 1

 

 BGP Local router ID is 4.4.4.4

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>i 3.3.3.3/32         192.168.3.1     0          100        0       i

 

 

5.咱們要建立全鏈接

[R2]bgp 20

[R2-bgp]peer 192.168.3.2 as-number 20

[R4]bgp 20

[R4-bgp]peer 192.168.2.1 as-number 20

 

 

查看到1.1.1.1的路由不是有效的,咱們下面解決

[R4-bgp]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 4.4.4.4

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

   i 1.1.1.1/32         192.168.1.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>i 3.3.3.3/32         192.168.3.1     0          100        0       i

 

 

從上面的輸出能夠看出,R4到1.1.1.1不是有效的,是由於下一跳是192.168.1.1的緣由

R4根本就不知道到達192.168.1.1的路徑!

 

出現的最終緣由是什麼呢?

答案:NEXT_HOP屬性。NEXT_HOP也是公認比遵循屬性。

 

下面是NEXT_HOP的四個特性!

1.BGP發言者把本身產生的路由發給全部鄰居時,將把改路由信息的下一跳屬性修改他們直連的網段。像R4學到R3的路由,下一跳就是192.168.3.1

2.BGP發言者把從EBGP鄰居獲得的路由發給IBGP鄰居時,並不改變該路由信息的下一跳屬性,將從EBGP獲得的路由的NEXT_HOP直接傳遞給IBGP對等體。像R3從R2學到R1路由,下一跳是192.168.1.1

3.當內部的發給外部的就不是上面的那樣的,下一跳會是他們直連的網段。像R1從R2學到R3路由,下一跳是192.168.1.2

 

 

解決方法是配置R2

[R2]bgp 20

[R2-bgp]peer 192.168.3.2 next-hop-local

 

此時在查看R4到R1的路由爲有效了

[R4-bgp]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 4.4.4.4

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>i 1.1.1.1/32         192.168.2.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>i 3.3.3.3/32         192.168.3.1     0          100        0       i

爲何下一跳就是192.168.2.1而不是192.168.3.1呢?

由於R1的路由信息是從R2傳到R4的(邏輯上的bgp鄰居)

 

 

查看一下R3的bgp路由

[R3]display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 3.3.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

   i 1.1.1.1/32         192.168.1.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>  3.3.3.3/32         0.0.0.0         0                     0       i

 

一樣是不可達的,咱們怎樣解決呢?同上啊!原理同樣!

[R2]bgp 20

[R2-bgp]peer 192.168.2.2 next-hop-local

 

 

6.此時咱們宣告一下4.4.4.4 32網絡,查看全部的bgp路由狀況

 

R1的到全部的都有效、最優

<R1>display bgp routing-table

 

 Total Number of Routes: 4

 

 BGP Local router ID is 1.1.1.1

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       20i

 *>  3.3.3.3/32         192.168.1.2                           0       20i

 *>  4.4.4.4/32         192.168.1.2                           0       20i

 

而且加上源地址能ping同。爲何不加源地址不行呢?

緣由是R1不是知道as20內的直連網絡,在ping的時候沒有能夠匹配的路由,數據包丟棄

<R1>ping -a 1.1.1.1 4.4.4.4

  PING 4.4.4.4: 56  data bytes, press CTRL_C to break

    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=34 ms

    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=20 ms

    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=10 ms

    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=1 ms

    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=20 ms

 

  --- 4.4.4.4 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/17/34 ms

 

 

[R4]ping -a 4.4.4.4 1.1.1.1

  PING 1.1.1.1: 56  data bytes, press CTRL_C to break

    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=253 time=35 ms

    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=253 time=20 ms

    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=253 time=20 ms

    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=253 time=1 ms

    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=253 time=1 ms

 

  --- 1.1.1.1 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/15/35 ms

 

6.怎樣才能不加源地址呢?

引進直連路由

 

[R1]bgp 10

[R1-bgp]import-route direct

[R2]bgp 20

[R2-bgp]import-route direct

 

此時查看一下R1的路由

[R1]display ip routing-table

Routing Tables: Public

        Destinations : 14       Routes : 14

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0

2.2.2.2/32          BGP    255  0            192.168.1.2     S0/2/0

3.3.3.3/32          BGP    255  0            192.168.1.2     S0/2/0

4.4.4.4/32          BGP    255  0            192.168.1.2     S0/2/0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

192.168.1.0/24      Direct 0    0            192.168.1.1     S0/2/0

192.168.1.1/32      Direct 0    0            127.0.0.1       InLoop0

192.168.1.2/32      Direct 0    0            192.168.1.2     S0/2/0

192.168.2.0/24      BGP    255  0            192.168.1.2     S0/2/0

192.168.2.2/32      BGP    255  0            192.168.1.2     S0/2/0

192.168.4.0/24      Direct 0    0            192.168.4.2     S0/2/1

192.168.4.1/32      Direct 0    0            192.168.4.1     S0/2/1

192.168.4.2/32      Direct 0    0            127.0.0.1       InLoop0

 

[R1]ping 4.4.4.4

  PING 4.4.4.4: 56  data bytes, press CTRL_C to break

    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=15 ms

    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=1 ms

    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=10 ms

    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=10 ms

    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=20 ms

 

  --- 4.4.4.4 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/11/20 ms

 

 

當R4 ping 1.1.1.1時怎麼ping不通呢?

由於數據包過去了,沒有回來!

當R4發的ping包到源地址是192.168.3.2目的地址1.1.1.1達R1後,R1作出迴應。ping包的源地址1.1.1.1目的地址爲192.168.3.2,而R1的路由表裏沒有,因此丟棄

[R4]ping 1.1.1.1  

  PING 1.1.1.1: 56  data bytes, press CTRL_C to break

    Request time out

    Request time out

    Request time out

    Request time out

    Request time out

 

  --- 1.1.1.1 ping statistics ---

    5 packet(s) transmitted

    0 packet(s) received

    100.00% packet loss

 

 

要想直接ping同。能夠在R3或者R4上引入直連的,只要讓R1學的到到192.168.3.2的路由即可以

[R3]bgp 20

[R3-bgp]import-route direct

配置BGP基本實驗結束

 

 

 

 

 

 

 

 

 

二.非等級負載分擔

實驗拓撲:

在實驗一得基礎上添加了R1R4之間的鄰居關係

 

從R1查看到R3的路由,發現到3.3.3.3走的R2

 

實現負載分擔的命令是:

[R1]bgp 10

[R1-bgp]balance 2     /默認是1

 

 

從上面能夠看出R1到3.3.3.3實現了負載!

 

 

 

 

三.LOCAL_PREF屬性

 

簡介:

實現選擇離開本地AS時的最佳路徑

會影響本as區域內的選路,當本區域到達某個目的網段有多個路徑時,能夠配置local_pref屬性來影響選路!

數值越大越優先

實驗拓撲:

R3----R4----R1

 

R3-----R2-----R1

 

 

如今查看R3到1.1.1.1走的是R2即:R3-----R2-----R1

 

 

咱們作下修改。讓R3到R1的路徑走: R3----R4----R1

[R4]bgp 20

[R4-bgp]default local-preference ? 

  INTEGER<0-4294967295>  Specify a local preference

[R4-bgp]default local-preference 200

 

 

 

 

 

 

 

四.MED屬性

簡介:

實現進入AS時的最佳路徑

MED用於EBGP鄰居有多條路徑到達本AS的狀況,用途是告訴EBGP鄰居進入本AS的較優先路徑!

數值越小越優先

實驗拓撲:

 

 

修改R2的med

[R2]bgp 20

[R2-bgp]default med ?

  INTEGER<0-4294967295>  MED value

 

[R2-bgp]default med 2

 

 

 

 

 

 

 

 

 

 

五.Prefered-value(首選值)屬性

簡介:

首選值爲私有BGP屬性,經過爲從不一樣對等體接受到的路由分配不一樣的首選值。

越大越好!

 

 

 

 

 

 

 

六.BGP反射

 

實驗人:高承旺

實驗名稱:BGP反射

實驗拓撲:

 

實驗步驟

R1與R2創建鄰居關係

[R1]bgp 10

[R1-bgp]router-id 1.1.1.1         

[R1-bgp]peer 192.168.1.2 as-number 20             

[R1-bgp]net 1.1.1.1 32

[R1-bgp]q

 

[R2]bgp 20

[R2-bgp]peer 192.168.1.1 as-number 10

[R2-bgp]router-id 2.2.2.2

[R2-bgp]net 2.2.2.2 32

[R2-bgp]q

 

 

開啓ospf

[R2]ospf

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255

 

[R3]ospf

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255

[R3-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255

[R3-ospf-1-area-0.0.0.0]q

[R3-ospf-1]q

 

[R4]ospf

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255

[R4-ospf-1-area-0.0.0.0]q

[R4-ospf-1]q

 

 

IBGP鄰居創建

R2----R3---R4

R2和R4之間不創建鄰居

[R2]bgp 20

[R2-bgp]peer 192.168.2.2 as-number 20

[R2-bgp]q

[R3]bgp 20

[R3-bgp]peer 192.168.2.1 as-number 20  

[R3-bgp]peer 192.168.3.2 as-number 20

[R3-bgp]q

[R3]bgp 20

[R3-bgp]router-id 3.3.3.3

[R3-bgp]net 3.3.3.3 32

 

[R4]bgp 20

[R4-bgp]router-id 4.4.4.4

[R4-bgp]peer 192.168.3.1 as-n 

[R4-bgp]peer 192.168.3.1 as-number 20

[R4-bgp]network 4.4.4.4 32

 

 

到1.1.1.1的不是有效最優的

[R3]display bgp routing-table

 

 Total Number of Routes: 4

 

 BGP Local router ID is 3.3.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

   i 1.1.1.1/32         192.168.1.1     0          100        0       10i

 *>i 2.2.2.2/32         192.168.2.1     0          100        0       i

 *>  3.3.3.3/32         0.0.0.0         0                     0       i

 *>i 4.4.4.4/32         192.168.3.2     0          100        0       i

 

 

[R2-bgp]peer 192.168.2.2 next-hop-local  

 

 

開啓反射

[R3]bgp 20

[R3-bgp]peer 192.168.2.1 reflect-client 

[R3-bgp]peer 192.168.3.2 reflect-client

 

[R2]display bgp routing-table

 

 Total Number of Routes: 4

 

 BGP Local router ID is 2.2.2.2

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         192.168.1.1     0                     0       10i

 *>  2.2.2.2/32         0.0.0.0         0                     0       i

 *>i 3.3.3.3/32         192.168.2.2     0          100        0       i

   i 4.4.4.4/32         192.168.3.2     0          100        0       i

 

雖然鄰居建立好了,可是是不能通訊的,由於BGP不知道到192。168.3.0的網段!

讓BGP知道知道192.168.3.0網絡

 

[R3]bgp 20

[R3-bgp]net 192.168.3.0 24

 

 

<R1>display bgp routing-table

 

 Total Number of Routes: 5

 

 BGP Local router ID is 1.1.1.1

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       20i

 *>  3.3.3.3/32         192.168.1.2                           0       20i

 *>  4.4.4.4/32         192.168.1.2                           0       20i

 *>  192.168.3.0        192.168.1.2                           0       20i

 

 

[R1]ping -a 1.1.1.1 4.4.4.4

  PING 4.4.4.4: 56  data bytes, press CTRL_C to break

    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=15 ms

    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=20 ms

    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=1 ms

    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=20 ms

    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=20 ms

 

  --- 4.4.4.4 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/15/20 ms

 

 

 

 

 

 

 

 

 

七.BGP同步

簡介:

開啓同步,內網必需要知道到外網as的網段

實驗拓撲:在實驗六的基礎上!

 

 

 

鄰居創建:

取消上面實驗的IBGP鄰居關係

R2-----R4建立鄰居關係。

R3不與R2、R4建立鄰居關係

[R2]bgp 20

[R2-bgp]peer 192.168.3.2 as-number 20

 

[R4]bgp 20

[R4-bgp]peer 192.168.2.1 as-number 20

 

[R4-bgp]peer 192.168.4.2 as-number 30

 

[R5]bgp 30

[R5-bgp]router-id 5.5.5.5

[R5-bgp]peer 192.168.4.1 as-number 20

[R5-bgp]net 5.5.5.5 32   

[R5-bgp]q

 

[R2]bgp 20

[R2-bgp]peer 192.168.3.2 next-hop-local

[R4]bgp 20

[R4-bgp]peer 192.168.2.1 next-hop-local

 

 

<R1>display bgp routing-table

 

 Total Number of Routes: 4

 

 BGP Local router ID is 1.1.1.1

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       20i

 *>  4.4.4.4/32         192.168.1.2                           0       20i

 *>  5.5.5.5/32         192.168.1.2                           0       20 30i

 

 

 

[R5]display bgp routing-table

 

 Total Number of Routes: 4

 

 BGP Local router ID is 5.5.5.5

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         192.168.4.1                           0       20 10i

 *>  2.2.2.2/32         192.168.4.1                           0       20i

 *>  4.4.4.4/32         192.168.4.1     0                     0       20i

 *>  5.5.5.5/32         0.0.0.0         0                     0       i

上面輸出表面全部的鄰居已經建立成功!

 

 

咱們開啓R2和R4的同步

[R2]bgp 20

[R2-bgp]synchronization

 

 

[R4]bgp 20

[R4-bgp]synchronization

[R4-bgp]q

 

<R1>display bgp routing-table

 

 Total Number of Routes: 2

 

 BGP Local router ID is 1.1.1.1

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       20i

開啓後鄰居關係變了,緣由是內部網絡不知道到達外網AS的網段

總之:開啓同步,內網必需要知道到外網as的網段

 

作法有不少種。只要內部的有到外部的網段就行!

咱們以用ospf引進bgp路由來學習外網網段

[R2]ospf

[R2-ospf-1]import-route bgp

[R4]ospf

[R4-ospf-1]import-route bgp

 

 

<R1>display bgp routing-table

 

 Total Number of Routes: 3

 

 BGP Local router ID is 1.1.1.1

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       20i

 *>  5.5.5.5/32         192.168.1.2                           0       20 30i

 

 

<R1>ping -a 1.1.1.1 5.5.5.5

  PING 5.5.5.5: 56  data bytes, press CTRL_C to break

    Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=252 time=34 ms

    Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=252 time=1 ms

    Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=252 time=1 ms

    Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=252 time=1 ms

    Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=252 time=10 ms

 

  --- 5.5.5.5 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/9/34 ms

相關文章
相關標籤/搜索