1. 程式人生 > >路由配置命令

路由配置命令

ace lin erase inter 方向 tar sync copy ice

路由器模式:

用戶模式 Router>
特權模式 Router#
進入配置模式:(使用exit或者ctrl+z退出)Router#configure terminal
全局模式 Router(config)#
接口模式 Router(config-if)#
子接口模式 Router(config-subif)#
行模式 Router(config-line)#

編輯和幫助功能:

“?”的使用
“Tab”鍵的使用
方向鍵上下可以調出曾經使用的命令
Show history查看最近使用的20條命令
Show terminal命令來查看歷史記錄大小
Terminal history size命令設置歷史緩存空間大小

路由器和交換機的管理配置:

設置主機名 hostname命令
設置口令 enable密碼(明文和密文)
vty密碼
console控制臺密碼

創建用戶:
Router(config)#username maomao password maomao (創建用戶名與密碼)

控制臺的兩個重要命令:
exec-timeout 0 0 超時時間設置
logging synchronous 日誌同步
加密所有口令:
service password-encryption
描述:description
使用do命令:IOS版本12.3以上可以用
路由器接口: (config)#interface 接口類型 端口號

端口激活與關閉: shutdown/no shutdown
接口上配置IP地址:Router(config)#ip address ip地址 掩碼 (secondary)
驗證配置:Ping
使用管道符: show run | ?
串行接口命令:clock rate

查看保存、擦除配置:

查看當前路由器配置:
Router#show running-config
保存當前配置:
Router#copy running-config startup-config
刪除配置及重新加載路由器:
Router#erase startup-config
Router#reload
(wr命令=copy running-config startup-config命令(保存當前配置))

BGP配置命令:

EBGP手工建立鄰居:
全局配置Router BGP AS-Number
進程配置Neighbor 物理地址 remote-as AS-Number
進程配置neighbor 物理地址 ebgp-multihop(1-255)多跳
IBGP手工建立鄰居:
進程配置:BGP router-ID //Router-ID更改需要重啟BGP進程 Clear ip bgp
進程配置:Neighbor 回環地址/物理地址 remote-as AS-Number
進程配置:neighbor 回環地址 update-source loopback
進程配置:neighbor 回環地址 next-hop-self
BGP和IGP的間的重分發:
BGP進程:redistribute協議AS-number
IGP進程:redistribute BGP AS-number METRIC
BGP進程:ip route 0.0.0.0 0.0.0.0 NULL0
BGP進程:neighbor 出口 default-originate
聚合路由:
Aggregate-address 網段 正掩碼 summary-only抑制明細路由

BGP基本配置:

Router(config)#router bgp 200 (啟動BGP進程)
Router(config-router)#neighbor 2.2.2.1(鄰居路由接口的IP) remote-as 100(鄰居AS-number) (建立鄰居關系)
Router(config-router)#network 172.16.0.0 [mask 255.255.255.0] (宣告直連網段,默認掩碼自動缺省)
Router(config-router)#(no)neighbor 2.2.2.1 shutdown (暫時使該鄰居關系不可用,防止路由抖動Flapping)

Router(config-router)#neighbor 2.2.2.1 update-source loopback 0(在路由器上配置了Loopback地址後,當A和B的鏈路Down掉了,A和B的鄰居關系依然保持,因為源地址沒變)
Router(config-router)#neighbor 2.2.2.1 next-hop-self (指定下一跳為自己)
Router(config-router)#neighbor [peer-group-name] peer-group (創建對等組,簡化相同配置)
Router(config-router)#neighbor 2.2.2.1 peer-group [peer-group-name] (添加對等組成員)
變更源地址一般常用於IBGP中,EBGP很少用,如果要在EBGP中使用,那麽還需要額外的命令(因為EBGP要求鄰居是直連的,使用Loopback端口,EBGP就不是直連的了)。在EBGP中使用Loopback端口,需要使用命令Neighbor 2.2.2.1 ebgp-multihop x,X為跳數。這個命令只能使用在EBGP情況下。
Router(config-router)#no synchronization (關閉同步)
同步主要是用於IBGP之間進行,EBGP不需要同步。使用同步的目的是避免出現黑洞(接收到數據包後不知道給誰,而只能丟棄)。同步默認是打開的,全互連時(用於IBGP)需要關閉同步。

清除全部會話的命令:Router# clear ip BGP
復位所有BGP連接,全部BGP路由表將被丟棄,BGP會話狀態更改為Idle。
清除單個會話的命令:Router# clear ip BGP [ip-address]
如果想不復位連接,也就是會話不丟失(鄰居關系不重建)來使變更策略生效的話,使用下面的命令:
Router# clear ip BGP {
|address} [soft out]
首先要指定鄰居關系在建立時要先保存Update信息(會保存在內存中),
命令:Router(config-router)# neighbor [ip-address] soft-reconfiguration inbound
這樣才能在Inbound策略變更時使用下面的命令:
Router# clear ip BGP {*|address} [soft in]

neighbor 192.168.0.2 remove-private-AS (剝去專用AS編號,因而防止專用AS編號的路由器2到達互聯網)

DHCP配置:

Router(config)#ip dhcp pool lzj (創建DHCP池名稱)
Router(dhcp-config)#network 192.168.0.0 255.255.255.0 (設置DHCP池)
Router(dhcp-config)#default-gateway 192.168.0.1 (設置網關地址)

接口IP地址配置:

Router(config)#interface fastethernet 0/0 (進入快速以太網0/0接口)
Router(config-if)#ip address 192.168.0.1 255.255.255.0 (設置該接口的IP地址)
Router(config-if)#no shutdown (啟用接口)

路由器loopback接口配置:

Router(config)#interface loopback 0
Router(config-if)#ip address 192.168.0.1 255.255.255.0
Router(config-if)#no shutdown

基本show命令:

Router#show ip interface brief (查看接口的摘要信息)
Router#show ip route (查看路由信息)
Router#show ip route bgp ( 只查看bgp路由信息)
Router#show ip bgp (查看bgp路由表)
Router#show ip bgp neighbor (查看bgp鄰居)
Router#Show IP BGP Summary (來查看bgp匯總的情況)
Router#show run | section bgp (查看當前配置信息中的bgp配置信息)
Router#show running-config (查看當前配置信息)
show startup-config(查看保存的配置信息)
Show flash(查看內存信息,查看內存中的IOS文件)
Show version (查看版本信息,查看當前配置寄存器的值)
Show ip arp (查看緩存的ARP信息)
Show ip protocols (查看路由協議配置)

Debug命令:

Router#debug ip rip (打開RIP協議調試命令)

查看BGP update更新過程的命令:
Router# debug ip BGP updates
在一個穩定的網絡,使用這條命令可能不能立即看到包,立即看到可以使用Clear ip BGP *,使之生效。

Router(config-router)#debug ip BGP events (查看建立過程的命令)


本文來自 jieli 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/jieli/article/details/65437322?utm_source=copy

路由配置命令