科技生活動態:cisco交換機配置vlan方法

導讀跟大家講解下有關cisco交換機配置vlan方法,相信小伙伴們對這個話題應該也很關注吧,現在就為小伙伴們說說cisco交換機配置vlan方法,小編也

跟大家講解下有關cisco交換機配置vlan方法,相信小伙伴們對這個話題應該也很關注吧,現在就為小伙伴們說說cisco交換機配置vlan方法,小編也收集到了有關cisco交換機配置vlan方法的相關資料,希望大家看到了會喜歡。

Cisco IOS中有兩種方式創建vlan,在全局模式下使用vlan vlanid命令,如switch(config)#vlan 10; 在vlan database 下創建vlan ,如 switch(vlan)#vlan 20;

交換機配置:

復制代碼 代碼如下:

Switch>enable Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z Switch(config)#vlan 10 Switch(config-vlan)#name Math Switch(config-vlan)#exit Switch(config)#exit Switch# %SYS-5-CONFIG_I: Configured from console by console Switch#vlan database % Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode. Switch(vlan)#vlan 20 name Chinese VLAN 20 added: Name: Chinese Switch(vlan)#vlan 30 name Other VLAN 30 added: Name: Other Switch(vlan)#exit APPLY completed. Exiting.... Switch#configure terminal Enter configuration commands, one per line.End with CNTL/Z. Switch(config)#interface fastEthernet 0/1 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 10 Switch(config-if)#exit Switch(config)#interface fastEthernet 0/2 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 10 Switch(config-if)#exit Switch(config)#interface range fastEthernet 0/3-6 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 20 Switch(config-if-range)#exit Switch(config)#interface range fastEthernet 0/7-9 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 30 Switch(config-if-range)#exit Switch(config)#exit Switch# %SYS-5-CONFIG_I: Configured from console by console Switch#show vlan VLAN Name StatusPorts ---- -------------------------------- --------- ------------------------------- 1defaultactiveFa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/15, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24 10 Math activeFa0/1, Fa0/2 20 ChineseactiveFa0/3, Fa0/4, Fa0/5, Fa0/6 30 OtheractiveFa0/7, Fa0/8, Fa0/9 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-defaultact/unsup 1005 trnet-defaultact/unsup VLAN TypeSAID MTU Parent RingNo BridgeNo StpBrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1enet100001 1500-----00 10 enet100010 1500-----00 20 enet100020 1500-----00 30 enet100030 1500-----00 1002 fddi101002 1500-----00 1003 tr101003 1500-----00 1004 fdnet 101004 1500---ieee -00 1005 trnet 101005 1500---ibm-00 Remote SPAN VLANs ------------------------------------------------------------------------------ Primary Secondary TypePorts ------- --------- ----------------- ------------------------------------------ Switch# //為VLAN配置ip地址(就是默認網關) Switch(config)#interface vlan 10 Switch(config-if)# %LINK-5-CHANGED: Interface Vlan10, changed state to up Switch(config-if)#ip address 192.168.1.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#interface vlan 20 Switch(config-if)# %LINK-5-CHANGED: Interface Vlan20, changed state to up Switch(config-if)#ip address 192.168.2.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#interface vlan 30 Switch(config-if)# %LINK-5-CHANGED: Interface Vlan30, changed state to up Switch(config-if)#ip address 192.168.3.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit

PC設置:

互ping截圖:

來源:卡飯網

免責聲明:本文由用戶上傳,如有侵權請聯系刪除!