ENSP---VLAN配置实验

目录

一、实验目标

二、实验拓扑

三、基本配置

四、创建VLAN

五、客户端配置IP地址

六、验证VLAN

七、配置Hybrid

八、配置文件


一、实验目标

  • 掌握VLAN的创建方法;
  • 掌握Trunk、Access链路的接口配置方法;
  • 掌握Hybird接口的配置方法;
  • 掌握将接口与VLAN相关联的配置方法。

二、实验拓扑

ENSP---VLAN配置实验_第1张图片

三、基本配置

在S1、S2上创建Eth-Trunk 1,并配置为静态LACP模式,然后将这两台交换机的两个接口分别加入Eth-Ttrunk 1:

S1:

[S1]int Eth-Trunk 1		
[S1-Eth-Trunk1]mode lacp
[S1-Eth-Trunk1]q
Apr  4 2022 15:25:33-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S1]int g0/0/1
[S1-GigabitEthernet0/0/1]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1-GigabitEthernet0/0/1]
Apr  4 2022 15:25:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 6, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S1-GigabitEthernet0/0/1]
[S1-GigabitEthernet0/0/1]q
[S1]int g0/0/4
[S1-GigabitEthernet0/0/4]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1-GigabitEthernet0/0/4]q
[S1]
Apr  4 2022 15:26:03-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 7, the ch
ange loop count is 0, and the maximum number of records is 4095.

[S1]

S2:

[S2]int Eth-Trunk 1	
[S2-Eth-Trunk1]mode lacp
[S2-Eth-Trunk1]
Apr  4 2022 15:26:33-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.q
[S2]int g0/0/1
[S2-GigabitEthernet0/0/1]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2-GigabitEthernet0/0/1]
Apr  4 2022 15:26:39-08:00 S2 %%01IFNET/4/IF_STATE(l)[0]:Interface Eth-Trunk1 ha
s turned into UP state.
Apr  4 2022 15:26:43-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 6, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S2-GigabitEthernet0/0/1]q
[S2]int g0/0/4
[S2-GigabitEthernet0/0/4]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2-GigabitEthernet0/0/4]q
[S2]
Apr  4 2022 15:27:03-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 7, the ch
ange loop count is 0, and the maximum number of records is 4095.

华为交换机端口默认为Hybrid模式,这里要配置Eth-Trunk接口类型为Trunk,并允许所有VLAN通过该端口:

S1:


[S1]int Eth-Trunk 1
[S1-Eth-Trunk1]port link-type trunk 
Apr  4 2022 15:33:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 8, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S1-Eth-Trunk1]port trunk allow-pass vlan all
[S1-Eth-Trunk1]
Apr  4 2022 15:34:03-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 9, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S1-Eth-Trunk1]

S2:

[S2]int Eth-Trunk 1
[S2-Eth-Trunk1]port link-type trunk 
[S2-Eth-Trunk1]
Apr  4 2022 15:34:23-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 8, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S2-Eth-Trunk1]port trunk allow-pass vlan all
[S2-Eth-Trunk1]
Apr  4 2022 15:34:43-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 9, the ch
ange loop count is 0, and the maximum number of records is 4095.

四、创建VLAN

本实验中,交换机S3、S4,路由器R1、R2作为客户端,在S1、S2上分别创建VLAN2、3、4,并使用两种不同的方式将端口加入VLAN中,将所有连接客户端的端口类型配置为Access:

将S1上端口G0/0/2、G0/0/3分别加入VLAN3、VALN4:

S1:

[S1]int g0/0/2	
[S1-GigabitEthernet0/0/2]port link-type access 
Apr  4 2022 15:46:43-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 12, the c
hange loop count is 0, and the maximum number of records is 4095.
[S1-GigabitEthernet0/0/2]int g0/0/3	
[S1-GigabitEthernet0/0/3]port link-type access 
[S1-GigabitEthernet0/0/3]q
[S1]vlan 2
[S1-vlan2]vlan 3
[S1-vlan3]port g0/0/2
[S1-vlan3]vlan 4
Apr  4 2022 15:48:13-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 18, the c
hange loop count is 0, and the maximum number of records is 4095.
[S1-vlan4]port g0/0/3
[S1-vlan4]q
[S1]
Apr  4 2022 15:48:23-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 19, the c
hange loop count is 0, and the maximum number of records is 4095.
[S1]

将S2上端口G0/0/2、G0/0/3分别加入VLAN2、VLAN4:

S2:

[S2]vlan batch 2 to 4
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2]
Apr  4 2022 15:52:43-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 12, the c
hange loop count is 0, and the maximum number of records is 4095.
[S2]int g0/0/2
[S2-GigabitEthernet0/0/2]port link-type access 
[S2-GigabitEthernet0/0/2]port default vlan 2
[S2-GigabitEthernet0/0/2]q
Apr  4 2022 15:54:13-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 13, the c
hange loop count is 0, and the maximum number of records is 4095
[S2]int g0/0/3
[S2-GigabitEthernet0/0/3]port link-type access 
[S2-GigabitEthernet0/0/3]port default vlan 4
[S2-GigabitEthernet0/0/3]q
[S2]
Apr  4 2022 15:55:03-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 14, the c
hange loop count is 0, and the maximum number of records is 4095.

查看S1、S2上VLAN配置,确认正确加入端口:

S1:

ENSP---VLAN配置实验_第2张图片

 S2:

ENSP---VLAN配置实验_第3张图片

五、客户端配置IP地址

分别为主机S3、S4、R1、R2配置IP地址,由于不能直接为交换机端口配置IP地址,所以这里在S3、S4的本地管理接口VLANIF 1接口配置IP地址:

S3:

[S3]int Vlanif 1
[S3-Vlanif1]ip address 192.168.12.1 24
[S3-Vlanif1]
Apr  4 2022 16:11:13-08:00 S3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Vlanif1 has entered the UP state.
[S3-Vlanif1]q
[S3]
Apr  4 2022 16:11:23-08:00 S3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.

R1:

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.12.2 24
[R1-GigabitEthernet0/0/0]
Apr  4 2022 16:12:28-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]

R2:

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.12.3 24
Apr  4 2022 16:13:09-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]

S4:

[S4]int Vlanif1
[S4-Vlanif1]IP address 192.168.12.4 24
[S4-Vlanif1]
Apr  4 2022 16:13:58-08:00 S4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Vlanif1 has entered the UP state.
[S4-Vlanif1]
Apr  4 2022 16:14:04-08:00 S4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.

六、验证VLAN

这里可以在R1上使用PING命令检测与R2的连通性,因为它们同属于VLAN4,所以只要配置成功,双方是可以通信的,而R1与其它两台主机S3、S4是不连通的,因为它们不属于同一VLAN,不能直接通信:

R1:
 

ENSP---VLAN配置实验_第4张图片 检测R1与R2之间的连通性

ENSP---VLAN配置实验_第5张图片 检测R1与S4之间的连通性

七、配置Hybrid

这里配置S1上的G0/0/3、S2上的G0/0/2、G0/0/3端口为Hybrid类型,可以为来自不同VLAN的流量打上或去除VALN标签,使得VLAN2、VALN4之间可以通信:

S1:

[S1]int g0/0/3	
[S1-GigabitEthernet0/0/3]undo port default vlan 
[S1-GigabitEthernet0/0/3]
Apr  4 2022 16:35:15-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 20, the c
hange loop count is 0, and the maximum number of records is 4095.
[S1-GigabitEthernet0/0/3]port link-type hybrid 
[S1-GigabitEthernet0/0/3]port hybrid untagged vlan 2 4	
[S1-GigabitEthernet0/0/3]port hybrid pvid  vlan 4
[S1-GigabitEthernet0/0/3]q
[S1]
Apr  4 2022 16:36:15-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 23, the c
hange loop count is 0, and the maximum number of records is 4095.

S2:

[S2]int g0/0/2
[S2-GigabitEthernet0/0/2]undo port default vlan 
Apr  4 2022 16:37:54-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 15, the c
hange loop count is 0, and the maximum number of records is 4095.
[S2-GigabitEthernet0/0/2]port link-type hybrid 
[S2-GigabitEthernet0/0/2]port hybrid untagged vlan 2 4
[S2-port-group-hybrid]port hybrid pvid vlan 2
[S2-port-group-hybrid]q
[S2]int g0/0/3
[S2-GigabitEthernet0/0/3]undo port default vlan  	
[S2-GigabitEthernet0/0/3]port link-type hybrid 
Apr  4 2022 16:40:04-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 20, the c
hange loop count is 0, and the maximum number of records is 4095.
[S2-GigabitEthernet0/0/3]port hybrid untagged vlan 2 4
Apr  4 2022 16:40:14-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 21, the c
hange loop count is 0, and the maximum number of records is 4095.h	
[S2-GigabitEthernet0/0/3]port hybrid pvid vlan 4
[S2-GigabitEthernet0/0/3]q
[S2]

测试R1与S4之间能否通信:

ENSP---VLAN配置实验_第6张图片 检测R1与S4之间的连通性

 

八、配置文件

S1:

[S1]display current-configuration 
#
sysname S1
#
vlan batch 2 to 4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 mode lacp-static
#
interface GigabitEthernet0/0/1
 eth-trunk 1
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 3
#
interface GigabitEthernet0/0/3
 port hybrid pvid vlan 4
 port hybrid untagged vlan 2 4
#
interface GigabitEthernet0/0/4
 eth-trunk 1
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
port-group g0
#
return
[S1] 

S2:

[S2]display current-configuration 
#
sysname S2
#
vlan batch 2 to 4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 mode lacp-static
#
interface GigabitEthernet0/0/1
 eth-trunk 1
#
interface GigabitEthernet0/0/2
 port hybrid untagged vlan 2 4
#
interface GigabitEthernet0/0/3
 port hybrid pvid vlan 4
 port hybrid untagged vlan 2 4
#
interface GigabitEthernet0/0/4
 eth-trunk 1
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
port-group hybrid
#
return

S3:

display current-configuration 
#
sysname S3
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
 ip address 192.168.12.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
 

S4:

display current-configuration 
#
sysname S4
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
 ip address 192.168.12.4 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return

R1:

display current-configuration 
[V200R003C00]
#
 sysname R1
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 192.168.12.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
 

R2:

display current-configuration 
[V200R003C00]
#
 sysname R2
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 192.168.12.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
 

你可能感兴趣的:(ENSP实验,数通,计算机网络,网络,tcp/ip)