标签归档:交换机

eNSP 交换机的access/trunk配置 学习笔记 2023-10-6

交换机设备的Access/Trunk配置,不同VLAN内主机,可以互相访问

配置SW1

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]

[sw1]vlan 10 
[sw1-vlan10]desc To_IT_Guys
[sw1-vlan10]quit
[sw1]

[sw1]vlan 20
[sw1-vlan20]desc To_Finance_Guys
[sw1-vlan20]quit
[sw1]

[sw1]int g0/0/2	
[sw1-GigabitEthernet0/0/2]port link-type access 	
[sw1-GigabitEthernet0/0/2]port default vlan 10
[sw1-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 10
#
return
[sw1-GigabitEthernet0/0/2]quit
[sw1]



[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access 
[sw1-GigabitEthernet0/0/3]port default vlan 20
[sw1-GigabitEthernet0/0/3]q
[sw1]	
[sw1]dis current-configuration int GigabitEthernet 0/0/3
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 20
#
return
[sw1]


[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk 
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[sw1-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
return
[sw1-GigabitEthernet0/0/1]quit
[sw1]

配置SW2

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2
[sw2]


[sw2]vlan 10 
[sw2-vlan10]desc To_IT_Guys
[sw2-vlan10]quit
[sw2]

[sw2]vlan 20
[sw2-vlan20]desc To_Finance_Guys
[sw2-vlan20]quit
[sw2]

[sw2]int g0/0/2	
[sw2-GigabitEthernet0/0/2]port link-type access 	
[sw2-GigabitEthernet0/0/2]port default vlan 10
[sw2-GigabitEthernet0/0/2]q
[sw2]


[sw2]
[sw2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access 
[sw2-GigabitEthernet0/0/3]port default vlan 20
[sw2-GigabitEthernet0/0/3]quit
[sw2]


[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk 	
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[sw2-GigabitEthernet0/0/1]quit
[sw2]

配置PC1,VLAN 10

配置PC2 ,VLAN 20

配置PC3,VLAN 10

配置PC4,VLAN 20

验证

1、PC1、PC3之间可以互相ping通

2、PC2、PC4之间可以互相ping通

3、PC1跟 PC2/4 无法ping通