1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 三层交换机实现vlan间通信

三层交换机实现vlan间通信

时间:2023-12-02 16:32:46

相关推荐

三层交换机实现vlan间通信

华为交换机:三层交换机实现vlan间通信

实验环境介绍一、划分vlan并将相应的接口加入VLANswh1配置swh2配置swh3配置二、配置trunk并允许所有vlan通过三、核心交换机swh4的配置四、验证结果

实验环境介绍

一、划分vlan并将相应的接口加入VLAN

swh1配置

<Huawei>SYSEnter system view, return user view with Ctrl+Z.[Huawei]sys swh1[swh1][swh1]int g0/0/1[swh1-GigabitEthernet0/0/1]port link-type access [swh1-GigabitEthernet0/0/1]int g0/0/2[swh1-GigabitEthernet0/0/2]port link-type access[swh1-GigabitEthernet0/0/2]int g0/0/3[swh1-GigabitEthernet0/0/3]port link-type access[swh1-GigabitEthernet0/0/3]q[swh1]vlan 10[swh1-vlan10]port g0/0/1[swh1-vlan10]q[swh1][swh1]vlan 20[swh1-vlan20][swh1-vlan20]port g0/0/2[swh1-vlan20]q[swh1]vlan 30[swh1-vlan30]port g0/0/3

查看vlan

[swh1]dis vlanThe total number of vlans is : 4--------------------------------------------------------------------------------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/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 UT:GE0/0/1(D) 20 common UT:GE0/0/2(D) 30 common UT:GE0/0/3(D) VID Status PropertyMAC-LRN Statistics Description--------------------------------------------------------------------------------1 enable default enable disable VLAN 000110 enable default enable disable VLAN 001020 enable default enable disable VLAN 002030 enable default enable disable VLAN 0030

swh2配置

The device is running!##########<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]sys swh2[swh2][swh2]int g0/0/1[swh2-GigabitEthernet0/0/1]port link-type access [swh2-GigabitEthernet0/0/1]int g0/0/2[swh2-GigabitEthernet0/0/2]port link-type access[swh2-GigabitEthernet0/0/2]int g0/0/3[swh2-GigabitEthernet0/0/3]port link-type access[swh2-GigabitEthernet0/0/3]q[swh2]vlan 10[swh2-vlan10]port g0/0/1[swh2-vlan10]q[swh2][swh2]vlan 20[swh2-vlan20]port g0/0/2[swh2-vlan20]q[swh2]vlan 30[swh2-vlan30]port g0/0/3[swh2-vlan30]q[swh2]dis vlanThe total number of vlans is : 4--------------------------------------------------------------------------------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/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 UT:GE0/0/1(D) 20 common UT:GE0/0/2(D) 30 common UT:GE0/0/3(D) VID Status PropertyMAC-LRN Statistics Description--------------------------------------------------------------------------------1 enable default enable disable VLAN 000110 enable default enable disable VLAN 001020 enable default enable disable VLAN 002030 enable default enable disable VLAN 0030[swh2]

swh3配置

The device is running!<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]sys swh3[swh3][swh3]int g0/0/1[swh3-GigabitEthernet0/0/1]port link-type access [swh3-GigabitEthernet0/0/1]int g0/0/2[swh3-GigabitEthernet0/0/2]port link-type access[swh3-GigabitEthernet0/0/2]int g0/0/3[swh3-GigabitEthernet0/0/3]port link-type access[swh3-GigabitEthernet0/0/3]q[swh3][swh3]vlan 10[swh3-vlan10]port g0/0/1[swh3-vlan10]q[swh3]vlan 20[swh3-vlan20]port g0/0/2[swh3-vlan20]q[swh3]vlan 30[swh3-vlan30]port g0/0/3[swh3-vlan30]q[swh3]dis vlanThe total number of vlans is : 4--------------------------------------------------------------------------------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/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(U) 10 common UT:GE0/0/1(U) 20 common UT:GE0/0/2(U) 30 common UT:GE0/0/3(U) VID Status PropertyMAC-LRN Statistics Description--------------------------------------------------------------------------------1 enable default enable disable VLAN 000110 enable default enable disable VLAN 001020 enable default enable disable VLAN 002030 enable default enable disable VLAN 0030[swh3][swh3]q<swh3>saveThe current configuration will be written to the device.Are you sure to continue?[Y/N]yInfo: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:Oct 21 10:18:18-08:00 swh3 %%01CFM/4/SAVE(l)[0]:The user chose Y when deciding whether to save the configuration to the device.Now saving the current configuration to the slot 0.Save the configuration successfully.<swh3>Oct 21 10:20:00-08:00 swh3 %%01PHY/1/PHY(l)[4]: GigabitEthernet0/0/24: change status to upOct 21 10:20:00-08:00 swh3 %%01IFNET/4/IF_STATE(l)[5]:Interface Vlanif1 hasturned into UP state.<swh3>

二、配置trunk并允许所有vlan通过

swh1、swh2、swh3三台交换机的g0/0/24链接的是swh4,swh4可以看作是是核心交换机,所以我们必须将123三台交换机的g0/0/24配置成trunk,并且要配置允许所有vlan通过

[swh1]int g0/0/24[swh1-GigabitEthernet0/0/24]port link-type trunk [swh1-GigabitEthernet0/0/24]port trunk allow-pass vlan all ##允许所有vlan通过 [swh1-GigabitEthernet0/0/24]q[swh1]q<swh1>save[swh2]int g0/0/24[swh2-GigabitEthernet0/0/24]port link-type trunk[swh2-GigabitEthernet0/0/24]port trunk allow-pass vlan all [swh2-GigabitEthernet0/0/24]q[swh2]q<swh2>save[swh3]int g0/0/24[swh3-GigabitEthernet0/0/24]port link-type trunk[swh3-GigabitEthernet0/0/24]port trunk allow-pass vlan all[swh3-GigabitEthernet0/0/24]q[swh3]q<swh3>save

查看vlan

[swh1]dis vlanThe total number of vlans is : 4--------------------------------------------------------------------------------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/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(U) 10 common UT:GE0/0/1(U) TG:GE0/0/24(U)#允许所有vlan通过20 common UT:GE0/0/2(U) TG:GE0/0/24(U)#允许所有vlan通过 30 common UT:GE0/0/3(U) TG:GE0/0/24(U)#允许所有vlan通过VID Status PropertyMAC-LRN Statistics Description--------------------------------------------------------------------------------1 enable default enable disable VLAN 000110 enable default enable disable VLAN 001020 enable default enable disable VLAN 002030 enable default enable disable VLAN 0030[swh1]

三、核心交换机swh4的配置

我们从拓扑图上看出swh4是此网络的核心交换机,因此swh4上的配置尤为重要,步骤如下:

首先必须将g0/0/1g0/0/2g0/0/3的端口类型更改为trunk;其次必须将g0/0/1g0/0/2g0/0/3的端口配置为允许所有vlan通过;创建对应的vlan10、vlan20、vlan30,并且为这三个vlan配置IP地址。

<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]sys swh4[swh4][swh4]int g0/0/1[swh4-GigabitEthernet0/0/1]port link-type trunk #端口类型更改为trunk[swh4-GigabitEthernet0/0/1]port trunk allow-pass vlan all #允许所有vlan通过[swh4-GigabitEthernet0/0/1]int g0/0/2[swh4-GigabitEthernet0/0/2]port link-type trunk[swh4-GigabitEthernet0/0/2]port trunk allow-pass vlan all[swh4-GigabitEthernet0/0/2]int g0/0/3[swh4-GigabitEthernet0/0/3]port link-type trunk[swh4-GigabitEthernet0/0/3]port trunk allow-pass vlan all[swh4]vlan 10#创建vlan[swh4-vlan10]q[swh4]vlan 20[swh4-vlan20]q[swh4]vlan 30[swh4-vlan30]q[swh4]int vlan 10[swh4-Vlanif10][swh4-Vlanif10]ip address 192.168.10.254 24#给vlan10配置IP地址[swh4-Vlanif10]q[swh4]int vlan 20[swh4-Vlanif20]ip add 192.168.20.254 24[swh4-Vlanif20][swh4-Vlanif20]q[swh4]vlan 30[swh4]int vlan 30[swh4-Vlanif30]ip add 192.168.30.254 24[swh4-Vlanif30][swh4-Vlanif30]q[swh4]dis vlanThe total number of vlans is : 4--------------------------------------------------------------------------------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(U)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 TG:GE0/0/1(U)GE0/0/2(U)GE0/0/3(U) 20 common TG:GE0/0/1(U)GE0/0/2(U)GE0/0/3(U) 30 common TG:GE0/0/1(U)GE0/0/2(U)GE0/0/3(U) VID Status PropertyMAC-LRN Statistics Description--------------------------------------------------------------------------------1 enable default enable disable VLAN 000110 enable default enable disable VLAN 001020 enable default enable disable VLAN 002030 enable default enable disable VLAN 0030[swh4]

四、验证结果

在PC1上ping PC 789

Welcome to use PC Simulator!PC>ping 192.168.10.3Ping 192.168.10.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.10.1: Destination host unreachableFrom 192.168.10.1: Destination host unreachableFrom 192.168.10.1: Destination host unreachableFrom 192.168.10.1: Destination host unreachableFrom 192.168.10.1: Destination host unreachable--- 192.168.10.3 ping statistics ---5 packet(s) transmitted0 packet(s) received100.00% packet lossPC>ping 192.168.20.1Ping 192.168.20.1: 32 data bytes, Press Ctrl_C to breakFrom 192.168.10.1: Destination host unreachablePC>ping 192.168.10.3Ping 192.168.10.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.10.3: bytes=32 seq=1 ttl=128 time=78 msFrom 192.168.10.3: bytes=32 seq=2 ttl=128 time=78 msFrom 192.168.10.3: bytes=32 seq=3 ttl=128 time=78 ms--- 192.168.10.3 ping statistics ---3 packet(s) transmitted3 packet(s) received0.00% packet lossround-trip min/avg/max = 78/78/78 msPC>ping 192.168.30.3Ping 192.168.30.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.30.3: bytes=32 seq=1 ttl=127 time=141 msFrom 192.168.30.3: bytes=32 seq=2 ttl=127 time=63 ms--- 192.168.30.3 ping statistics ---2 packet(s) transmitted2 packet(s) received0.00% packet lossround-trip min/avg/max = 63/102/141 msPC>ping 192.168.20.3Ping 192.168.20.3: 32 data bytes, Press Ctrl_C to breakFrom 192.168.20.3: bytes=32 seq=1 ttl=127 time=110 msFrom 192.168.20.3: bytes=32 seq=2 ttl=127 time=78 msFrom 192.168.20.3: bytes=32 seq=3 ttl=127 time=62 msFrom 192.168.20.3: bytes=32 seq=4 ttl=127 time=62 ms--- 192.168.20.3 ping statistics ---4 packet(s) transmitted4 packet(s) received0.00% packet lossround-trip min/avg/max = 62/78/110 msPC>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。