CISCO技術(shù)集合(一)

字號:


    一、命令狀態(tài)
    1. router>
    路由器處于用戶命令狀態(tài),這時用戶可以看路由器的連接狀態(tài),訪問其它網(wǎng)絡(luò)和主機,但不能看到和更改路由器的設(shè)置內(nèi)容。
    2. router#
    在router>提示符下鍵入enable,路由器進入特權(quán)命令狀態(tài)router#,這時不但可以執(zhí)行所有的用戶命令,還可以看到和更改路由器的設(shè)置內(nèi)容。
    3. router(config)#
    在router#提示符下鍵入configure terminal,出現(xiàn)提示符router(config)#,此時路由器處于全局設(shè)置狀態(tài),這時可以設(shè)置路由器的全局參數(shù)。
    4. router(config-if)#; router(config-line)#; router(config-router)#;…
    路由器處于局部設(shè)置狀態(tài),這時可以設(shè)置路由器某個局部的參數(shù)。
    5. >
    路由器處于RXBOOT狀態(tài),在開機后60秒內(nèi)按ctrl-break可進入此狀態(tài),這時路由器不能完成正常的功能,只能進行軟件升級和手工引導(dǎo)。
    6. 設(shè)置對話狀態(tài)
    這是一臺新路由器開機時自動進入的狀態(tài),在特權(quán)命令狀態(tài)使用SETUP命令也可進入此狀態(tài),這時可通過對話方式對路由器進行設(shè)置。
    二、設(shè)置對話過程
    1. 顯示提示信息
    2. 全局參數(shù)的設(shè)置
    3. 接口參數(shù)的設(shè)置
    4. 顯示結(jié)果
    利用設(shè)置對話過程可以避免手工輸入命令的煩瑣,但它還不能完全代替手工設(shè)置,一些特殊的設(shè)置還必須通過手工輸入的方式完成。
    進入設(shè)置對話過程后,路由器首先會顯示一些提示信息:
    --- System Configuration Dialog ---
    At any point you may enter a question mark ? for help.
    Use ctrl-c to abort configuration dialog at any prompt.
    Default settings are in square brackets [].
    這是告訴你在設(shè)置對話過程中的任何地方都可以鍵入“?”得到系統(tǒng)的幫助,按ctrl-c可以退出設(shè)置過程,缺省設(shè)置將顯示在‘[]’中。然后路由器會問是否進入設(shè)置對話:
    Would you like to enter the initial configuration dialog? [yes]:
    如果按y或回車,路由器就會進入設(shè)置對話過程。首先你可以看到各端口當(dāng)前的狀況:
    First, would you like to see the current interface summary? [yes]:
    Any interface listed with OK? value "NO" does not have a valid configuration
    Interface IP-Address OK? Method Status Protocol
    Ethernet0 unassigned NO unset up up
    Serial0 unassigned NO unset up up
    ……… ……… … …… … …
    然后,路由器就開始全局參數(shù)的設(shè)置:
    Configuring global parameters:
    1.設(shè)置路由器名:
    Enter host name [Router]:
    2.設(shè)置進入特權(quán)狀態(tài)的密文(secret),此密文在設(shè)置以后不會以明文方式顯示:
    The enable secret is a one-way cryptographic secret used instead of the enable password when it exists. Enter enable secret: cisco
    3.設(shè)置進入特權(quán)狀態(tài)的密碼(password),此密碼只在沒有密文時起作用,并且在設(shè)置以后會以明文方式顯示:
    The enable password is used when there is no enable secret and when using older software and some boot images. Enter enable password: pass
    4.設(shè)置虛擬終端訪問時的密碼:
    Enter virtual terminal password: cisco
    5.詢問是否要設(shè)置路由器支持的各種網(wǎng)絡(luò)協(xié)議:
    Configure SNMP Network Management? [yes]:
    Configure DECnet? [no]:
    Configure AppleTalk? [no]:
    Configure IPX? [no]:
    Configure IP? [yes]:
    Configure IGRP routing? [yes]:
    Configure RIP routing? [no]:
    ………
    6.如果配置的是撥號訪問服務(wù)器,系統(tǒng)還會設(shè)置異步口的參數(shù):
    Configure Async lines? [yes]:
    1) 設(shè)置線路的速度:
    Async line speed [9600]:
    2) 是否使用硬件流控:
    Configure for HW flow control? [yes]:
    3) 是否設(shè)置modem:
    Configure for modems? [yes/no]: yes
    4) 是否使用默認的modem命令:
    Configure for default chat script? [yes]:
    5) 是否設(shè)置異步口的PPP參數(shù):
    Configure for Dial-in IP SLIP/PPP access? [no]: yes
    6) 是否使用動態(tài)IP地址:
    Configure for Dynamic IP addresses? [yes]:
    7) 是否使用缺省IP地址:
    Configure Default IP addresses? [no]: yes
    8) 是否使用TCP頭壓縮:
    Configure for TCP Header Compression? [yes]:
    9) 是否在異步口上使用路由表更新:
    Configure for routing updates on async links? [no]: y
    10) 是否設(shè)置異步口上的其它協(xié)議。
    接下來,系統(tǒng)會對每個接口進行參數(shù)的設(shè)置。
    1.Configuring interface Ethernet0:
    1) 是否使用此接口:
    Is this interface in use? [yes]:
    2) 是否設(shè)置此接口的IP參數(shù):
    Configure IP on this interface? [yes]:
    3) 設(shè)置接口的IP地址:
    IP address for this interface: 192.168.162.2
    4) 設(shè)置接口的IP子網(wǎng)掩碼:
    Number of bits in subnet field [0]:
    Class C network is 192.168.162.0, 0 subnet bits; mask is /24
    在設(shè)置完所有接口的參數(shù)后,系統(tǒng)會把整個設(shè)置對話過程的結(jié)果顯示出來:
    The following configuration command script was created:
    hostname Router
    enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1
    enable password pass
    …………
    請注意在enable secret后面顯示的是亂碼,而enable password后面顯示的是設(shè)置的內(nèi)容。
    顯示結(jié)束后,系統(tǒng)會問是否使用這個設(shè)置:
    Use this configuration? [yes/no]: yes
    如果回答yes,系統(tǒng)就會把設(shè)置的結(jié)果存入路由器的NVRAM中,然后結(jié)束設(shè)置對話過程,使路由器開始正常的工作。
    三、常用命令
    1. 幫助
    在IOS操作中,無論任何狀態(tài)和位置,都可以鍵入“?”得到系統(tǒng)的幫助。
    2. 改變命令狀態(tài)
    任務(wù)             命令
    進入特權(quán)命令狀態(tài)         enable
    退出特權(quán)命令狀態(tài)         disable
    進入設(shè)置對話狀態(tài)         setup
    進入全局設(shè)置狀態(tài)       config terminal
    退出全局設(shè)置狀態(tài)         end
    進入端口設(shè)置狀態(tài)      interface type slot/number
    進入子端口設(shè)置狀態(tài)  interface type number.subinterface [point-to-point |
            multipoint]
    進入線路設(shè)置狀態(tài)       line type slot/number
    進入路由設(shè)置狀態(tài)        router protocol
    退出局部設(shè)置狀態(tài)          exit
    3. 顯示命令
     任務(wù)           命令
    查看版本及引導(dǎo)信息    show version
    查看運行設(shè)置       show running-config
    查看開機設(shè)置       show startup-config
    顯示端口信息       show interface type slot/number
    顯示路由信息       show ip router
    4. 拷貝命令
    用于IOS及CONFIG的備份和升級
    5. 網(wǎng)絡(luò)命令
    任務(wù)           命令
    登錄遠程主機    telnet hostname|IP address
    網(wǎng)絡(luò)偵測      ping hostname|IP address
    路由跟蹤      trace hostname|IP address
    6. 基本設(shè)置命令
    任務(wù)               命令
    全局設(shè)置        config terminal
    設(shè)置訪問用戶及密碼   username username password password
    設(shè)置特權(quán)密碼      enable secret password
    設(shè)置路由器名      hostname name
    設(shè)置靜態(tài)路由      ip route destination subnet-mask next-hop
    啟動IP路由       ip routing
    啟動IPX路由       ipx routing
    端口設(shè)置        interface type slot/number
    設(shè)置IP地址       ip address address subnet-mask
    設(shè)置IPX網(wǎng)絡(luò)       ipx network network
    激活端口        no shutdown
    物理線路設(shè)置      line type number
    啟動登錄進程      login [local|tacacs server]
    設(shè)置登錄密碼      password password
    四、配置IP尋址
    1. IP地址分類
    IP地址分為網(wǎng)絡(luò)地址和主機地址二個部分,A類地址前8位為網(wǎng)絡(luò)地址,后24位為主機地址,B類地址16位為網(wǎng)絡(luò)地址,后16位為主機地址,C類地址前24位為網(wǎng)絡(luò)地址,后8位為主機地址,網(wǎng)絡(luò)地址范圍如下表所示:
    種類          網(wǎng)絡(luò)地址范圍
    A    1.0.0.0 到126.0.0.0有效 0.0.0.0 和127.0.0.0保留
    B    128.1.0.0到191.254.0.0有效 128.0.0.0和191.255.0.0保留
    C    192.0.1.0 到223.255.254.0有效 192.0.0.0和223.255.255.0保留
    D    224.0.0.0到239.255.255.255用于多點廣播
    E    240.0.0.0到255.255.255.254保留 255.255.255.255用于廣播
    2. 分配接口IP地址
    任務(wù)            命令
    接口設(shè)置       interface type slot/number
    為接口設(shè)置IP地址   ip address ip-address mask
    掩碼(mask)用于識別IP地址中的網(wǎng)絡(luò)地址位數(shù),IP地址(ip-address)和掩碼(mask)相與即得到網(wǎng)絡(luò)地址。
    3. 使用可變長的子網(wǎng)掩碼
    通過使用可變長的子網(wǎng)掩碼可以讓位于不同接口的同一網(wǎng)絡(luò)編號的網(wǎng)絡(luò)使用不同的掩碼,這樣可以節(jié)省IP地址,充分利用有效的IP地址空間。
    4. 使用網(wǎng)絡(luò)地址翻譯(NAT)
    NAT(Network Address Translation)起到將內(nèi)部私有地址翻譯成外部合法的全局地址的功能,它使得不具有合法IP地址的用戶可以通過NAT訪問到外部Internet. 當(dāng)建立內(nèi)部網(wǎng)的時候,建議使用以下地址組用于主機,這些地址是由Network Working Group(RFC 1918)保留用于私有網(wǎng)絡(luò)地址分配的.
    l Class A:10.1.1.1 to 10.254.254.254
    l Class B:172.16.1.1 to 172.31.254.254
    l Class C:192.168.1.1 to 192.168.254.254
    命令描述如下:
     任務(wù)             命令
    定義一個標準訪問列表    access-list access-list-number permit source
               [source-wildcard]
    定義一個全局地址池     ip nat pool name start-ip end-ip {netmask
               netmask | prefix-length prefix-length} [type
               rotary]
    建立動態(tài)地址翻譯      ip nat inside source {list {access-list-number |
               name} pool name [overload] | static local-ip
               global-ip}
    指定內(nèi)部和外部端口     ip nat {inside | outside}