1 , 設置交換機名稱
(config)#hostname hostname
2,設置log存放路徑
(config)#logging 10.7.68.68 //將log檔文件存在10.7.68.68
(config)#spanning-tree mode rapid-pvst // 設定 spanning-tree 的模式是 rapid-pvst
3,設置errdisable
(config)#errdisable recovery cause all //開啟errdiable 恢復的原因
(config)#errdisable recovery interval 300 //errdisable後300秒恢復
4,設置snmp-server
(config)#snmp-server community askeymis RO //設置簡單網絡管理協議字符串為只讀
5, 設置vtp
(config)#vtp domain askey // 設定VTP domain 名稱
(config)vtp mode transparent // 設定 VTP 模式為透明模式
Vlan
1,創建Vlan
(config)#vlan 180 //創建Vlan ID號為180
(config-vlan)#name askey //Vlan 名稱為askey
2,刪除Vlan
(config)#no vlan 180
#show vlan brief //查看交換機當前Vlan 號及Vlan 下有哪些端口
3,配置管理IP
(config)#int vlan 180
(config-if)#ip address 192.168.1.251 255.255.255.0 //設置管理IP地址
(config)#ip default-gateway 192.168.1.254 //設置默認路由,供其他網段訪問
4,將端口劃至Vlan 180
4.1單壹端口劃分
(config)#int f0/1 //進入端口f0/1
(config-if)#sw mode access //設置訪問模式
(cofnig-if)#sw ac vlan 180 //將其端口劃入Vlan 180
4.2多端口劃分
(config)#int range f0/1 _ 24 //端口範圍為1-24
(config-if-range)#sw mode access
(config-if-range)#sw ac vlan 180
端口配置
1,端口配置
(cofnig)#interface FastEthernet0/1
(config-if)#switchport access vlan 33 // 劃分VLAN
(config-if)# switchport mode access
(config-if)# switchport port-security maximum 2 //設定端口只允許接入2個PC
(config-if)# switchport port-security // 啟用端口安全
(config-if)# switchport port-security violation restrict // 發生違例 端口進errdisable,並記錄
(config-if)# storm-control broadcast level 0.80 //控制廣播包的突發百分比
(config-if)# storm-control action shutdown //暴風控制的違例時端口進入errdisable
(config-if)# storm-control action trap //產生snmp trap(抑制)消息來通告發生過量流量的情況
(config-if)# spanning-tree portfast // 配置接口為portfast模式
(config-if)# spanning-tree bpduguard enable // 啟用bpuguard 防護
(config-if)# spanning-tree guard root // 啟用根橋防護
設置時間與同步
1 , 開啟debug與log記錄時間的服務
(config)#Service timestamps debug datetime localtime //開啟debug記錄時顯示的時間
(config)#Service timestamps log datetime localtime //開啟log記錄時顯示的時間
2,設置時間與時區
(config)# Clock timezone TAIWAN 8 //設置時區
(config)# Clock set 12:16:50 nov 27 2008 //設置時間(月,日,年)
#Show clock //查看交換機當前的時間
3,設置ntp server 實現時間同步
(config)# ntp server 10.1.71.249 //設置交換機與ntp server 實現時間同步
#show ntp stauts //查看交換機是否同步
Clock is synchronized, stratum 3, reference is 10.1.71.249(同步)
nominal freq is 119.2092 Hz, actual freq is 119.2093 Hz, precision is 2**17
reference time is CCD89F21.ECA0C247 (12:22:57.924 TAIWAN Thu Nov 27 2008)
clock offset is 8.4785 msec, root delay is 399.51 msec
root dispersion is 937.29 msec, peer dispersion is 885.30 msec
Password
1,開啟明文密碼加密服務
(config)#service password-encryption //將明文密碼加密
2,設置控制臺密碼
(config)#line consloe 0 //進入控制臺
(config-line)#login //登錄
(config-line)#password cisco //設置密碼
3,設置enable密碼
(config)#enable password cisco
(config)#enable secret password cisco //給密碼加密碼 ,優先級高於enable password
4,設置Telnet 密碼
(config)#line vty 0 4 //進入vty模式
(config-line)#login
(config-line)#password cisco //設置密碼
(config-line)#exec-timeout 5 0 //telnet 5分鐘超時。