实验拓扑图
实验拓扑.png
实验需求
按图示为PC配置IP地址
SW1和SW2上分别创建vlan10和vlan20,要求PC3和PC5属于vlan10,PC4和PV6属于vlan20
SW1和SW2相连的接口配置为trunk类型,允许vlan10和vlan20通过
测试效果,同一vlan的PC可以互通,不同vlan的PC无法互通
实验解法
1.PC配置IP地址命令
略
2.SW1和SW2上分别创建vlan10和vlan20
步骤一:
进入系统视图模式 system-view
更改交换机设备名称 sysname SW1
步骤二:
在SW1和SW2上设置创建vlan 10,vlan 20
[SW1]vlan 10
[SW1-vlan10]vlan 20
[SW1-vlan10]quit
步骤三:
查看已经设置好的vlan
[SW1]display vlan
[SW1]display vlan brief
3.SW1把g1/0/1接口加入vlan10,g1/0/2接口加入vlan20;SW2把g1/0/2接口加入vlan10,把g1/0/3接口加入vlan20
[SW1]vlan 10
[SW1-vlan10]port g1/0/1
[SW1-vlan10]vlan 20
[SW1-vlan20]port g1/0/2
4.SW1的g1/0/3接口,SW2的G1/0/1接口都配置为trunk,允许vlan10和vlan20通过
[SW1]interface g1/0/3
[SW1-GigabitEthernet1/0/3]port link-type trunk
[SW1-GigabitEthernet1/0/3]port trunk permit vlan 10 20
5.**测试结果,如下所示,PC3可以PING通PC5,但无法PING通PC4和PC6
<H3C>ping 192.16.1.3
Ping 192.16.1.3 (192.16.1.3): 56 data bytes, press CTRL_C to break
56 bytes from 192.16.1.3: icmp_seq=0 ttl=255 time=2.000 ms
56 bytes from 192.16.1.3: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 192.16.1.3: icmp_seq=2 ttl=255 time=2.000 ms
56 bytes from 192.16.1.3: icmp_seq=3 ttl=255 time=2.000 ms
56 bytes from 192.16.1.3: icmp_seq=4 ttl=255 time=2.000 ms
--- Ping statistics for 192.16.1.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
<H3C>ping 192.16.1.2
Ping 192.16.1.2 (192.16.1.2): 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 192.16.1.2 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
网友评论