1. 程式人生 > >簡單路由配置--課程內容隨筆

簡單路由配置--課程內容隨筆

end clock ctrl+ 路由器 con abr 路由表 動態路由協議 不同

視圖模式介紹:
用戶模式 router>
特權模式 router#
全局模式 router(config)#
接口模式 router(config-if)#

用->特 :enable/en
特->全:config t
全->接口:int 接口名稱 例如int s0/0/0或int f0/0
路由協議視圖router(config-route)# /在全局模式下輸入router 動態路由協議名稱

1、一般的常用命令
router(config-if)#exit
router(config)#
router(config-router)#exit
router(config)#
router(config-line)#exit
router(config)#
router(config)#exit
router#
exit命令/從接口、協議、line等視圖模式下退回到全局配置模式,或從全局配置模式退回到特權模式

router(config-if)#end
router(config-router)#end
router(config-line)#end
router#
end命令/從任何視圖直接回到特權模式

router#Logout /退出當前路由器登陸模式相對與windows的註銷
router#reload /重新啟動路由器(熱啟動)冷啟動就是關閉路由器再打開電源開關

2、路由基本設置

router>enable /進入特權模式
router#conf t /進入全局配置模式
router(config)# hostname xxx /設置設備名稱

(1)設置口令
router(config)#enable password password /使能口令
router(config)#enable secret password /使能加密口令


(2)設置telnet服務模式
router(config)#line vty 0 4 /進入設置telnet服務模式
router(config-line)#password xxx /設置telnet的密碼
router(config-line)#login /使能可以登陸

(3)控制臺線路設置
router(config)#line con 0 /進入控制口的服務模式
router(config-line)#password xxx /要設置console的密碼
router(config-line)#login /使能可以登陸

(4)接口配置
router(config)#int s0/0/0 /進入接口配置模式
router(config-if)#ip add xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
/添加ip 地址和掩碼給環回口 在物理接口上配置了ip地址後用no shut啟用這個物理接口反之可以用shutdown 管理性的關閉接口
router(config-if)#no shut
router(config-if)#login

(5)DCE接口始終頻率設置
router(config)#int s0/0/0
router(config-if)#clock rate 64000
router(config-if)#no shut
Ctrl+z

router(config-if)#enca hdlc/ppp
/捆綁鏈路協議hdlc 或者ppp 思科缺省串口封裝的鏈路層協議是HDLC所以在show run配置的時候接口上的配置沒有,如果要封裝為別的鏈路層協議 例如PPP/FR/X25就是看到接口下的enca ppp或者enca fr
router(config)#int loopback
/建立環回口(邏輯接口)模擬不同的本機網段

3、路由配置:
(1)靜態路由
router(config)#ip route xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 下一條或自己的接口
router(config)#ip route 0.0.0.0 0.0.0.0 s 0 添加缺省路由

(2)動態路由
rip協議
router(config)#router rip /啟動rip協議
router(config-router)#network xxx.xxx.xxx.xxx /宣告自己的網段
router(config-router)#version 2 轉換為rip 2版本
router(config-router)#no auto-summary /關閉自動匯總功能,rip V2才有作用
router(config-router)# passive-int 接口名/啟動本路由器的那個接口為被動接口
router(config-router)# nei xxx.xxx.xxx.xxx /廣播轉單播報文,指定鄰居的接ip,

igrp協議-----內部網關路由協議(IGRP:Interior Gateway Routing Protocol)
router(config)#router igrp xxx /啟動igrp協議
router(config-router)#network xxx.xxx.xxx.xxx /宣告自己的網段
router(config-router)#variance xxx /調整倍數因子,使用不等價的負載均衡
eigrp---Enhanced Interior Gateway Routing Protocol(增強網關內部路由線路協議)
router(config)#router eigrp xxx /啟動協議
router(config-router)#network xxx.xxx.xxx.xxx /宣告自己的網段
router(config-router)#variance xxx /調整倍數因子,使用不等價的負載均衡
router(config-router)#no auto-summary /關閉自動匯總功能

ospf協議----開放最短路徑協議(OSPF)協議
router(config)#router ospf xxx /啟動協議啟動一個OSPF協議進程
router(config-router)#network xxx.xxx.xxx.xxx area xxx /宣告自己的接口或網段在ospf的區域中,可以把不同接口宣告在不同區域中
router(config-router)#router-id xxx.xxx.xxx.xxx /配置路由的id router(config-router)#area xxx stub /配置xxx區域為末梢區域,加入這個區域的路由器全部要配置這個條命令
router(config-router)#area xxx stub no-summary /配置xxx區域為完全末梢區域 只在ABR上配置
router(config-router)#area xxx nssa /配置xxx區域為非純末梢區域,加入這個區域的路由器全部要配置這個條命令
router(config-router)#area xxx nssa no-summary /配置xxx區域為完全非純末梢區域,只在ABR上配置,並發布缺省路由信息進入這個區域內的路由器

4、保存當前修改/運行的配置:
router#write /將RAM中的當前配置存儲到NVRAM中,下次路由器啟動就是執行保存的配置
router#Copy running-config startup-config /命令與write效果一樣

特權模式下

查看命令
router#show running-config /查看當前運行配置
router#show startup-config /查看啟動配置
router#show ip route /查看當前的路由表
router#show ip int brief /查看當前的路由器的接口ip地址啟用情況
router#Show interfaces /顯示設置在路由器和訪問服務器上所有接口的統計信息顯示路由器上配置的所有接口的狀態
router#Show interfaces serial /顯示關於一個串口的信息
router#Show ip interface /列出一個接口的IP信息和狀態,列出接口的狀態和全局參數

router#debug ip pack /打開ip報文的調試
router#terminal monitor /輸出到終端上顯示調試信息

查看協議
router#show ip protocol /查看當前路由器運行的動態路由協議情況
router#show ip eigrp neighbors /查看eigrp協議的鄰居表
router#show ip eigrp top //查看eigrp協議的拓樸表
router#show ip eigrp interface /查看當前路由器運行eigrp協議的接口情況
router#show ip ospf neighbor /查看當前路由器的ospf協議的鄰居表
router#show ip ospf interface /查看當前路由器運行ospf協議的接口情況

清除
router#clear ip ospf process /清除當前路由器ospf協議的進程
router#clear ip route * /清除當前的路由表

簡單路由配置--課程內容隨筆