Switch>enable //進入特權模式 Switch#configure terminal //進入配置模式 Switch(config)#hostname S2960 //修改主機名稱 S2960(config)#no ip domain-lookup //關閉域名查找功能 S2960(config)#line console 0 //配置console口 S2960(config-line)#logging synchronous //開啟日志同步 S2960(config-line)#exec-timeout 0 0 //配置超時時間為0 S2960(config-line)#password 123456 //配置console口密碼(超級終端) S2960(config-line)#login //開啟登錄密碼 S2960(config)#enable secret 123456 //配置特權密碼 S2960(config)#line vty 0 4 //允許虛擬終端0到4即5個用戶同時telnet這台設備 S2960(config-line)#password 123456 //telnet登錄的密碼 S2960(config-line)#login //開啟遠程登錄 S2960(config-line)#logging synchronous //開啟日志同步 S2960(config-line)#exec-timeout 5 30 //配置控制台EXEC會話超時時間為5分30秒,防止用戶忘記注銷或離開
S2960(config)#service password-encryption //打開加密服務,show run的時候看到的密碼加密。
S2960(config)#username admin password 123456 //設置全局的用戶名和密碼。
S2960(config)#banner motd #this is cisco 2960# //配置遠程登錄提示信息 S2960(config)#interface vlan 1 //配置默認vlan S2960(config-if)#ip address 192.168.1.2 255.255.255.0 //配置管理IP地址 S2960(config-if)#no shutdown //啟用端口 S2960(config)#vlan 100 //增加新的vlan 100 S2960(config-vlan)#name IT //設置Vlan的名稱為IT S2960(config)#interface fa0/2 //進入2號端口 S2960(config-if)#switchport mode access //將端口配置為access模式 S2960(config-if)#switchport access vlan 100 //將2號端口划分到vlan 100中
S2960#show vlan brief //顯示vlan信息
S2960(config)#interface fastEthernet 0/1 //進入1號端口
S2960(config-if)#description SL //配置描述信息
S2960(config)#interface f 0/24 //進入24端口
S2960(config-if)#switchport mode trunk //將端口配置為trunk模式