將交換機(jī)的10號(hào)口配置為access口,
并且屬于vlan100
Ruijie>enable
Ruijie#config terminal
Ruijie(config)#interface gigabitEthernet 1/10
Ruijie(config-if-GigabitEthernet 1/10)#switchport access vlan 100
Ruijie(config-if-GigabitEthernet 1/10)#end
Ruijie#write
說(shuō)明:
交換機(jī)如果沒(méi)有配置,那么默認(rèn)所有端口都是access口。如果端口被配置為trunk口,需要改為access口,需要先在接口下敲switchport mode access,否則不生效,例如原來(lái)的trunk口配置改為access口,屬于access vlan 100,命令如下:
Ruijie#show run interface gigabitEthernet 1/10
>查看配置
Building configuration...
Current configuration : 56 bytes
interface GigabitEthernet 1/10
switchport mode trunk
Ruijie#configure terminal
Ruijie(config)#interface gigabitEthernet 1/10
Ruijie(config-if-GigabitEthernet 1/10)#switchport mode access
>設(shè)置為access模式
Ruijie(config-if-GigabitEthernet 1/10)#
switchport access vlan 100
Ruijie(config-if-GigabitEthernet 1/10)#end
查看配置
Ruijie(config-if-GigabitEthernet 1/10)#show vlan
VLAN Name Status Ports
--------------------------------
1 VLAN0001
STATIC Gi1/1, Gi1/2, Gi1/3, Gi1/4
Gi1/5, Gi1/6, Gi1/7, Gi1/8
Gi1/9, Gi1/13, Gi1/14, Gi1/15
Gi1/16, Gi1/17, Gi1/18, Gi1/19
Gi1/20, Gi1/21, Gi1/22, Gi1/23
Gi1/24, Gi1/25, Gi1/26, Gi1/27
Gi1/28, Gi1/29, Gi1/30, Gi1/31
Gi1/32, Gi1/33, Gi1/34, Gi1/35
Gi1/36, Gi1/37, Gi1/38, Gi1/39
Gi1/40, Gi1/41, Gi1/42, Gi1/43
Gi1/44, Te1/45, Te1/46, Te1/47
Te1/48, Gi4/1, Gi4/2, Gi4/3
100 VLAN0100
STATIC
Gi1/1,Gi1/10, Te1/45, Te1/46
Te1/47
2.交換機(jī)TRUNK口配置
將交換機(jī)的45號(hào)口配置為trunk口
Ruijie(config)#interface TenGigabitEthernet 1/45
Ruijie(config-if-TenGigabitEthernet 1/45)#switchport mode trunk
Ruijie(config-if-TenGigabitEthernet 1/45)#end
查看配置
Ruijie#show interfaces trunk
Interface Native VLAN VLAN lists
--------------------------------
TenGigabitEthernet 1/45 1
ALL------>native vlan是1,
ALL表示允許所有的vlan通過(guò)
TenGigabitEthernet 1/46 1 ALL
TenGigabitEthernet 1/47 1 ALL
3. TRUNK口VLAN裁剪(必配)
交換機(jī)的1號(hào)口配置為trunk口,并且只允許vlan 5、vlan 10、vlan20-30通過(guò),其余vlan不允許通過(guò)
Ruijie#configure terminal
Ruijie(config)#interface gigabitEthernet 1/1
Ruijie(config-if-GigabitEthernet 1/1)#switchport mode trunk
Ruijie(config-if-GigabitEthernet 1/1)#switchport trunk allowed vlan remove 1-4,6-9,11-19,31-4094 ------>交換機(jī)默認(rèn)允許所有本地已創(chuàng)建的vlan通過(guò),如果只需要配置只允許相應(yīng)vlan通過(guò),需要把不允許通過(guò)的vlan給裁剪掉
Ruijie(config-if-GigabitEthernet 1/1)#end
Ruijie#wr
審核編輯:劉清
-
交換機(jī)
+關(guān)注
關(guān)注
21文章
2645瀏覽量
99767 -
VLAN技術(shù)
+關(guān)注
關(guān)注
0文章
45瀏覽量
6399
原文標(biāo)題:怎么命令行劃VLAN
文章出處:【微信號(hào):通信弱電交流學(xué)習(xí),微信公眾號(hào):通信弱電交流學(xué)習(xí)】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論