路由器的基本配置

如下是經常使用路由器配置命令html

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

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

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

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

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

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.1orm

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)#exitrouter

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

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.1router(config-subif)# ip address 192.168.1.1 255.255.255.0router(config-subif)# encapsulation dot1q 1router(config-subif)# exitrouter(config)# interace f0/0.2router(config-subif)# ip address 192.168.2.1 255.255.255.0router(config-subif)# encapsulation dot1q 2router(config-subif)# exitrouter(config)# interface f0/0.3router(config-subif)# ip address 192.168.3.1 255.255.255.0router(config-subif)# encapsulation dot1q 3router(config-subif)# exitrouter(config)# interface f0/0router(config-if)# no shut

相關文章
相關標籤/搜索