华为ENSP vlan配置实验
实验一 实现同一个vlan下面的不同网段的ping通
网络拓扑图如下:
①配置两个pc端的ip地址和子网掩码、网关
②对交换机进行vlan的配置
1)创建vlan2
[SA]vlan 2[SA-vlan2]quit
2)将两个网段的网关都加入vlan2 中:注意!!要在增加第二个vlan地址的时候要在后面加上sub
[SA]int vlanif 2[SA-Vlanif2]ip add10.10.1.254 24[SA-Vlanif2]ip add12.10.0.254 24 sub
[SA-Vlanif2]display this
#
interface Vlanif2
ip address 10.10.1.254 255.255.255.0
ip address 12.10.0.254 255.255.255.0 sub
#return
3)将交换机与pc的连接接口都设置成access接口:
[SA]int g0/0/1
[SA-GigabitEthernet0/0/1]port link-type access
[SA-GigabitEthernet0/0/1]port default vlan 2[SA-GigabitEthernet0/0/1]int g0/0/2
[SA-GigabitEthernet0/0/2]port link-type access
[SA-GigabitEthernet0/0/2]port default vlan 2
4)查看路由表
[SA]display ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations :6 Routes :6
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.0.0/24 Direct 00 D 10.10.0.254 Vlanif2
10.10.0.254/32 Direct 00 D 127.0.0.1 Vlanif2
12.10.0.0/24 Direct 00 D 12.10.0.254 Vlanif2
12.10.0.254/32 Direct 00 D 127.0.0.1 Vlanif2
127.0.0.0/8 Direct 00 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 00 D 127.0.0.1 InLoopBack0
⑤测试是否能ping通
pc1与pc2互相ping通:
实验二:配置二层交换机使得两个网段相通(相同vlan):基于GVRP
(trunk、access接口的配置)
网络拓扑图如下:
配置两个pc的ip地址、子网掩码、网关:
在SW1上创建vlan 10
[Sw1]vlan 10[Sw1-vlan10]quit
[Sw1]int vlanif 10[Sw1-Vlanif10]ip add192.168.1.254 24[Sw1-Vlanif10]quit
开启全局GVRP
[SW1]gvrp
配置SW1的sccess接口连接PC1、配置SW1的trunk接口连接到SW2并开启trunk端口的GVRP
[Sw1]int g0/0/1
[Sw1-GigabitEthernet0/0/1]port link-type access
[Sw1-GigabitEthernet0/0/1]port default vlan 10[Sw1-GigabitEthernet0/0/1]int g0/0/2
[Sw1-GigabitEthernet0/0/2]port link-type trunk
[Sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10[Sw1-GigabitEthernet0/0/2]gvrp
查看配置:
[Sw1-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10
gvrp
#return[Sw1-GigabitEthernet0/0/2]int g0/0/1
[Sw1-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10#return
在SW2上创建vlan 10
[SW2]vlan 10[SW2-vlan20]quit
[SW2]int vlanif 10[SW2-Vlanif20]ip add192.168.2.254 24[SW2-Vlanif20]quit
开启全局GVRP
[SW2]gvrp
配置SW2的sccess接口连接PC2、配置SW2的trunk接口连接到SW1并开启trunk端口的GVRP
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 10[SW2-GigabitEthernet0/0/1]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10[SW2-GigabitEthernet0/0/2]gvrp
查看配置:
[SW2-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
gvrp
#return[SW2-GigabitEthernet0/0/2]int g0/0/1
[SW2-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10#return
检测是否能够ping:
SW1ping通SW2和Pc2:
SW2ping通SW1和Pc1:
PC1与PC2:
版权归原作者 也也来噜 所有, 如有侵权,请联系我们删除。