Mar 8, 2008

BGP Authentication cause stuck TCP session

最近在練習MBGP時注意到一件特別的事情,那就是當你設定BGP password之後,仍然會一直出現warning message如下:

*Mar 1 00:53:07.259: %TCP-6-BADAUTH: No MD5 digest from to

後來查了一下相關文件,原來是TCP session因為設置密碼之後有一個session被卡住了,此時可以利用指令"show tcp brief"來檢查,看看是否有一個TCP session停留在FINWAIT:

R2#sh tcp brief
TCB Local Address Foreign Address (state)
655726BC ESTAB

然後請執行指令"clear tcp tcb"後面加上該TCP session的TCB代碼即可清除這個TCP session:

R2#clear tcp tcb 6577E2A0

Mar 7, 2008

Gratuitous ARP

很多人看到這個名詞大都無法了解它跟一般的ARP有何不同,最簡單的說明就是這個Gratuitous(無償的;免費的) ARP在Layer3 IP Header中SA(來源IP位址)&DA(目的IP位址)欄位的內容都是自己的IP;而一般的ARP在Layer3 Header中SA欄位是自己的IP位址,DA欄位則是255.255.255.255(廣播)。在Layer2 Header中的MAC兩者則是相同的,SA欄位是自己的MAC,DA欄位是FFFF-FFFF-FFFF(廣播)。在同網段上的設備收到ARP Request之後就會把Layer2, Layer3 Header解封裝(De-Encapsulation)之後查看ARP Request資訊中查詢的目的地IP位址來決定是否進行ARP Reply。

Gratuitous ARP最主要的目的可分為兩大類.

2.當系統重新啟動時或是網路卡重置時,可以透過Gratuitous ARP通知同網段中的其他設備新的IP與MAC的對應關係

Gratuitous ARP could mean both gratuitous ARP request or gratuitous ARP reply. Gratuitous in this case means a request/reply that is not normally needed according to the ARP specification (RFC 826) but could be used in some cases. A gratuitous ARP request is an AddressResolutionProtocol request packet where the source and destination IP are both set to the IP of the machine issuing the packet and the destination MAC is the broadcast address ff:ff:ff:ff:ff:ff. Ordinarily, no reply packet will occur. A gratuitous ARP reply is a reply to which no request has been made.

Gratuitous ARPs are useful for four reasons:

1. They can help detect IP conflicts. When a machine receives an ARP request containing a source IP that matches its own, then it knows there is an IP conflict.

2. They assist in the updating of other machines' ARP tables. Clustering solutions utilize this when they move an IP from one NIC to another, or from one machine to another. Other machines maintain an ARP table that contains the MAC associated with an IP. When the cluster needs to move the IP to a different NIC, be it on the same machine or a different one, it reconfigures the NICs appropriately then broadcasts a gratuitous ARP reply to inform the neighboring machines about the change in MAC for the IP. Machines receiving the ARP packet then update their ARP tables with the new MAC.

3. They inform switches of the MAC address of the machine on a given switch port, so that the switch knows that it should transmit packets sent to that MAC address on that switch port.

4. Every time an IP interface or link goes up, the driver for that interface will typically send a gratuitous ARP to preload the ARP tables of all other local hosts. Thus, a gratuitous ARP will tell us that that host just has had a link up event, such as a link bounce, a machine just being rebooted or the user/sysadmin on that host just configuring the interface up. If we see multiple gratuitous ARPs from the same host frequently, it can be an indication of bad Ethernet hardware/cabling resulting in frequent link bounces.


The networking stack in many operating systems will issue a gratuitous ARP if the IP or MAC address of a network interface changes, to inform other machines on the network of the change so they can report IP address conflicts, to let other machines update their ARP tables, and to inform switches of the MAC address of the machine.

The networking stack in many operating systems will also issue a gratuitous ARP on an interface every time the link to that interface has been brought to the up state. The gratuitous ARP then is used to preload the ARP table on all local hosts of the possibly new mapping between MAC and IP address (for failover clusters that do not take over the MAC address) or to let the switch relearn behind which port a certain MAC address resides (for failover clusters where you do pull the MAC address over as well or when you simply just move the network cable from one port to another on a normal nonclustered host)

The High-Availability Linux Project utilizes a command-line tool called send_arp to perform the gratuitous ARP needed in their failover process. A typical clustering scenario might play out like the following:

Two nodes in a cluster are configured to share a common IP address Node A has a hardware address of 01:01:01:01:01:01 and node B has a hardware address of 02:02:02:02:02:02.

Assume that node A currently has IP address already configured on its NIC. At this point, neighboring devices know to contact using the MAC 01:01:01:01:01:01.

Using the heartbeat protocol, node B determines that node A has died.

Node B configures a secondary IP on an interface with ifconfig eth0:1

Node B issues a gratuitous ARP with send_arp eth0 02:02:02:02:02:02 All devices receiving this ARP update their table to point to 02:02:02:02:02:02 for the IP address

Example Traffic

Ethernet II, Src: 02:02:02:02:02:02, Dst: ff:ff:ff:ff:ff:ff
Destination: ff:ff:ff:ff:ff:ff (Broadcast)
Source: 02:02:02:02:02:02 (02:02:02:02:02:02)
Type: ARP (0x0806)
Trailer: 000000000000000000000000000000000000
Address Resolution Protocol (request/gratuitous ARP)
Hardware type: Ethernet (0x0001)
Protocol type: IP (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: request (0x0001)
Sender MAC address: 02:02:02:02:02:02 (02:02:02:02:02:02)
Sender IP address: (
Target MAC address: ff:ff:ff:ff:ff:ff (Broadcast)
Target IP address: (
0000 ff ff ff ff ff ff 02 02 02 02 02 02 08 06 00 01 ................
0010 08 00 06 04 00 01 02 02 02 02 02 02 c0 a8 01 01 ................
0020 ff ff ff ff ff ff c0 a8 01 01 00 00 00 00 00 00 ................
0030 00 00 00 00 00 00 00 00 00 00 00 00 ............

ADSL vs Cable Modem 網路架構圖比較

由於ICND1教材中的ADSL/Cable Modem網路架構圖過於簡略,可能有些地方會讓不少同學仍然看不出所以然,甚至可能會被誤導成錯誤的觀念。因此我繪製了以下的圖片提供給各位參考,為了確定網路架構的正確性也特地請教了這兩方面領域的實務專家,所以這兩張圖片應該是相當正確的內容,如果仍有任何不正確的地方也歡迎指正批評,謝謝!


Cable Modem網路硬體元件架構

Mar 4, 2008


這是一篇ITHOME上發表的文章,內容淺顯易懂,相當適合Cisco初學者入門所需,不過相關基本內容尚嫌不足(如只介紹Setup Mode但未介紹Privilege/Configuration Mode,只談到Rollover Cable但是未提到Straight-Through/Cross-Over Cable),僅供參考!

文/楊啟倫 (記者) 2008-03-02

IOS(Internetwork Operating System)是Cisco所開發的網路設備作業系統。使用IOS作為作業系統的Cisco設備,一般來說,以路由器和交換器兩種類型為代表。最早的IOS是在1987年,由William Yeager撰寫,目前最新版本的IOS是12.0。

Internetwork Operating System
IOS(Internetwork Operating System)是Cisco所開發的網路設備作業系統,最早的IOS是在1987年,由William Yeager撰寫,目前最新版本的IOS是12.0。




舉例來說,一個檔名為「c2500-is-l.123.22.bin」的IOS檔案,從IOS檔案名稱從最前方的c2500字串,我們可以知道這是適用於2500系列路由器的IOS,「is-l」指出此IOS具備了那些功能,123.22則是代表版本編號,意為IOS 12.3版,至於最末端的22,則可解釋成此版本IOS的第22個維護版本。文⊙楊啟倫

Catalyst Operation System
CatOS(Catalyst Operating System)主要使用在一些型號較早的Cisco交換器。它的前身是Crescendo Communications開發的「XDI」作業系統,1993年Cisco收購該公司之後,就將XDI更名為Catalyst Operating System。


Native IOS
Native IOS就是一般我們所泛稱的IOS,目前新推出的Cisco網路設備,大多是以Native IOS作為底層的作業系統。

CLI(Command Line Interface)是IOS的標準設定方式,我們必須使用Rollover Cable連接電腦與設備,才能開啟終端機介面,並以輸入指令的方式管理設備;IOS的指令集允許使用者以簡寫的方式輸入指令,換句話說,在IOS可辨識的情況下,隨使用者習慣任意縮短。

Command Line Modes
IOS的CLI(Command Line)可以簡略分成4種主要的操作模式:User Exec Mode、Privilege Exec Mode、Global Configure Mode,以及Interface Configure Mode。

User Exec Mode只能用來查看設備目前的運作狀態,Privilege Exec Mode可以進行一些簡單的設定,Global Configure Mode允許使用者對設備進行全面性的設定,至於Interface Configure Mode則是用來設定特定的介面功能。

Rollover Cable (Console Cable)
Cisco原廠的Rollover Cable,外觀和一般用來連接網路設備的DB9接頭RS232線材不同,線材的一端是RJ45接頭,用來連接設備,另外一端則是DB9公接頭,用來連接電腦,中間的線材主體呈扁平狀,實質上是一條網路線。

Rollover Cable可以自行製作,將網路線的2端各別依照白橘、橘、白藍、藍、白綠、綠、白棕、棕,以及相反的順序排列,然後接到RJ45轉DB9的轉接頭即可使用。

Trivial File Transfer Protocol
TFTP(Trivial File Transfer Protocol)是一種經常被網路設備使用的檔案傳輸協定。和傳統的FTP協定相比,它的特色在於省略了帳號驗證的步驟,只要成功連接伺服器,就可以存取檔案。



當使用者在設備的CLI做完設定之後,必須執行copy running-config startup-config,將設定寫入Startup-Config,否則設備一旦關機,先前所做的各項設定將會消失不見。


在CLI的文字介面下,欲將一臺使用IOS的Cisco網路設備還原成預設值,方法就是執行erase startup-config,透過刪除Running-Config的方式,清除設備的各項設定。

Setup Mode
一臺全新出廠,或者是回復成預設值的Cisco設備,本身不帶有Startup-Config,因此在初次啟動時,會進入Setup Mode,也就是以設定精靈的方式,在CLI的文字介面下快速引導使用者完成一份Startup-Config設定檔。

Setup Mode主要以問答方式讓使用者進行設定,對於熟悉Cisco設備操作的人來說,一般都會略過這個步驟,直接進入Privilege Mode、Global Mode模式設定功能。

AUX Port