天天看點

華為三層交換機

三層交換

學習目的:

了解三層交換的意義

了解三層交換與路由的異同點

掌握vlanif的配置方法

掌握valn之間實作通訊的配置方法

掌握vlanif之間配置OSPF的方法

拓撲圖:

場景:

         你是公司的網絡管理者。目前網絡中有四個使用者。S3、R1、R3與S4模拟為公司使用者。分屬于不同的vlan,定義S3屬于vlan3、R1屬于vlan4、R3屬于vlan6、S4屬于vlan7,實作vlan之間的互通。同時由于S1與S2之間使用三層鍊路實作互通,是以需要使用路由協定實作路由資訊的互相學習。

學習任務

步驟一.S1與S2之間的鍊路配置成eth-trunk鍊路

實驗之前,需要關閉部分實驗裝置接口與,避免影響本次試驗。

         本次實驗需要關閉S3的E0/0/1、E0/0/23接口,另外需要關閉S4的E0/0/14接口。關閉這些接口。關閉這些接口後,開始實驗配置。

[Huawei]sysname S1

[S1]interface eth-trunk 1

[S1-Eth-Trunk1]q

[S1]interface g0/0/9

[S1-GigabitEthernet0/0/9]eth-trunk 1

[S1-GigabitEthernet0/0/9]interface g0/0/10

[S1-GigabitEthernet0/0/10]eth-trunk 1

Info: This operation may take a fewseconds. Please wait for a moment...done.

[Huawei]sysname S2

[S2]interface eth-trunk 1

[S2-Eth-Trunk1]q

[S2]interface g0/0/9

[S2-GigabitEthernet0/0/9]eth-trunk 1

[S2-GigabitEthernet0/0/9]interface g0/0/10

[S2-GigabitEthernet0/0/10]eth-trunk 1

步驟二.S1、S2配置valn3、4、5、6、7

[S1]vlan batch 3 to 7

[S2]vlan batch 3 to 7

檢視vlan的建立情況

[S1]dis vlan

The total number of vlans is : 6

--------------------------------------------------------------------------------

U: Up;         D: Down;         TG: Tagged;         UT: Untagged;

MP: Vlan-mapping;               ST: Vlan-stacking;

#: ProtocolTransparent-vlan;    *: Management-vlan;

VID Type    Ports               

1   common  UT:GE0/0/1(U)      GE0/0/2(D)      GE0/0/3(D)      GE0/0/4(D)     

                GE0/0/5(D)      GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)     

                GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(U)     GE0/0/14(D)    

                GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     GE0/0/18(D)    

               GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     GE0/0/22(D)    

                GE0/0/23(D)     GE0/0/24(D)     Eth-Trunk1(U)                  

3   common 

4   common 

5   common 

6   common 

7   common 

VID Status  Property      MAC-LRN Statistics Description     

1   enable  default       enable disable    VLAN 0001                        

3   enable  default       enable disable    VLAN 0003                        

4   enable  default       enable disable    VLAN 0004                        

5   enable  default       enable disable    VLAN 0005                        

6   enable  default       enable disable    VLAN 0006                        

7   enable  default       enable disable    VLAN 0007         

[S2]dis vlan

1   common  UT:GE0/0/1(D)      GE0/0/2(U)      GE0/0/3(D)      GE0/0/4(D)     

                GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     GE0/0/14(D)    

                GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     GE0/0/22(U)    

               GE0/0/23(D)     GE0/0/24(D)     Eth-Trunk1(U)                  

4   enable  default       enable disable    VLAN 0004                         

7   enable  default       enable disable    VLAN 0007

步驟三.S1與S2之間的Eth-trunk鍊路配置為Access鍊路,屬于vlan5

         配置vlan與接口之間的對應關系。S1與S2之間的eth-trunk屬于vlan5,S1的G0/0/1屬于vlan4、G0/0/13屬于vlan3;S2的G0/0/2屬于vlan6、G0/0/22屬于vlan7.

[S1-Eth-Trunk1]port link-type access

[S1-Eth-Trunk1]port default vlan 5

[S1-Eth-Trunk1]interface g0/0/1

[S1-GigabitEthernet0/0/1]port link-typeaccess

[S1-GigabitEthernet0/0/1]port default vlan4

[S1-GigabitEthernet0/0/1]interface g0/0/13

[S1-GigabitEthernet0/0/13]port link-typeaccess

[S1-GigabitEthernet0/0/13]port default vlan3

[S2-Eth-Trunk1]port link-type access

[S2-Eth-Trunk1]port default vlan 5

[S2-Eth-Trunk1]interface g0/0/2

[S2-GigabitEthernet0/0/2]port link-typeaccess

[S2-GigabitEthernet0/0/2]port default vlan6

[S2-GigabitEthernet0/0/2]interface g0/0/22

[S2-GigabitEthernet0/0/22]port link-typeaccess

[S2-GigabitEthernet0/0/22]port default vlan7

步驟四.S1與S2為相應的vlan配置網關IP位址。

S1為vlan3、4、5提供網關服務、S2為vlan5、6、7提供網關服務。

[S1]interface vlanif 3

[S1-Vlanif3]

Jul 2 2014 18:51:13-08:00 S1 %%01IFNET/4/IF_STATE(l)[1]:Interface Vlanif3has tu

rned into UP state.

[S1-Vlanif3]ip add 10.0.3.1 24

[S1-Vlanif3]interface vlan 4

[S1-Vlanif4]ip add 10.0.4.1 24

[S1-Vlanif4]interface vlanif 5

[S1-Vlanif5]ip add 10.0.5.1 24

[S2]interface vlanif 5

[S2-Vlanif5]ip add 10.0.5.2 24

[S2-Vlanif5]interface vlan 6

[S2-Vlanif6]ip add 10.0.6.1 24

[S2-Vlanif6]interface vlanif 7

[S2-Vlanif7]ip add 10.0.7.1 24

步驟五.S3、R1、R3、S4配置相應的IP位址,病配置預設路由

[Huawei]sysname S3

[S3]interface vlanif 1

[S3-Vlanif1]ip add 10.0.3.33 24

[S3]q

[S3]ip route-static 0.0.0.0 0.0.0.010.0.3.1

注:由于交換機的實體接口無法配置IP位址,是以我們隻能通過vlanif接口實作。雖然S3邏輯上屬于S1上定義的vlan3,但是S3的E0/0/13接口在S3上屬于vlan1,是以在S3上我們給Vlanif1配置Ip位址,才能将S3模拟成一台連接配接到S1的主機,并屬于vlan3.S4交換機的配置思路與這裡一樣。

[Huawei]sysname R1

[R1]interface g0/0/1

[R1-GigabitEthernet0/0/1]ip add 10.0.4.1124

[R1-GigabitEthernet0/0/1]q

[R1]ip route-static 0.0.0.0 0.0.0.010.0.4.1

[r3]sysname R3

[R3]interface g0/0/2

[R3-GigabitEthernet0/0/2]ip add 10.0.6.3324

[R3-GigabitEthernet0/0/2]q

[R3]ip route-static 0.0.0.0 0.0.0.010.0.6.1

[Huawei]sysname S4

[S4]interface vlanif 1

[S4-Vlanif1]ip add 10.0.7.44 24

[S4-Vlanif1]q

[S4]ip route-static 0.0.0.0 0.0.0.010.0.7.1

步驟六.測試vlan3與vlan4之間的連通性

         在R1上測試與S3的連通性

<R1>ping10.0.3.33

  PING 10.0.3.33: 56  data bytes, press CTRL_C to break

    Reply from 10.0.3.33: bytes=56 Sequence=1ttl=254 time=40 ms

    Reply from 10.0.3.33: bytes=56 Sequence=2ttl=254 time=40 ms

    Reply from 10.0.3.33: bytes=56 Sequence=3ttl=254 time=60 ms

    Reply from 10.0.3.33: bytes=56 Sequence=4ttl=254 time=50 ms

    Reply from 10.0.3.33: bytes=56 Sequence=5ttl=254 time=70 ms

  --- 10.0.3.33 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 40/52/70 ms

在R1上測試與R3的連通性,如下

<R1>ping10.0.6.33

  PING 10.0.6.33: 56  data bytes, press CTRL_C to break

    Request time out

  --- 10.0.6.33 ping statistics ---

    0 packet(s) received

    100.00% packet loss

R1與R3之間不能通信。可依照以下檢查思路進行故障排除。

<R1>tracert10.0.6.33

 traceroute to 10.0.6.33(10.0.6.33), max hops: 30 ,packet length: 40,press CTRL_C tobreak

 1 10.0.4.1 30 ms  10 ms 20 ms

 2 10.0.4.1 30 ms  !N 10 ms !N 20 ms  !N

如上顯示,R1已經把目标位址10.0.6.33的資料報發送出去了。但是10.0.4.1(即網關)回應網絡不可達。

是以可以到網關S1上檢視是否因為路由原因而不可達。

[S1]dis iprouting-table

Route Flags: R -relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables:Public

         Destinations : 8        Routes : 8       

Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface

       10.0.3.0/24  Direct 0    0           D  10.0.3.1        Vlanif3

       10.0.3.1/32  Direct 0    0           D  127.0.0.1       Vlanif3

       10.0.4.0/24  Direct 0    0           D  10.0.4.1        Vlanif4

       10.0.4.1/32  Direct 0    0           D  127.0.0.1       Vlanif4

       10.0.5.0/24  Direct 0    0           D  10.0.5.1        Vlanif5

       10.0.5.1/32  Direct 0    0           D  127.0.0.1       Vlanif5

      127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0

      127.0.0.1/32  Direct 0    0           D  127.0.0.1       InLoopBack0

[S1] Userinterface con0 is available

這裡可以看到S1缺少到達10.0.6.0網段路由。

原因是這個網段與S1沒有直連,未配置靜态路由或者動态路由協定。

步驟七.S1與S2之前啟用路由協定OSPF

[S1]ospf 1

[S1-ospf-1]area0

[S1-ospf-1-area-0.0.0.0]network10.0.0.0 0.255.255.255

[S2]ospf 1

[S2-ospf-1]area0

[S2-ospf-1-area-0.0.0.0]network10.0.0.0 0.255.255.255

配置完成後,稍等片刻,待S1與S2的OSPF協定互相交換路由資訊後。檢視S1的路由表。

         Destinations : 10       Routes : 10      

       10.0.4.0/24 Direct  0    0          D   10.0.4.1        Vlanif4

       10.0.5.0/24  Direct 0    0           D  10.0.5.1        Vlanif5

       10.0.5.1/32  Direct 0    0           D  127.0.0.1       Vlanif5

       10.0.6.0/24  OSPF   10   2           D  10.0.5.2        Vlanif5

       10.0.7.0/24  OSPF   10   2           D  10.0.5.2        Vlanif5

     127.0.0.1/32  Direct  0   0           D   127.0.0.1       InLoopBack0

此時S1通過OSPF協定學到了兩條路由資訊。

測試R1與R3之間的連通性。

    Reply from 10.0.6.33: bytes=56 Sequence=1ttl=253 time=70 ms

    Replyfrom 10.0.6.33: bytes=56 Sequence=2 ttl=253 time=60 ms

    Reply from 10.0.6.33: bytes=56 Sequence=3ttl=253 time=60 ms

    Reply from 10.0.6.33: bytes=56 Sequence=4ttl=253 time=70 ms

    Reply from 10.0.6.33: bytes=56 Sequence=5ttl=253 time=60 ms

    round-trip min/avg/max = 60/64/70 ms

<R1>ping10.0.7.44

  PING 10.0.7.44: 56  data bytes, press CTRL_C to break

    Reply from 10.0.7.44: bytes=56 Sequence=1ttl=253 time=80 ms

    Reply from 10.0.7.44: bytes=56 Sequence=2ttl=253 time=50 ms

    Reply from 10.0.7.44: bytes=56 Sequence=3ttl=253 time=70 ms

    Reply from 10.0.7.44: bytes=56 Sequence=4ttl=253 time=90 ms

    Reply from 10.0.7.44: bytes=56 Sequence=5ttl=253 time=60 ms

  --- 10.0.7.44 ping statistics ---

    round-trip min/avg/max = 50/70/90 ms

本文轉自 zhuxtqw 51CTO部落格,原文連結:http://blog.51cto.com/1054054/1434979,如需轉載請自行聯系原作者

繼續閱讀