路由器配置命令

以下內容是局域網路由器配置命令參考,家用路由器配置不在本文探討之列。

路由器是局域網絡與廣域網絡(或城域網)相連的必備設備,也是網絡管理員必備的技能之一。

路由器的命令實際上難度和早期的dos操作系統或命令行的linux比較接近,但功能上要比以上操作系統單一很多。不同廠商的路由器命令有些許差別,但功能性的東西沒有本質的差別。

2014050870584793.jpg

以下是常用路由器配置命令

1. 進入特權模式 enable
router > enable
router #

2. 進入全局配置模式 configure terminal
router > enable
router #configure terminal
router (config)#

3. 重命名 hostname routera 以routerA爲例
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)#

4. 配置使能口令 enable password cisco 以cisco爲例
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# enable password cisco

5. 配置使能密碼 enable secret ciscolab 以cicsolab爲例
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# enable secret ciscolab

6. 進入路由器某一端口 interface fastethernet 0/1
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# interface fastethernet 0/1
routerA (config-if)#
進入路由器的某一子端口 interface fastethernet 0/1.1 以1端口的1子端口爲例
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# interface fastehernet 0/1.1

7. 設置端口ip地址信息
router > enable
router #configure terminal
router(config)#hostname routerA
routerA(config)# interface fastethernet 0/1 以1端口爲例
routerA (config-if)#ip address 192.168.1.1 255.255.255.0 配置交換機端口ip和子網掩碼
routerA (config-if)#no shut 啓動此接口
routerA (config-if)#exit

8. 查看命令 show
router > enable
router # show version 察看系統中的所有版本信息
show controllers serial + 編號查看串口類型
show ip route 查看路由器的路由表

9. cdp相關命令
router > enable
router # show cdp 查看設備的cdp全局配置信息
show cdp traffic 查看有關cdp包的統計信息
show cdp neighbors 列出與設備相連的cisco設備

10. csico2600的密碼恢復
重新啓動路由器,在啓動過程中按下ctrl+break鍵,使路由器進入rom monitor模式。
在提示符下輸入命令修改配置寄存器的值,然後重新啓動路由器。
rommon1>confreg 0×2142
rommon2>reset
重新啓動路由器後進入setup模式,選擇“no”,退回到exec模式,此時路由器原有的配置仍然保存在startup-config中,爲使路由器恢復密碼後配置不變,則需要把startup-config中配置保存到running-config中,然後重新設置enable密碼,並把配置寄存器的值改回0×2102。
router>enable
router#copy startup-config running-config
router#configure terminal
router(config)#enable password cisco
router(config)#config-register 0×2102
保存當前配置到startup-config , 重新啓動路由器。
router #copy running-config startup-config
router #reload

11. 路由器telnet遠程登錄設置
router>en
router #configure terminal
router (config)#hostname routerA
routerA (config)#enable password cisco 以cisco爲特權模式密碼
routerA (config)#interface fastethernet 0/1
routerA (config-if)#ip address 192.168.1.1 255.255.255.0
routerA (config-if)#no shut
routerA (config-if)#exit
routerA (config)line vty 0 4 設置0-4 個用戶可以telnet遠程登陸
routerA (config-line)#password 123
routerA (config-line)#login

12. 配置路由器的標識 banner $……………$
在全局配置的模式下利用“banner”命令可以配置路由器的提示信息,所有連接到路由器的終端都會收到。
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#banner motd $This is aptech company’ router ! Please don’t change the configuration without permission!$

13. 配置接口標識 description ………
接口標識用於區分路由器的各個接口。用show run命令可以查看到這些標識。
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#interface fastethernet 0/1 以0/1 接口爲例
routerA(config-if)# description this is a fast Ethernet port used to connecting the company’s intranet!

14. 配置超時
超時用於設置在多長時間沒有對console進行配置,自動返回exec會話時間。默認爲10分鐘。
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#line console 0
routerA(config-line)#exec-timeout 0 0 第一個“0”代表分鐘,第二個“0”代表秒

15. 配置串口參數
兩臺路由器通過串口連接需要一個做爲DTE,一個做爲DCE。DCE設備要向DTE設備提供時鐘頻率和帶寬。
DCE配置:
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#interface serial 0/0
routerA(config-if)#clock rate 64000 提供時鐘頻率爲64000
routerA(config-if)#bandwidth 64 提供帶寬爲64
routerA(config-if)#no shut
DTE配置:
router>en
router #configure terminal
router (config)#hostname routerB
routerB(config)#interface serial 0/0
routerB(config-if)#no shut

16. 靜態路由的配置
配置路由器R1的名稱和接口參數
router>enable
router#configure terminal
router(config)#hostname routerA
routerA(config)#interface fastethernet 0/0
routerA(config-if)#ip address 192.168.2.1 255.255.255.0
routerA(config-if)#no shutdown
routerA(config-if)#exit
routerA(config)# interface fastethernet 0/1
routerA(config-if)#ip address 192.168.3.1 255.255.255.0
routerA(config-if)#no shutdown
主機A的ip地址爲 192.168.3.2
255.255.255.0
192.168.3.1
配置路由器R2的名稱和接口參數
router>enable
router#configure terminal
router(config)#hostname routerB
routerB(config)#interface fastethernet 0/0
routerB(config-if)#ip address 192.168.2.2 255.255.255.0
routerB(config-if)#no shutdown
routerB (config-if)#exit
routerB(config)# interface fastethernet 0/1
routerB(config-if)#ip address 192.168.1.1 255.255.255.0
主機B的ip地址爲 192.168.1.2
255.255.255.0
192.168.1.1
配置路由器R1的靜態路由表
routerA(config)#ip router 192.168.1.0 255.255.255.0 192.168.2.2
配置路由器R2的靜態路由表
routerA(config)#ip router 192.168.3.0 255.255.255.0 192.168.2.1
在R1和R2上配置默認路由
routerA(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
routerA(config)#ip classless
routerB(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
routerB(config)#ip classless(支持可變長子網掩碼、無類域間路由)
在routerA和routerB上配置動態路由(RIP)
routerA(config)#router rip
routerA(config)#network 192.168.2.0
routerA(config)#network 192.168.3.0
routerB(config)# router rip
routerB(config)#network 192.168.2.0
routerB(config)#network 192.168.1.0

17. 配置單臂路由
router(config)# interface f0/0.1
router(config-subif)# ip address 192.168.1.1 255.255.255.0
router(config-subif)# encapsulation dot1q 1
router(config-subif)# exit
router(config)# interace f0/0.2
router(config-subif)# ip address 192.168.2.1 255.255.255.0
router(config-subif)# encapsulation dot1q 2
router(config-subif)# exit
router(config)# interface f0/0.3
router(config-subif)# ip address 192.168.3.1 255.255.255.0
router(config-subif)# encapsulation dot1q 3
router(config-subif)# exit
router(config)# interface f0/0
router(config-if)# no shut

本文是 有圖小站 原創,原地址 http://www.utosee.com/post/575.html 轉載請保留。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章