第一步给主机添加IP地址
第二步:设置交换机:
SW1:
undo terminal monitor 关闭弹窗
system-view 进入系统视图
[SW1]sysname SW1 重名为SW1
[SW1]user-interface console 0 进入设置时延
[SW1-ui-console0]idle-timeout 0 0 时延设置为0
[SW1]interface e0/0/1 进入e0/0/1号端口
[SW1-Ethernet0/0/1]port link-type access 端口模式为access
[SW1-Ethernet0/0/1]port default vlan 10 将这个端口放入vlan 10
[SW1-Ethernet0/0/1]quit 退出
[SW1]interface e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]quit
[SW1]interface g0/0/1 进入g0/0/1 端口
[SW1-GigabitEthernet0/0/1]port link-type trunk 端口模式为trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 允许vlan 10 20通过
save 保存
SW2:
undo terminal monitor
system-view
[SW2]sysname SW2
[SW2]user-interface console 0
[SW2-ui-console0]idle-timeout 0 0
[SW2]interface e0/0/1
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 10
[SW2-Ethernet0/0/2]quit
[SW2]interface e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 20
[SW2-Ethernet0/0/2]quit
[SW1]interface g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
save