一、模式
• 用戶模式(>):
• 特權模式(#):
• 全局配置模式(config#):
• 接口配置模式(config-if#):
• 線路模式(#config-line):
二、基本IOS命令結構
•每個IOS 命令都具有特定的格式或語法,並在相應的提示符下執行。
•常規命令語法為命令后接相應的關鍵字和參數。
•某些命令包含一個關鍵字和參數子集,此子集可提供額外功能。
三、相關配置
1、 進入用戶模式,命令提示符是>號(正常登陸設備CLI(command-line interface,命令行界面)后的第一個配置模式,主要用於查看統計信息,可用的命令比較少,查看部分簡單配置,不可修改,配置)
Switch>
Switch>?
Exec commands:
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resume Resume an active network connection
show Show running system information
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
2、 輸入enable進入特權模式,命令提示符是#號(從用戶模式進入,可用命令比較多,查看所有配置,部分修改(保存,恢復出廠等))
Switch>enable
Switch#
Switch#?
Exec commands:
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
setup Run the SETUP command facility
show Show running system information
--More--
3、 輸入disable從特權模式退到用戶模式
Switch#disable
Switch>
4、 輸入configure terminal進入全局配置模式(需要從特權模式進入,在全局模式下執行命令將影響整個設備,大配置操作都在這個模式下或從這個模式進入其他模式)
Switch#configure terminal
Switch(config)#
5、輸入exit從全局配置模式退到特權模式
Switch(config)#exit
Switch#
6、在全局配置模式下可以設置特權密碼(進入特權模式的密碼,用於限制人員訪問特權執行模式),輸入enable password
Switch(config)#enable password 1234 #密碼為1234
Switch>enable
Password: #再從用戶模式進入特權模式提示輸入密碼
7、進入某個接口配置模式
Switch(config)#interface vlan 100
Switch(config-if)#
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#
8、現在開始配置vlan 100 的管理ip 和子網掩碼
Switch(config-if)#ip address 192.168.100.100 255.255.255.0
9、配置一條線路(實際線路或虛擬線路,每個連接這個設備的用戶都要占用一個線路例Console、AUX 或VTY等連接方式,這里VTY(Virtual Type Terminal) 是虛擬終端的意思)
Switch(config)#line vty 0 4
line vty 0 4表示設置0到4號5個線路為遠程登錄,設置為0 3,0 2,0 1完全是可以的,0 4表示最多可以同時5個線路連接,默認0線路被Console占用)
Switch(config-line)#
10、在全局配置模式下可以設置Console密碼(用於限制人員通過控制台(Console)連接訪問設備)
Switch(config)#line console 0 #配置console線路
Switch(config-line)#password 1234 #密碼為1234
Switch(config-line)#login #登錄啟用密碼檢查
11、在全局配置模式下可以設置VTY線路登錄密碼(用於限制人員通過VTY接訪問設備)
Switch(config)#line vty 0 10 #通過VTY線路同時連接的最大用戶是10
Switch(config-line)#password 12345 #VTY線路登錄密碼12345
Switch(config-line)#login #登錄啟用密碼檢查