VLAN

来源:互联网 发布:js函数内定义全局变量 编辑:程序博客网 时间:2024/06/06 17:13

VLAN基础配置及Access接口

这里写图片描述
这里写图片描述
这里写图片描述

实验拓扑

这里写图片描述
这里写图片描述
这里写图片描述

PC>ping 10.1.1.2Ping 10.1.1.2: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.2: bytes=32 seq=1 ttl=128 time=46 msFrom 10.1.1.2: bytes=32 seq=2 ttl=128 time=47 msFrom 10.1.1.2: bytes=32 seq=3 ttl=128 time=47 msFrom 10.1.1.2: bytes=32 seq=4 ttl=128 time=47 msFrom 10.1.1.2: bytes=32 seq=5 ttl=128 time=63 ms--- 10.1.1.2 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 46/50/63 ms

其他主机间互相通信测试和上述相同,略过.
这里写图片描述

[Huawei]vlan 10[Huawei-vlan10]vlan 20
[Huawei]vlan batch 30 40
[S1]display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(D)                     Eth0/0/5(U)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)                     Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      10   common  20   common  VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020    
[S2]display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(D)     Eth0/0/4(D)                     Eth0/0/5(U)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)                     Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      30   common  40   common  VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         30   enable  default       enable  disable    VLAN 0030                         40   enable  default       enable  disable    VLAN 0040      

这里写图片描述
这里写图片描述

[S1]int g0/0/1[S1-GigabitEthernet0/0/1]port link-type access[S1-GigabitEthernet0/0/1]port default vlan 10[S1]int e0/0/2[S1-Ethernet0/0/2]port link-type access     [S1-Ethernet0/0/2]port default vlan 10[S1-Ethernet0/0/2]int e0/0/3[S1-Ethernet0/0/3]port link-type access [S1-Ethernet0/0/3]port default vlan 20
[S2]int e0/0/1[S2-Ethernet0/0/1]port link-type access [S2-Ethernet0/0/1]port default vlan 30[S2-Ethernet0/0/1]int e0/0/2[S2-Ethernet0/0/2]port link-type access [S2-Ethernet0/0/2]port default vlan 40
[S1]display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/4(D)     Eth0/0/5(U)     Eth0/0/6(D)                     Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)                    Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)                    Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)                    Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)                    GE0/0/2(D)                                                      10   common  UT:Eth0/0/2(U)     GE0/0/1(D)                                      20   common  UT:Eth0/0/3(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020 
[S2]display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/3(D)     Eth0/0/4(D)     Eth0/0/5(U)     Eth0/0/6(D)                     Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)                    Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)                    Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)                    Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)                    GE0/0/1(D)      GE0/0/2(D)                                      30   common  UT:Eth0/0/1(U)                                                     40   common  UT:Eth0/0/2(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         30   enable  default       enable  disable    VLAN 0030                         40   enable  default       enable  disable    VLAN 0040    

这里写图片描述
这里写图片描述

PC>ping 10.1.1.2Ping 10.1.1.2: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.2: bytes=32 seq=1 ttl=128 time=32 msFrom 10.1.1.2: bytes=32 seq=2 ttl=128 time=47 msFrom 10.1.1.2: bytes=32 seq=3 ttl=128 time=31 msFrom 10.1.1.2: bytes=32 seq=4 ttl=128 time=47 msFrom 10.1.1.2: bytes=32 seq=5 ttl=128 time=31 ms--- 10.1.1.2 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 31/37/47 ms
PC>ping 10.1.1.3Ping 10.1.1.3: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachable--- 10.1.1.3 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet loss

配置Trunk端口

原理概述

这里写图片描述
这里写图片描述
这里写图片描述

实验拓扑

这里写图片描述
这里写图片描述
这里写图片描述

PC>ping 10.1.1.3Ping 10.1.1.3: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.3: bytes=32 seq=1 ttl=128 time=63 msFrom 10.1.1.3: bytes=32 seq=2 ttl=128 time=78 msFrom 10.1.1.3: bytes=32 seq=3 ttl=128 time=78 msFrom 10.1.1.3: bytes=32 seq=4 ttl=128 time=78 msFrom 10.1.1.3: bytes=32 seq=5 ttl=128 time=47 ms--- 10.1.1.3 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 47/68/78 ms

这里写图片描述

[S1]vlan 10[S1-vlan10]description R$D[S1-vlan10]vlan 20[S1-vlan20]description Market
[S2]vlan 10[S2-vlan10]description R$D[S2-vlan10]vlan 20[S2-vlan20]description Market
[S3]vlan 10[S3-vlan10]description R$D[S3-vlan10]vlan 20[S3-vlan20]description Market
<S3>display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------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(U)      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/9(D)      GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)                     GE0/0/13(D)     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)     10   common  20   common  VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    R$D                               20   enable  default       enable  disable    Market     
<S3>display vlan summary static vlan:Total 3 static vlan.  1 10 20 dynamic vlan:Total 0 dynamic vlan.reserved vlan:Total 0 reserved vlan.

配置Access端口

[S1]int e0/0/2[S1-Ethernet0/0/2]port link-type access [S1-Ethernet0/0/2]port default vlan 10[S1-Ethernet0/0/2]int e0/0/3[S1-Ethernet0/0/3]port link-type access     [S1-Ethernet0/0/3]port default vlan 20
[S2]int e0/0/3[S2-Ethernet0/0/3]port link-type access [S2-Ethernet0/0/3]port default vlan 10[S2-Ethernet0/0/3]int e0/0/4[S2-Ethernet0/0/4]port link-type access     [S2-Ethernet0/0/4]port default vlan 20
<S1>display port vlan Port                    Link Type    PVID  Trunk VLAN List-------------------------------------------------------------------------------Ethernet0/0/1           hybrid       1     -                                   Ethernet0/0/2           access       10    -                                   Ethernet0/0/3           access       20    -   
[S2]display port vlan Port                    Link Type    PVID  Trunk VLAN List-------------------------------------------------------------------------------Ethernet0/0/1           hybrid       1     -                                   Ethernet0/0/2           hybrid       1     -                                   Ethernet0/0/3           access       10    -                                   Ethernet0/0/4           access       20    -  

这里写图片描述
这里写图片描述

PC>ping 10.1.1.3Ping 10.1.1.3: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachableFrom 10.1.1.1: Destination host unreachable--- 10.1.1.3 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet loss

这里写图片描述

PC>ping 10.1.1.4Ping 10.1.1.4: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.2: Destination host unreachableFrom 10.1.1.2: Destination host unreachableFrom 10.1.1.2: Destination host unreachableFrom 10.1.1.2: Destination host unreachableFrom 10.1.1.2: Destination host unreachable--- 10.1.1.4 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet loss

这里写图片描述

[S1]int e0/0/1[S1-Ethernet0/0/1]port link-type trunk [S1-Ethernet0/0/1]port trunk allow-pass vlan 10 20

这里写图片描述

[S2]int e0/0/2  [S2-Ethernet0/0/2]port link-type trunk [S2-Ethernet0/0/2]port trunk  allow-pass vlan 10 20

这里写图片描述

[S3]int g0/0/1  [S3-GigabitEthernet0/0/1]port link-type trunk [S3-GigabitEthernet0/0/1]port trunk allow-pass vlan all [S3-GigabitEthernet0/0/1]int g0/0/2[S3-GigabitEthernet0/0/2]port link-type trunk [S3-port-group-trunk]port trunk allow-pass vlan all 
[S3-port-group-trunk]display port vlan Port                    Link Type    PVID  Trunk VLAN List-------------------------------------------------------------------------------GigabitEthernet0/0/1    trunk        1     1-4094GigabitEthernet0/0/2    trunk        1     1-4096

这里写图片描述

PC>ping 10.1.1.3Ping 10.1.1.3: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.3: bytes=32 seq=1 ttl=128 time=62 msFrom 10.1.1.3: bytes=32 seq=2 ttl=128 time=109 msFrom 10.1.1.3: bytes=32 seq=3 ttl=128 time=78 msFrom 10.1.1.3: bytes=32 seq=4 ttl=128 time=125 msFrom 10.1.1.3: bytes=32 seq=5 ttl=128 time=63 ms--- 10.1.1.3 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 62/87/125 ms
PC>ping 10.1.1.4Ping 10.1.1.4: 32 data bytes, Press Ctrl_C to breakFrom 10.1.1.4: bytes=32 seq=1 ttl=128 time=78 msFrom 10.1.1.4: bytes=32 seq=2 ttl=128 time=125 msFrom 10.1.1.4: bytes=32 seq=3 ttl=128 time=78 msFrom 10.1.1.4: bytes=32 seq=4 ttl=128 time=78 msFrom 10.1.1.4: bytes=32 seq=5 ttl=128 time=94 ms--- 10.1.1.4 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 78/90/125 ms

理解Hybird接口的应用

这里写图片描述
这里写图片描述
这里写图片描述

实验拓扑

这里写图片描述
这里写图片描述

实验步骤

PC>ping 192.168.1.2Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.2: bytes=32 seq=1 ttl=128 time=47 msFrom 192.168.1.2: bytes=32 seq=2 ttl=128 time=32 msFrom 192.168.1.2: bytes=32 seq=3 ttl=128 time=31 msFrom 192.168.1.2: bytes=32 seq=4 ttl=128 time=46 msFrom 192.168.1.2: bytes=32 seq=5 ttl=128 time=31 ms--- 192.168.1.2 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 31/37/47 ms

这里写图片描述
这里写图片描述

[S1]display port vlan Port                    Link Type    PVID  Trunk VLAN List-------------------------------------------------------------------------------Ethernet0/0/1           hybrid       1     -                                   Ethernet0/0/2           hybrid       1     -                                   Ethernet0/0/3           hybrid       1     -                                   Ethernet0/0/4           hybrid       1     -                                   Ethernet0/0/5           hybrid       1     -                                   Ethernet0/0/6           hybrid       1     -                                   Ethernet0/0/7           hybrid       1     -                                   Ethernet0/0/8           hybrid       1     -                                   Ethernet0/0/9           hybrid       1     -              

这里写图片描述

[S1]display vlanThe total number of vlans is : 1--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(U)                     Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)                     Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001  

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

[S1]int e0/0/2[S1-Ethernet0/0/2]port link-type access [S1-Ethernet0/0/2]port default vlan 20[S1-Ethernet0/0/2]int e0/0/3[S1-Ethernet0/0/3]port link-type access[S1-Ethernet0/0/3]port default vlan 10[S1]int e0/0/1[S1-Ethernet0/0/1]port link-type trunk [S1-Ethernet0/0/1]port trunk allow-pass vlan all
[S2]int e0/0/2[S2-Ethernet0/0/2]port link-type access[S2-Ethernet0/0/2]port default vlan 20[S2]int e0/0/3[S2-Ethernet0/0/3]port link-type access[S2-Ethernet0/0/3]port default vlan 10[S2-Ethernet0/0/2]int e0/0/1[S2-Ethernet0/0/1]port link-type trunk [S2-Ethernet0/0/1]port trunk allow-pass vlan all
<S1>display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/4(U)     Eth0/0/5(D)     Eth0/0/6(D)                     Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)                    Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)                    Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)                    Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)                    GE0/0/1(D)      GE0/0/2(D)                                      10   common  UT:Eth0/0/3(U)                                                                  TG:Eth0/0/1(U)                                                     20   common  UT:Eth0/0/2(U)                                                                  TG:Eth0/0/1(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020 <S2>display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/4(D)     Eth0/0/5(D)     Eth0/0/6(D)                     Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)                    Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)                    Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)                    Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)                    GE0/0/1(D)      GE0/0/2(D)                                      10   common  UT:Eth0/0/3(U)                                                                  TG:Eth0/0/1(U)                                                     20   common  UT:Eth0/0/2(U)                                                                  TG:Eth0/0/1(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020  
PC>ping 192.168.1.3Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.3: bytes=32 seq=1 ttl=128 time=63 msFrom 192.168.1.3: bytes=32 seq=2 ttl=128 time=62 msFrom 192.168.1.3: bytes=32 seq=3 ttl=128 time=78 msFrom 192.168.1.3: bytes=32 seq=4 ttl=128 time=63 msFrom 192.168.1.3: bytes=32 seq=5 ttl=128 time=47 ms--- 192.168.1.3 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 47/62/78 msPC>ping 192.168.1.4Ping 192.168.1.4: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachable--- 192.168.1.4 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet loss

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

<S1>display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(U)                     Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)                     Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      10   common  UT:Eth0/0/3(U)                                                                  TG:Eth0/0/1(U)                                                     20   common  UT:Eth0/0/2(U)                                                                  TG:Eth0/0/1(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020  <S2>display vlanThe total number of vlans is : 3--------------------------------------------------------------------------------U: Up;         D: Down;         TG: Tagged;         UT: Untagged;MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;--------------------------------------------------------------------------------VID  Type    Ports                                                          --------------------------------------------------------------------------------1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(D)                     Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)                     Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      10   common  UT:Eth0/0/3(U)                                                                  TG:Eth0/0/1(U)                                                     20   common  UT:Eth0/0/2(U)                                                                  TG:Eth0/0/1(U)                                                     VID  Status  Property      MAC-LRN Statistics Description      --------------------------------------------------------------------------------1    enable  default       enable  disable    VLAN 0001                         10   enable  default       enable  disable    VLAN 0010                         20   enable  default       enable  disable    VLAN 0020                         

这里写图片描述
这里写图片描述
这里写图片描述

[S1]vlan 30[S1-vlan30]int e0/0/4[S1-Ethernet0/0/4]port hybrid pvid vlan 30

这里写图片描述

[S1-Ethernet0/0/4]port hybrid untagged vlan 10 20 30

这里写图片描述

[S1-Ethernet0/0/4]int e0/0/2[S1-Ethernet0/0/2]port hybrid untagged vlan 20 30

这里写图片描述

[S1-Ethernet0/0/2]int e0/0/3[S1-Ethernet0/0/3]port hybrid untagged vlan 10 30

这里写图片描述

[S1]int e0/0/1[S1-Ethernet0/0/1]port hybrid tagged vlan 10 20 30[S2]int e0/0/1[S2-Ethernet0/0/1]port hybrid tagged vlan 10 20 30

这里写图片描述

[S2]int e0/0/2[S2-Ethernet0/0/2]port hybrid untagged vlan 20 30[S2-Ethernet0/0/2]int e0/0/3[S2-Ethernet0/0/3]port hybrid untagged vlan 10 30
PC>ping 192.168.1.3Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.3: bytes=32 seq=1 ttl=128 time=62 msFrom 192.168.1.3: bytes=32 seq=2 ttl=128 time=63 msFrom 192.168.1.3: bytes=32 seq=3 ttl=128 time=31 msFrom 192.168.1.3: bytes=32 seq=4 ttl=128 time=62 msFrom 192.168.1.3: bytes=32 seq=5 ttl=128 time=62 ms--- 192.168.1.3 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 31/56/63 msPC>ping 192.168.1.2Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachable--- 192.168.1.2 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet lossPC>ping 192.168.1.4Ping 192.168.1.4: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachable--- 192.168.1.4 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet lossPC>ping 192.168.1.100Ping 192.168.1.100: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.100: bytes=32 seq=1 ttl=128 time=46 msFrom 192.168.1.100: bytes=32 seq=2 ttl=128 time=31 msFrom 192.168.1.100: bytes=32 seq=3 ttl=128 time=16 msFrom 192.168.1.100: bytes=32 seq=4 ttl=128 time=31 msFrom 192.168.1.100: bytes=32 seq=5 ttl=128 time=31 ms--- 192.168.1.100 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 16/31/46 ms

这里写图片描述

利用单臂路由实现VLAN间路由

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

实验拓扑

这里写图片描述
这里写图片描述
这里写图片描述

[S2]vlan 10[S2-vlan10]description HR[S2-vlan10]vlan 20[S2-vlan20]description Market[S2-vlan20]int e0/0/1[S2-Ethernet0/0/1]port link-type access[S2-Ethernet0/0/1]port default vlan 10[S2-Ethernet0/0/1]int e0/0/2[S2-Ethernet0/0/2]port link-type access[S2-Ethernet0/0/2]port default vlan 20

这里写图片描述

[S3]vlan 30[S3-vlan30]description Manager[S3-vlan30]int e0/0/1[S3-Ethernet0/0/1]port link-type access[S3-Ethernet0/0/1]port default vlan 30

这里写图片描述

[S2]int g0/0/2[S2-GigabitEthernet0/0/2]port link-type trunk[S2-GigabitEthernet0/0/2]port trunk allow-pass vlan all[S3]int g0/0/2[S3-GigabitEthernet0/0/2]port link-type trunk[S3-GigabitEthernet0/0/2]port trunk allow-pass vlan all 

这里写图片描述
这里写图片描述
这里写图片描述

PC>ping 192.168.2.1Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachable--- 192.168.1.254 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet lossPC>ping 192.168.3.1Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachableFrom 192.168.1.1: Destination host unreachable--- 192.168.1.254 ping statistics ---  5 packet(s) transmitted  0 packet(s) received  100.00% packet loss

可以看到,通信仍然无法建立。
这里写图片描述
这里写图片描述
配置完成后,在路由器R1上查看接口状态

[R1-GigabitEthernet0/0/1.1]display ip interface brief*down: administratively down^down: standby(l): loopback(s): spoofingThe number of interface that is UP in Physical is 5The number of interface that is DOWN in Physical is 3The number of interface that is UP in Protocol is 4The number of interface that is DOWN in Protocol is 4Interface                         IP Address/Mask      Physical   Protocol  GigabitEthernet0/0/0              unassigned           down       down      GigabitEthernet0/0/0.1            unassigned           down       down      GigabitEthernet0/0/1              unassigned           up         down      GigabitEthernet0/0/1.1            192.168.1.254/24     up         up        GigabitEthernet0/0/1.2            192.168.2.254/24     up         up        GigabitEthernet0/0/1.3            192.168.3.254/24     up         up        GigabitEthernet0/0/2              unassigned           down       down      NULL0                             unassigned           up         up(s) 

可以看到,3个子接口的物理状态和协议都正常
查看路由器R1的路由表。

[R1]display ip routing-tableRoute Flags: R - relay, D - download to fib------------------------------------------------------------------------------Routing Tables: Public         Destinations : 13       Routes : 13       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface      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       InLoopBack0127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0    192.168.1.0/24  Direct  0    0           D   192.168.1.254   GigabitEthernet0/0/1.1  192.168.1.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.1  192.168.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.1    192.168.2.0/24  Direct  0    0           D   192.168.2.254   GigabitEthernet0/0/1.2  192.168.2.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.2  192.168.2.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.2    192.168.3.0/24  Direct  0    0           D   192.168.3.254   GigabitEthernet0/0/1.3  192.168.3.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.3  192.168.3.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1.3255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

可以观察到,路由表中已经有了192.168.1.0/24,192.168.2.0/24,192.168.3.0/24的路由条目,并且都是路由器R1的直连路由,类似于路由器上的直连物理接口。
在PC-1分别测试与网关地址192.168.1.254和PC-2间的连通性。

PC>ping 192.168.1.254Ping 192.168.1.254: 32 data bytes, Press Ctrl_C to breakFrom 192.168.1.254: bytes=32 seq=1 ttl=255 time=78 msFrom 192.168.1.254: bytes=32 seq=2 ttl=255 time=47 msFrom 192.168.1.254: bytes=32 seq=3 ttl=255 time=63 msFrom 192.168.1.254: bytes=32 seq=4 ttl=255 time=47 msFrom 192.168.1.254: bytes=32 seq=5 ttl=255 time=47 ms--- 192.168.1.254 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 47/56/78 msPC>ping 192.168.2.1Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to breakFrom 192.168.2.1: bytes=32 seq=1 ttl=127 time=109 msFrom 192.168.2.1: bytes=32 seq=2 ttl=127 time=109 msFrom 192.168.2.1: bytes=32 seq=3 ttl=127 time=125 msFrom 192.168.2.1: bytes=32 seq=4 ttl=127 time=125 msFrom 192.168.2.1: bytes=32 seq=5 ttl=127 time=109 ms--- 192.168.2.1 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 109/115/125 ms

可以观察到,通信正常。在PC-2上TracertPC-2

PC>tracert 192.168.2.1traceroute to 192.168.2.1, 8 hops max(ICMP), press Ctrl+C to stop 1  192.168.1.254   63 ms  62 ms  62 ms 2    *192.168.2.1   125 ms  125 ms

这里写图片描述

利用三层交换机实现VLAN间路由

这里写图片描述
这里写图片描述

实验拓扑

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
2.配置三层交换机实现VLAN间通信
这里写图片描述

[S1]interface Vlanif 10[S1-Vlanif10]ip address 192.168.1.254 24[S1-Vlanif10]interface vlanif 20[S1-Vlanif20]ip address 192.168.2.254 24
[S1-Vlanif20]display ip interface brief *down: administratively down^down: standby(l): loopback(s): spoofingThe number of interface that is UP in Physical is 3The number of interface that is DOWN in Physical is 2The number of interface that is UP in Protocol is 3The number of interface that is DOWN in Protocol is 2Interface                         IP Address/Mask      Physical   Protocol  MEth0/0/1                         unassigned           down       down      NULL0                             unassigned           up         up(s)     Vlanif1                           unassigned           down       down      Vlanif10                          192.168.1.254/24     up         up        Vlanif20                          192.168.2.254/24     up         up  
PC>ping 192.168.2.1Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to breakFrom 192.168.2.1: bytes=32 seq=1 ttl=127 time=62 msFrom 192.168.2.1: bytes=32 seq=2 ttl=127 time=31 msFrom 192.168.2.1: bytes=32 seq=3 ttl=127 time=62 msFrom 192.168.2.1: bytes=32 seq=4 ttl=127 time=32 msFrom 192.168.2.1: bytes=32 seq=5 ttl=127 time=31 ms--- 192.168.2.1 ping statistics ---  5 packet(s) transmitted  5 packet(s) received  0.00% packet loss  round-trip min/avg/max = 31/43/62 ms
PC>arp -aInternet Address    Physical Address    Type192.168.1.254       4C-1F-CC-2D-64-D7   dynamic

这里写图片描述

0 0
原创粉丝点击