欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vlan实验

程序员文章站 2022-04-09 19:39:54
...

vlan实验

拓扑图

vlan实验

ip

Pc1:10.0.0.1  255.255.255.0
Pc2:10.0.0.2  255.255.255.0
Pc3:10.0.0.3  255.255.255.0
Pc4:10.0.0.4  255.255.255.0

vlan实验

接口状态一定要是启用状态
vlan实验
左边交换机

[H3C]

[H3C]vlan 10
[H3C-vlan10]port GigabitEthernet 1/0/1
[H3C-vlan10]quit
[H3C]vlan 20
[H3C-vlan20]port GigabitEthernet 1/0/2
[H3C-vlan20]quit
[H3C]int g 1/0/1
[H3C-GigabitEthernet1/0/1]port lin
[H3C-GigabitEthernet1/0/1]port link-ty
[H3C-GigabitEthernet1/0/1]port link-type access
[H3C-GigabitEthernet1/0/1]po
[H3C-GigabitEthernet1/0/1]port acc
[H3C-GigabitEthernet1/0/1]port access vlan 10
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g 1/0/2
[H3C-GigabitEthernet1/0/2]po
[H3C-GigabitEthernet1/0/2]port link
[H3C-GigabitEthernet1/0/2]port link-ty
[H3C-GigabitEthernet1/0/2]port link-type acc
[H3C-GigabitEthernet1/0/2]port link-type access
[H3C-GigabitEthernet1/0/2]port acc
[H3C-GigabitEthernet1/0/2]port access vlan 20
[H3C-GigabitEthernet1/0/2]qui
[H3C-GigabitEthernet1/0/2]quit
[H3C]int g 1/0/24
[H3C-GigabitEthernet1/0/24]po lin
[H3C-GigabitEthernet1/0/24]port link
[H3C-GigabitEthernet1/0/24]port link-typ
[H3C-GigabitEthernet1/0/24]port link-type trun
[H3C-GigabitEthernet1/0/24]port link-type trunk
[H3C-GigabitEthernet1/0/24]port trun
[H3C-GigabitEthernet1/0/24]port trunk per
[H3C-GigabitEthernet1/0/24]port trunk permit vlan 10 20
[H3C-GigabitEthernet1/0/24]
//设置hybrid
<H3C>
<H3C>
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]int g 1/0/1
[H3C-GigabitEthernet1/0/1]por
[H3C-GigabitEthernet1/0/1]port link-ty hybrid
[H3C-GigabitEthernet1/0/1]port hybrid  vlan 10 20 untagged
You can assign the port to existing static VLANs only.
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g 1/0/2
[H3C-GigabitEthernet1/0/2]po li
[H3C-GigabitEthernet1/0/2]port
[H3C-GigabitEthernet1/0/2]port link
[H3C-GigabitEthernet1/0/2]port link-ty
[H3C-GigabitEthernet1/0/2]port link-type hy
[H3C-GigabitEthernet1/0/2]port link-type hybrid
[H3C-GigabitEthernet1/0/2]port hybrid vlan 10 20 un
[H3C-GigabitEthernet1/0/2]port hybrid vlan 10 20 untagged
You can assign the port to existing static VLANs only.
[H3C-GigabitEthernet1/0/2]quit
[H3C]

右边交换机


[H3C]vlan 10
[H3C-vlan10]port GigabitEthernet 1/0/1
[H3C-vlan10]quit
[H3C]vlan 20
[H3C-vlan20]port GigabitEthernet 1/0/2
[H3C-vlan20]quit
[H3C]int g1/0/1
[H3C-GigabitEthernet1/0/1]port link-type  access
[H3C-GigabitEthernet1/0/1]port access  vlan 10
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g1/0/2
[H3C-GigabitEthernet1/0/2]port acc
[H3C-GigabitEthernet1/0/2]port access vlan 20
[H3C-GigabitEthernet1/0/2]port link-type access
[H3C-GigabitEthernet1/0/2]port access  vlan 20
[H3C-GigabitEthernet1/0/2]qui
[H3C-GigabitEthernet1/0/2]quit
[H3C]int g1/0/24
[H3C-GigabitEthernet1/0/24]port link-type trunk
[H3C-GigabitEthernet1/0/24]port trun
[H3C-GigabitEthernet1/0/24]port trunk per
[H3C-GigabitEthernet1/0/24]port trunk permit vlan 10 20
[H3C-GigabitEthernet1/0/24]quit
[H3C]

开启端口and保存代码


[H3C]int g1/0/1
[H3C-GigabitEthernet1/0/1]no shu
[H3C-GigabitEthernet1/0/1]no shutdown
[H3C-GigabitEthernet1/0/1]qui
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g1/0/2
[H3C-GigabitEthernet1/0/2]no shu
[H3C-GigabitEthernet1/0/2]no shutdown
[H3C-GigabitEthernet1/0/2]qui
[H3C-GigabitEthernet1/0/2]quit
[H3C]int g1/0/24
[H3C-GigabitEthernet1/0/24]no shu
[H3C-GigabitEthernet1/0/24]no shutdown
[H3C-GigabitEthernet1/0/24]qui
[H3C-GigabitEthernet1/0/24]quit
[H3C]save
The current configuration will be written to the device. Are you sure? [Y/N]:y
Please input the file name(*.cfg)[flash:/startup.cfg]
(To leave the existing filename unchanged, press the enter key):y
The file name is invalid(does not end with .cfg).
[H3C]
[H3C]
//设置hybrid

[H3C]     int g1/0/1
[H3C-GigabitEthernet1/0/1]port lin
[H3C-GigabitEthernet1/0/1]port link-ty
[H3C-GigabitEthernet1/0/1]port link-type  hy
[H3C-GigabitEthernet1/0/1]port link-type  hybrid
[H3C-GigabitEthernet1/0/1]port hy
[H3C-GigabitEthernet1/0/1]port hybrid vlan 10 20 un
[H3C-GigabitEthernet1/0/1]port hybrid vlan 10 20 untagged
[H3C-GigabitEthernet1/0/1]qui
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g1/0/2
[H3C-GigabitEthernet1/0/2]port lin
[H3C-GigabitEthernet1/0/2]port link-hy
[H3C-GigabitEthernet1/0/2]port link-ty
[H3C-GigabitEthernet1/0/2]port link-type hy
[H3C-GigabitEthernet1/0/2]port link-type hybrid
[H3C-GigabitEthernet1/0/2]port hy
[H3C-GigabitEthernet1/0/2]port hybrid vlan 10 20 un
[H3C-GigabitEthernet1/0/2]port hybrid vlan 10 20 untagged
[H3C-GigabitEthernet1/0/2]qui
[H3C-GigabitEthernet1/0/2]quit
[H3C]

相关标签: H3C