Cisco 2950 Switch交換機基本設定指令
switch>
switch>enable
switch#
switch#vlan database(進入vlan維護模式)
switch(vlan)#vlan 2 name vlan2(給vlan 2命名為vlan2)
switch(vlan)#vlan 4 name vlan4(給vlan 4命名為vlan4)
switch(vlan)#exit(這裡要注意一下,要打入exit退出才有效,不能用ctrl+z或end直接退出,因為這麼不能使配置生效!)
switch#show vlan(查看vlan的配置,預設有vlan1)
switch#configure terminal(進入全域配置模式)
switch(config)#interface f0/1(進入fastethernet0/1介面配置模式)
switch(config-if)#switchport mode access(這步可以省略)
switch(config-if)#switchport access vlan 2(把該介面劃分到vlan2,記得vlan2之間有空格)
switch(config-if)#no shutdown(啟動埠)
switch(config-if)#exit
switch(config)#interface f0/2
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 4
switch(config-if)#no shutdown
switch(config-if)#exit
switch(config)#interface f0/3
switch(config-if)#switchport mode trunk(設置此口為中繼模式)
switch(config-if)#no shutdown
witch(config-if)#exit(這裡可以直接用ctrl+z或end直接退出到特權模式)
二.在路由器Cisco2611上的配置(!!!單臂路由!!!)
router#configure terminal
router(config)#interface f0/0.1(進入子介面模式)
router(config-subif)#encapsulation dot1q 2(設置封裝類型為dot1q,它是思科特有的。此外還有isl封裝,要看該設備支不支援。數字2是vlan號)
router(config-subif)#ip address 192.168.1.1 255.255.255.0
router(config-subif)#exit
router(config)#interface f0/0.2
router(config-subif)#encapsulation dot1q 4
router(config-subif)#ip address 192.168.3.1 255.255.255.0
router(config-subif)#exit
router(config)#interface f0/0
router(config-if)#no shutdown
router(config-if)#^z
router#show running-config
router#copy running-config startup-config
三.給PC1,PC2設置好IP位址,然後用ping命名令測試!
--------------------------------------------------------------------------------------------------------
1、配置IP位址
交換機要能夠被網管,必須給它標識一個管理IP位址,預設情況下CISCO交換機的VLAN 1為管理VLAN,為該VLAN配上IP 位址,交換機就可以被網管了。命令如下:
a、進入全域模式: Switch#configure terminal
b、進入VLAN 1介面模式:Switch(config)#interface vlan 1
c、配置管理IP位址:Switch(config-if) # ip address [A.B.C.D] [mask]
如果當前VLAN 不是管理VLAN ,只需要將上面第b處命令的vlan的號碼換成管理VLAN的號碼即可。
2、打開SNMP協議
a、進入全域模式: Switch#configure terminal
b、配置唯讀的Community,產品預設的唯讀Community名為public
Switch(config)#snmp-server community public ro
c、配置可寫的Community,產品預設的可寫Community名為private
Switch(config)#snmp-server community private rw
3、更改SNMP的Community密碼
a、將設備分組,並使能支持的各種SNMP版本
Switch(config)#snmp-server group qycx123 v1
Switch(config)#snmp-server group qycx 123 v2c
Switch(config)#snmp-server group qycx123 v3 noauth
b、分別配置唯讀和可寫community 如:
Switch(config)#snmp-server community qycx123 ro
Switch(config)#snmp-server community qycx123 rw
4、保存交換機配置
Switch#copy run start
常用命令
1、設置交換機密碼
a、更改遠端TELNNET密碼
Switch#configure terminal
Switch(config)#line vty 0 4
Switch(config-line)#password qycx123
Switch(config-line)#login
Switch(config-line)#exit
b、更改進入全域配置模式時的密碼
Switch#configure terminal
Switch(config)#enable secret qycx123
2、創建並劃分VLAN
a、創建VLAN
Switch#vlan database
Switch(vlan)#vlan 99 name office
(創建vlan 99 並命名為office)
b、將埠劃分至vlan
Switch(config)#interface fastEthernet 0/8
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 99
(將8號快速乙太口劃分至vlan 99)
3、常用調試命令
a、顯示所有配置命令:Switch#show run
b、顯示所有介面狀態:Switch#show ip int brief
c、顯示所有VLAN的資訊:Switch#show vlan brief