【正文】
ddress OK? Method Status Protocol Ether0 Unassigned NO unset up Up Serial0 Unassigned NO unset up up ??? ??? ? ?? ? ? 然后,路由器就開始全局參數(shù)的設置: Configuring global parameters: 1. 設置路由器名: Enter host name [Router]: 2. 設置進入特權狀態(tài)的密文 (secret),此密文在設置以后不會以明文方式顯示: The enable secret is a oneway cryptographic secret used instead of the enable password when it exists. Enter enable secret: cisco 3. 設置進入特權狀態(tài)的密碼 (password),此密碼只在沒有密文時起作用,并且在設置以后會以明文方式顯示: 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. 設置虛擬終端訪問時的密碼: Enter virtual terminal password: cisco 5. 詢問是否要設置路由器支持的各種網(wǎng)絡協(xié)議: Configure SNMP Network Management? [yes]: Configure DEC? [no]: 4 Configure AppleTalk? [no]: Configure IPX? [no]: Configure IP? [yes]: Configure IGRP routing? [yes]: Configure RIP routing? [no]: ??? 6. 如果配置的是撥號訪問服務器,系統(tǒng)還會設置異步口的參數(shù): Configure Async lines? [yes]: 1) 設置線路的最高速度: Async line speed [9600]: 2) 是否使用硬件流控: Configure for HW flow control? [yes]: 3) 是否設置 modem: Configure for modems? [yes/no]: yes 4) 是否使用默認的 modem命令: Configure for default chat script? [yes]: 5) 是否設置異步口的 PPP參數(shù): Configure for Dialin 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) 是否設置異步口上的其它協(xié)議。 接下來,系統(tǒng)會對每個接口進行參數(shù)的設置。 1. Configuring interface Ether0: 1) 是否使用此接口: Is this interface in use? [yes]: 2) 是否設置此接口的 IP參數(shù): Configure IP on this interface? [yes]: 3) 設置接口的 IP地址: IP address for this interface: 4) 設置接口的 IP子網(wǎng)掩碼: Number of bits in sub field [0]: Class C work is , 0 sub bits。 mask is /24 在設置完所有接口的參數(shù)后,系統(tǒng)會把整個設置對話過程的結果顯示出來: The following configuration mand script was created: hostname Router enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1 enable password pass ???? 5 請注意在 enable secret 后面顯示的是亂碼,而 enable password 后面顯示的是設置的內容。 顯示結束后,系統(tǒng)會問是否使用這個設置: Use this configuration? [yes/no]: yes 如果回答 yes,系統(tǒng)就會把設置的結果存入路由器的 NVRAM中,然后結束設置對話過程,使路由器開始正常的工作。 四、常用命令 1. 幫助 在 IOS 操作中,無論任何狀態(tài)和位置,都可以鍵入“?”得到系統(tǒng)的幫助。 2. 改變命令狀態(tài) 任務 命令 進入特權命令狀態(tài) enable 退出特權命令狀態(tài) disable 進入設置對話狀態(tài) setup 進入全局設置狀態(tài) config terminal 退出全局設置狀態(tài) end 進入端口設置狀態(tài) interface type slot/number 進入子端口設置狀 態(tài) interface type [pointtopoint | multipoint] 進入線路設置狀態(tài) line type slot/number 進入路由設置狀態(tài) router protocol 退出局部設置狀態(tài) exit 3. 顯示命令 任務 命令 查看版本及引導信息 show version 查看運行設置 show runningconfig 查看開機設置 show startupconfig 顯示端口信息 show interface type slot/number 顯示路由信息 show ip router 4. 拷貝命令 用于 IOS 及 CONFIG 的備份和升級 6 5. 網(wǎng)絡命令 任務 命令 登錄遠程主機 tel hostname|IP address 網(wǎng)絡偵測 ping hostname|IP address 路由跟蹤 trace hostname|IP address 6. 基本設置命令 任務 命令 全局設置 config terminal 設置訪問用戶及密碼 username username password password 設置特權密碼 enable secret password 設置路由器名 hostname name 設置靜態(tài)路由 ip route destination submask nexthop 啟動 IP路由 ip routing 啟動 IPX路由 ipx routing 端口設置 interface type slot/number 設置 IP地址 ip address address submask 設置 IPX網(wǎng)絡 ipx work work 激活端口 no shutdown 物理線路設置 line type number 啟動登錄進程 login [local|tacacs server] 設置登錄密碼 password password 五、配置 IP 尋址 1. IP 地址分類 IP 地址分為網(wǎng)絡地址和主機地址二個部分, A 類地址前 8 位為網(wǎng)絡地址,后 24 位為主機地址, B類地址 16 位為網(wǎng)絡地址,后 16 位為主機地址, C 類地址前 24 位為網(wǎng)絡地址,后 8 位為主機地址,網(wǎng)絡地址范圍如下表所示: 種類 網(wǎng)絡地址 范圍 A 到 有效 和 保留 B 到 有效 和 保留 C 到 有效 和 保留 D 到 用于多點廣播 E 到 保留 用于廣播 2. 分配接口 IP 地址 7 任務 命令 接口設置 interface type slot/number 為接口設置 IP地址 ip address ipaddress mask 掩碼( mask)用于識別 IP 地址中的網(wǎng)絡地址位數(shù), IP 地址( ipaddress)和掩碼( mask)相與即得到網(wǎng)絡地址。 3. 使用可變長的子網(wǎng)掩碼 通過使用可變長的子網(wǎng)掩碼可以讓位于不同接口的同一網(wǎng)絡編號的網(wǎng)絡使用不同的掩碼,這樣可以節(jié)省 IP 地址,充分利用有效的 IP 地址空間。 如下圖所示: Router1 和 Router2 的 E0 端口均使用了 C 類地址 作為網(wǎng)絡地址, Router1 的 E0 的網(wǎng)絡地址為 ,掩碼為 , Router2 的 E0 的網(wǎng)絡地址為 ,掩碼為 ,這樣就將一個 C 類網(wǎng)絡地址分配給了二個網(wǎng),既劃分了二個子網(wǎng),起到了節(jié)約地址的作用。 4. 使用網(wǎng)絡地址翻譯( NAT) NAT( Network Address Translation)起到將內部私有地址翻譯成外部合法的全局地址的功能,它使得不具有合法 IP 地址的用戶可以通過 NAT 訪問到外部 Inter. 當建立內部網(wǎng)的時候 ,建議使用以下地址組用于主機 ,這些地址是由 Network Working Group(RFC 1918)保留用于私有網(wǎng)絡地址分配的 . ? Class A: to ? Class B: to ? Class C: to 命令描述如下: 任務 命令 定義一個標準訪問列表 accesslist accesslistnumber permit source [sourcewildcard] 定義一個全局地址池 ip nat pool name startip endip {mask mask | prefixlength prefixlength} [type rotary] 建立動態(tài)地址翻譯 ip nat inside source {list {accesslistnumber | name} pool name [overload] | static localip globalip} 指定內部和外部 端口 ip nat {inside | outside} 如下圖所示,路由器的 Ether 0 端口為 inside 端口,即此端口連接內部網(wǎng)絡,并且此端口所連接的網(wǎng)絡應該被翻譯, Serial 0 端口為 outside 端口,其擁有合法 IP 地址(由 NIC 或服務提供商所分配的合法的 IP 地址) ,來自網(wǎng)絡 ,經(jīng)由 Serial 0 口訪問 Inter。 命令 ip nat inside source list 2 pool c2501 overload 中的參數(shù) overload,將允許多個內部地 8 址使用相同的全局地址(一個合法 IP地址,它是 由 NIC 或服務提供商所分配的地址 )。命令 ip nat pool c2501 mask 定義了全局地址的范圍。 設置如下: ip nat pool c2501 mask interface Ether 0 ip address ip nat inside ! interface Serial 0 ip address ip nat outside ! ip route Serial 0 accesslist 2 permit ! Dynamic NAT ! ip nat inside source list 2 pool c2501 overload line console 0 exectimeout 0 0 ! line vty 0 4 end 六、配置靜態(tài)路由 通過配置靜態(tài)路由,用戶可以人為地指定對某一網(wǎng)絡訪問時所要經(jīng)過的路徑 ,在網(wǎng)絡結構比較簡單,且一般到達某一網(wǎng)絡所經(jīng)過的路徑唯一的情況下采用靜態(tài)路由。 任務 命令 建立靜態(tài)路由 ip route prefix mask {address | interface} [distance] [tag tag] [permanent] 9 Prefix :所要到達的目的網(wǎng)絡 mask :子網(wǎng)掩碼 address :下一個跳的 IP地址,即相鄰路由器的端口地址。 interface :本地網(wǎng)絡接口 distance :管理距離(可選) tag tag