- 相關(guān)推薦
路由器配置命令
路由器是局域網(wǎng)絡(luò)與廣域網(wǎng)絡(luò)(或城域網(wǎng))相連的必備設(shè)備,也是網(wǎng)絡(luò)管理員必備的技能之一。下面是小編收集的路由器配置命令,歡迎大家閱讀!更多相關(guān)信息請(qǐng)關(guān)注相關(guān)欄目!
路由器的命令實(shí)際上難度和早期的dos操作系統(tǒng)或命令行的linux比較接近,但功能上要比以上操作系統(tǒng)單一很多。不同廠商的路由器命令有些許差別,但功能性的東西沒(méi)有本質(zhì)的差別。
以下是常用路由器配置命令。
1. 進(jìn)入特權(quán)模式 enable
router > enable
router #
2. 進(jìn)入全局配置模式 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. 進(jìn)入路由器某一端口 interface fastethernet 0/1
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# interface fastethernet 0/1
routerA (config-if)#
進(jìn)入路由器的某一子端口 interface fastethernet 0/1.1 以1端口的1子端口為例
router > enable
router #configure terminal
router(config)#hostname routerA
routerA (config)# interface fastehernet 0/1.1
7. 設(shè)置端口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 配置交換機(jī)端口ip和子網(wǎng)掩碼
routerA (config-if)#no shut 啟動(dòng)此接口
routerA (config-if)#exit
8. 查看命令 show
router > enable
router # show version 察看系統(tǒng)中的所有版本信息
show controllers serial + 編號(hào)查看串口類型
show ip route 查看路由器的路由表
9. cdp相關(guān)命令
router > enable
router # show cdp 查看設(shè)備的cdp全局配置信息
show cdp traffic 查看有關(guān)cdp包的統(tǒng)計(jì)信息
show cdp neighbors 列出與設(shè)備相連的cisco設(shè)備
10. csico2600的密碼恢復(fù)
重新啟動(dòng)路由器,在啟動(dòng)過(guò)程中按下ctrl+break鍵,使路由器進(jìn)入rom monitor模式。
在提示符下輸入命令修改配置寄存器的值,然后重新啟動(dòng)路由器。
rommon1>confreg 0×2142
rommon2>reset
重新啟動(dòng)路由器后進(jìn)入setup模式,選擇“no”,退回到exec模式,此時(shí)路由器原有的配置仍然保存在startup-config中,為使路由器恢復(fù)密碼后配置不變,則需要把startup-config中配置保存到running-config中,然后重新設(shè)置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
保存當(dāng)前配置到startup-config , 重新啟動(dòng)路由器。
router #copy running-config startup-config
router #reload
11. 路由器telnet遠(yuǎn)程登錄設(shè)置
router>en
router #configure terminal
router (config)#hostname routerA
routerA (config)#enable password cisco 以cisco為特權(quán)模式密碼
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 設(shè)置0-4 個(gè)用戶可以telnet遠(yuǎn)程登陸
routerA (config-line)#password 123
routerA (config-line)#login
12. 配置路由器的標(biāo)識(shí) banner $……………$
在全局配置的模式下利用“banner”命令可以配置路由器的提示信息,所有連接到路由器的終端都會(huì)收到。
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. 配置接口標(biāo)識(shí) description ………
接口標(biāo)識(shí)用于區(qū)分路由器的各個(gè)接口。用show run命令可以查看到這些標(biāo)識(shí)。
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. 配置超時(shí)
超時(shí)用于設(shè)置在多長(zhǎng)時(shí)間沒(méi)有對(duì)console進(jìn)行配置,自動(dòng)返回exec會(huì)話時(shí)間。默認(rèn)為10分鐘。
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#line console 0
routerA(config-line)#exec-timeout 0 0 第一個(gè)“0”代表分鐘,第二個(gè)“0”代表秒
15. 配置串口參數(shù)
兩臺(tái)路由器通過(guò)串口連接需要一個(gè)做為DTE,一個(gè)做為DCE。DCE設(shè)備要向DTE設(shè)備提供時(shí)鐘頻率和帶寬。
DCE配置:
router>en
router #configure terminal
router (config)#hostname routerA
routerA(config)#interface serial 0/0
routerA(config-if)#clock rate 64000 提供時(shí)鐘頻率為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. 靜態(tài)路由的配置
配置路由器R1的名稱和接口參數(shù)
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
主機(jī)A的ip地址為 192.168.3.2
255.255.255.0
192.168.3.1
配置路由器R2的名稱和接口參數(shù)
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
主機(jī)B的ip地址為 192.168.1.2
255.255.255.0
192.168.1.1
配置路由器R1的靜態(tài)路由表
routerA(config)#ip router 192.168.1.0 255.255.255.0 192.168.2.2
配置路由器R2的靜態(tài)路由表
routerA(config)#ip router 192.168.3.0 255.255.255.0 192.168.2.1
在R1和R2上配置默認(rèn)路由
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(支持可變長(zhǎng)子網(wǎng)掩碼、無(wú)類域間路由)
在routerA和routerB上配置動(dòng)態(tài)路由(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
【路由器配置命令】相關(guān)文章:
如何配置無(wú)線路由器10-04
關(guān)于路由器端口配置語(yǔ)句的說(shuō)明10-03
關(guān)于Cisco路由器配置的詳細(xì)分析10-10
有關(guān)于cisco路由器上配置TCP攔截方法10-03
電腦運(yùn)行命令以及dos命令大全10-04
關(guān)于Linux命令之a(chǎn)wk命令使用介紹10-04
Ping命令的使用大全10-05
關(guān)于ping命令詳解10-10
telnet命令的完整使用10-07