【正文】
addresses? [no]: yes 8) 是否使用 TCP 頭壓縮: Cisco 路由器配置手冊 5/61 Configure for TCP Header Compression? [yes]: 9) 是否在異步口上使用路由表更新: Configure for routing updates on async links? [no]: y 10) 是否設(shè)置異步口上的其它協(xié)議。 1. Configuring interface Ether0: 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: 4) 設(shè)置接口的 IP 子網(wǎng)掩碼: Number of bits in sub field [0]: Class C work is , 0 sub bits。 顯示結(jié)束后,系統(tǒng)會問是否使用這個設(shè)置: Use this configuration? [yes/no]: yes 如果回答 yes,系統(tǒng)就會把設(shè)置的結(jié)果存入路由器的 NVRAM 中,然后結(jié)束設(shè)置對話過程,使路由器開始正常的工作。 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 Cisco 路由器配置手冊 6/61 進入端口設(shè) 置狀態(tài) interface type slot/number 進入子端口 設(shè)置狀態(tài) interface type [pointtopoint | 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 runningconfig 查看開機設(shè)置 show startupconfig 顯示端口信息 show interface type slot/number 顯示路由信息 show ip router 4. 拷貝命令 用于 IOS 及 CONFIG 的備份和升級 5. 網(wǎng)絡(luò)命令 任務(wù) 命令 登錄遠程主機 tel 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 Cisco 路由器配置手冊 7/61 設(shè)置特權(quán)密碼 enable secret password 設(shè)置路由器名 hostname name 設(shè)置靜態(tài)路由 ip route destination submask nexthop 啟動 IP 路由 ip routing 啟動 IPX 路由 ipx routing 端口設(shè)置 interface type slot/number 設(shè)置 IP 地址 ip address address submask 設(shè)置 IPX 網(wǎng)絡(luò) ipx work work 激活端口 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 到 有效 和 保留 B 到 有效 和 保留 C 到 有效 和 保留 D 到 用于多點廣播 E 到 保留 用于廣播 2. 分配接口 IP 地址 任務(wù) 命令 接口設(shè)置 interface type slot/number 為接口設(shè)置 IP地址 ip address ipaddress mask 掩瑪( mask)用于識別 IP 地址中的網(wǎng)絡(luò)地址位數(shù), IP 地址( ipaddress)和掩碼( mask)相與即得到網(wǎng)絡(luò)地址。 如下圖所示: Cisco 路由器配置手冊 8/61 Router1 和 Router2 的 E0端口均使用了 C類地址 , Router1的 E0的網(wǎng)絡(luò)地址為 ,掩碼為 , Router2 的 E0 的網(wǎng)絡(luò)地址為 , 掩 碼 為,這樣就將一個 C 類網(wǎng)絡(luò)地址分配給了二個網(wǎng),既劃分了二個子網(wǎng),起到了節(jié)約地址的作用。命令 ip nat inside source list 2 pool c2501 overload 中的參數(shù) overload,將允許多個內(nèi)部地址使用相同的全局地址(一個合法 IP 地址,它是由 NIC 或服務(wù)提供商所分配的地址)。 設(shè)置如下: 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)絡(luò)訪問時所要經(jīng)過的路徑 ,在網(wǎng)絡(luò)結(jié)構(gòu)比較簡單,且一般到達某一網(wǎng)絡(luò)所經(jīng)過的路徑唯一的情況下采用靜態(tài)路由。 interface :本地網(wǎng)絡(luò) 接口 distance :管理距離(可選) tag tag :tag 值(可選) permanent :指定此路由即使該端口關(guān)掉也不被移掉。在 Router3 上設(shè)置了訪問 地址為 。 Router1: ip route Router3: ip route ip route 同時由于路由器 Router3 除了與路由器 Router2 相連外,不再與其他路由器相連,所以也可以為它賦予一條默認(rèn)路由以代替以上的二條靜態(tài)路由, ip route 即只要沒有在路由表里找到去特定目的地址的路徑 ,則數(shù) 據(jù)均被路由到地址為 的相鄰路由器。 1. 有關(guān)命令 Cisco 路由器配置手冊 11/61 端口設(shè)置 任務(wù) 命令 設(shè)置 HDLC 封裝 encapsulation hdlc 設(shè)置 DCE 端線路速度 clockrate speed 復(fù)位一個硬件接口 clear interface serial unit 顯示接口狀態(tài) show interfaces serial [unit] 1 注 : Cisco 同步串口狀態(tài)的例子 . Routershow interface serial 0 Serial 0 is up, line protocol is up Hardware is MCI Serial Inter address is , sub mask is MTU 1500 bytes, BW 1544 Kbit, DLY 20200 usec, rely 255/255, load 1/255 Encapsulation HDLC, loopback not set, keepalive set (10 sec) Last input 0:00:07, output 0:00:00, output hang never Output queue 0/40, 0 drops。 當(dāng)鏈路為 E1 時 , channelgroup 編號為 030, Timeslot 范圍 131. show controllers e1 觀察 controller 狀態(tài) ,以下為幀類型為 crc4 時 controllers正常的狀態(tài) . Router show controllers e1 e1 0/0 is up. Applique type is Channelized E1 unbalanced Framing is CRC4, Line Code is HDB3 No alarms detected. Data in current interval (725 seconds elapsed): 0 Line Code Violations, 0 Path Code Violations 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs Total Data (last 24 hours) 0 Line Code Violations, 0 Path Code Violations, 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins, 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 以下例子為 E1連接 3條 64K專線 , 幀類型為 NOCRC4,非平衡鏈路 ,路由器具體設(shè)置如下 : shanxiwri t Building configuration... Current configuration: ! version no service udpsmallservers no service tcpsmallservers ! hostname shanxi ! enable secret 5 $1$XN08$enable password shanxi ! ! ip subzero ! controller E1 0 framing NOCRC4 channelgroup 0 timeslots 1 channelgroup 1 timeslots 2 channelgroup 2 timeslots 3 ! interface Ether0 ip address mediatype 10BaseT ! Cisco 路由器配置手冊 13/61 interface Ether1 no ip address shutdown ! interface Serial0:0 ip address no ip mroutecache ! interface Serial0:1 ip address no ip mroutecache ! interface Serial0:2 ip address no ip mroutecache ! no ip classless ip route Serial0:0 ip route Serial0:1 ip route Serial0:2 ! line con 0 line aux 0 line vty 0 4 password shanxi login ! end PPP PPP(PointtoPoint Protocol)是 SLIP(Serial Line IP protocol)的繼承者,它提供了跨過同步和異步電路實現(xiàn)路由器到路由器 (routertorouter) 和 主 機 到 網(wǎng) 絡(luò)