【內容摘要】
cisco路由配置語句匯總啟動介面,分配ip地
址:router>router>enablerouter#router#configureterminalrouter(config)#router(config)#interfacetypeportrouter(config-
if)#noshutdownrouter(config-if)#ipaddressip-addresssubnet-
maskrouter(config-if)#^z配置rip路由協議:30秒更新一次
router(config)#routerriprouter(config-if)#……
-----------------------------------------------------------------------------
cisco路由配置語句匯總
啟動介面,分配ip地址:
router>
router> enable
router#
router# configure terminal
router(config)#
router(config)# interface type port
router(config-if)# no shutdown
router(config-if)# ip address ip-address subnet-mask
router(config-if)# ^z
配置rip路由協議:30秒更新一次
router(config)# router rip
router(config-if)# network network-number <——通告標準a,b,c類網——>
router(config-if)# ^z
配置igrp路由協議:90秒更新一次
router(config)# router igrp as-number <—— as-number範圍1~65535——>
router(config-if)# network network-number <——通告標準a,b,c類網——>
router(config-if)# ^z
配置novell ipx路由協議:novell rip 60秒更新一次
router(config)# ipx routing [node address]
router(config)# ipx maximum-paths paths <——設定Server Load Balancer,範圍1~512——>
router(config)# interface type port
router(config-if)# ipx network network-number [encapsulation encapsulation-type] [secondary] <——通告標準a,b,c類網——>
router(config-if)# ^z
配置ddr:
router(config)# dialer-list group-number protocol protocol-type permit [list acl-number]
router(config)# interface bri 0
router(config-if)# dialer-group group-number
router(config-if)# dialer map protocol-type next-hop-address name hostname telphone-number
router(config-if)# ^z
配置isdn:
router(config)# isdnth-typeth-type <——配置isdn交換器
類型,中國使用basic-net3——>
router(config-if)# ^z
配置frame relay:
router(config-if)# encapsulation frame-relay [cisco | ietf ]
router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ]
router(config-if)# bandwidth kilobits
router(config-if)# frame-relay invers-arp [ protocol ] [dlci ]
<——配置靜態invers arp表:
router(config)# frame-relay protocol protocol-address dlci [
broadcast ] [ ietf | cisco ] [ payload-compress | packet-by-packet ]
——>
<——設定keepalive間隔:
router(config-if)# keepalive number
——>
<——為本地介面指定dlci:
router(config-if)# frame-lelay local-dlci number
——>
<——子介面配置:
router(config-if)# interface type port.subininterface-number [ multipoint | point-to-point ]
router(config-subif)# ip unnumbered interface
router(config-subif)# frame-lelay local-dlci number
——>
router(config-if)# ^z
配置標準acl:
router(config)# access-list access-list-number [ permit | deny ] source
[ source-mask ] <—— access-list-number
範圍:1~99標準acl;100~199擴充acl;800~899標準ipx acl;900~999擴充ipx acl;1000~1099
ipx sap acl;600~699apple talk acl——>
router(config)# interface type port
router(config-if)# ip access-group access-list-number [ in | out ]
router(config-if)# ^z
配置擴充acl:
router(config)# access-list access-list-number [ permit | deny ] [
protocol | protocol-number ] source source-wildcard [ source-port ]
destination destination-wildcard [ destination-port ] [ established ]
router(config)# interface type port
router(config-if)# ip access-group access-list-number [ in | out ]
router(config-if)# ^z
配置命名acl:
router(config)# ip access-list [ standard | extended ] acl-name
router(config [ std- | ext- ] nacl)# [ permit | deny ] [ ip-access-list-test-conditions ]
router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ ip-access-list-test-conditions ]
router(config [ std- | ext- ] nacl)# ^z
router(config)# interface type port
router(config-if)# ip access-group [acl-name | 1~199 ] [ in | out ]
router(config-if)# ^z
配置dce時鐘:
router# show controllers type port <——確定dce介面——>
router(confin-if)# clock rate 64000 <——進入dce介面設定時脈速率——>
router(config-if)# ^z
配置ppp協議:
router(config)# username name password set-password-here <——驗證方建立資料庫——>
router(config)# interface type port
router(config-if)# encapsulation ppp <——啟動ppp協議——>
router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <——選擇ppp認證——>
router(config-if)# ppp pap sent-username name password password <——發送驗證資訊——>
router(config-if)# ^z
pap單向認證配置執行個體:
驗證方:
router-server(config)# username client password 12345 <——驗證方建立資料庫——>
router-server(config)# interface serial 0
router-server(config-if)# encapsulation ppp
router-server(config-if)# ppp authentication pap <——選擇使用pap實現ppp認證——>
router-server(config-if)# ^z
被驗證方:
router-client(config-if)# encapsulation ppp
router-client(config-if)# ppp pap sent-username client password 12345 <——發送驗證資訊——>
router-client(config-if)# ^z
pap雙向認證配置執行個體:
路由器
a:
routera(config)# username b password 12345
routera(config)# interface serial 0
routera(config-if)# encapsulation ppp
routera(config-if)# ppp authentication pap
routera(config-if)# ppp pap sent-username a password 54321
routera(config-if)# ^z
路由器
b:
routerb(config)# username a password 54321
routerb(config)# interface serial 1
routerb(config-if)# encapsulation ppp
routerb(config-if)# ppp authentication pap
routerb(config-if)# ppp pap sent-username b password 12345
routerb(config-if)# ^z
chap單向認證配置執行個體:
驗證方:
router-server(config)# username router-client password 12345
router-server(config)# interface serial 0
router-server(config-if)# encapsulation ppp
router-server(config-if)# ppp authentication chap
router-server(config-if)# ^z
被驗證方:
router-client(config-if)# encapsulation ppp
router-client(config-if)# ppp authentication chap
router-client(config-if)# ppp chap hostname router-client
router-client(config-if)# ppp chap password 12345
router-client(config-if)# ^z chap雙向認證配置執行個體:
路由器
a:
routera(config)# username routerb password 12345
routera(config)# interface serial 0
routera(config-if)# encapsulation ppp
routera(config-if)# ppp authentication chap
routera(config-if)# ppp chap hostname routera
routera(config-if)# ppp chap password 54321
routera(config-if)# ^z
路由器
b:
routerb(config)# username routera password 54321
routerb(config)# interface serial 1
routerb(config-if)# encapsulation ppp
routerb(config-if)# ppp authentication chap
routerb(config-if)# ppp chap hostname routerb
routerb(config-if)# ppp chap password 12345
routerb(config-if)# ^z
telnet使用:
routera# terminal monitor <——可以傳回在遠端主機執行debug命令的結果——>
routera# telnet ip-address [ router-name ] <——telnet到指定的地址或名字的主機——>
routerb# [ exit | logout ] <——退出telnet——>
routerb# ++<6>再按 <——掛起telnet——>
routera# show sessions <——顯示當前所有telnet的資訊,包括connect-number ——>
routera# connect-number <——返回指定的telnet串連——>
routera# disconnect ip-address [ router-name ] <——斷開指定地址或名字的主機的串連——>
routera# show user <——顯示telnet到原生串連資訊——>
routera# clear line [ 0 | 1 | 2 | 3 | 4 ] <——斷開指定telnet到原生串連——>
禁止任何telnet到本機:
router(config)# line vty 0 4
router(config-line)# access-class acl-number
router(config)# ^z
設定主機名稱:
router(config)# hostname set-hostname
router(config)# ^z
router(config)# ^z
設定使用者模式密碼:
router(config)# line console 0
router(config-line)# login
router(config-line)# password set-password
router(config-line)# ^z
設定telnet密碼:
router(config)# line vty 0 4
router(config-line)# login
router(config-line)# password set-password
router(config-line)# ^z
設定特權模式密碼:
router(config)# enable password set-password <——不加密的密碼,明碼——>
router(config)# enable secret set-password <——經過加密的密碼——>
router(config)# ^z
給所有密碼加密:
router(config)# service password-ancryption set-password-here
router(config)# no service password-ancryption <——取消加密——>
router(config)# ^z
設定登入banner:
router(config)# banner motd 分隔字元 set-banner-information-here 分隔字元 <——前後分隔字元一定要一致——>
設定介面的描述資訊:
router(config-if)# description set-port-information-here
router(config)# ^z
cdp的控制:
router(config-if)# cdp enable <——在指定連接埠啟用cdp,預設——>
router(config-if)# no cdp enable <——在指定連接埠關閉cdp——>
router(config)# cdp run <——使所有連接埠啟用cdp——>
router(config)# no cdp run <——使所有連接埠關閉cdp——>
ping的使用:
router# ping ip-address
router# ping <——擴充ping命令——>
protocol [ip]:[ protocol-type ] <——選擇協議類型——>
target ip address:ip-address <——輸入測試地址——>
repeat count [5]: <——選擇發送的icmp包數量——>
datagram size [100]: <——選擇每個包的大小——>
timeout in seconds [2]: <——設定每個包的逾時時間——>
extended commands [n]:y <——使用擴充ping命令——>
sweep range of sizes [n]:
tracke的使用:
router# trace ip-address [ host-name ]
為cisco 4000路由器
指定媒體類型:
router(config-if)# media-type 10baset <——使aui(預設)失效,改為使用rj-45——>
router(config-if)# ^z
更改路由器
啟動順序:
router(config)# boot system flash ios-filename
router(config)# boot system tftp ios-filename tftp-ip-address
router(config)# boot system rom
router(config)# ^z
修改寄存器數值:
router(config)# config-register value
<——cisco出廠預設value=0x2102,value範圍:0x2100(進入rom監視器),0x2101(使系統從rom啟
動),0x2102~0x210f(使系統從nvram啟動)。0x1=0x2101,從最小位開始改變——>
在rom監視器中更改寄存器數值:
> o/r value
路由器
密碼的恢複:
冷關機,然後再開機並在60秒內按< ctrl>+進入rom監視器模式
> o/r 0x2142 <--25xx型路由器
--> 或 > confreg 0x2142 <--16xx型路由器
-->
router> i
router> n
router> enable
router# copy startup-config running-config
router# configure terminal
router(config)# enable secret new-password
router(config)# config-register 0x2102
router(config)# ^z
router# copy running-config startup-config
router# reload
配置名稱-主機入口:
router(config)# ip host set-name [ tcp-port-number ] ip-address [ ip-address 2 ].。。
router(config)# ^z
定義dns主機:
router(config)# ip name-server server-address [ server-address 2 ].。。
router(config)# ^z
禁用dns:
router(config)# no ip domain-lookup
router(config)# ^z配置水平分割:
router(config-if)# ip split-horizon
router(config-if)# no ip split-horizon
router(config-if)# ^z
配置靜態路由:
router(config)# ip route ip-address subnet-mask [ next-hop-address | local-out-port ] [distace ]
<——distance範圍:1~255,相當於優先權,越小越好。rip=120;dspf=110;igrp=100;eigrp=90——>
router(config)# ^z
配置預設路由:
router(config)# ip defoult-network ip-address <——動態預設路由——>
router(config)# ip route 0.0.0.0 0.0.0.0 [ next-hop-address | local-out-port ] [distace ] <——靜態預設路由——>
router(config)# ^z
其它命令:
router# show version
router# show running-config
router# show startup-config
router# show flash
router# show interface [ type port ]
router# show buffers
router# show protocol
router# show mem
router# show stacks
router# show processes
router# show cdp entry [ device-name ] <——顯示指定鄰居三層資訊——>
router# show cdp neighbors
router# show cdp neighbors detail <——顯示所有鄰居三層資訊->
router# show ip router
router# show ipx router
router# show host
router# show ip protocol
router# show ip interface type port
router# show ipx interface type port
router# show ipx servers
router# show ipx traffic
router# show access-lists [ acl-number ]
router# show isdn status
router# show dialer <——查看isdn撥號資訊——>
router# show isdn active
router# show frame-relay pvc
router# show frame-relay map
router# show frame-relay lmi
router# erase startup-config
router# reload
router# setup
router# copy running-config startup-config
router# copy startup-config running-config
router# copy tftp running-config
router# copy running-config tftp
router# debug ipx routing activity
router# debug ipx sap
router# debug isdn q921
router# debug isdn q931
router# debug dialer
router# debug ip rip
router# clear interface bri