TWI317585B - System and method for testing the transmission speed of network interface cards - Google Patents

System and method for testing the transmission speed of network interface cards Download PDF

Info

Publication number
TWI317585B
TWI317585B TW95138104A TW95138104A TWI317585B TW I317585 B TWI317585 B TW I317585B TW 95138104 A TW95138104 A TW 95138104A TW 95138104 A TW95138104 A TW 95138104A TW I317585 B TWI317585 B TW I317585B
Authority
TW
Taiwan
Prior art keywords
network card
transmission speed
module
address
virtual
Prior art date
Application number
TW95138104A
Other languages
Chinese (zh)
Other versions
TW200820671A (en
Inventor
Mo-Ying Tong
Original Assignee
Hon Hai Prec Ind Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW95138104A priority Critical patent/TWI317585B/en
Publication of TW200820671A publication Critical patent/TW200820671A/en
Application granted granted Critical
Publication of TWI317585B publication Critical patent/TWI317585B/en

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Description

1317585 * 九、發明說明: ’'【發明所屬之技術領域】 ' 本發明涉及一種電腦週邊設備測試系統及方法,特別 涉及一種網卡傳輸速度測試系統及方法。 【先前技術】 隨著電腦網路的不斷發展,越來越多的人接觸到網 路。區域網路屬於電腦網路中的一種,係一個提供資料交 換、資源分享的網路系統。而組成區域網路的主要設備之 ® —就係網卡。網卡,也叫網路介面卡(Network Interface1317585 * IX. Description of the invention: ''Technical field to which the invention pertains'' The present invention relates to a computer peripheral device testing system and method, and more particularly to a network card transmission speed testing system and method. [Prior Art] With the continuous development of computer networks, more and more people are exposed to the Internet. A local area network is one of the computer networks. It is a network system that provides data exchange and resource sharing. The ® of the main equipment that makes up the regional network is the network card. Network card, also known as network interface card (Network Interface

Card),其為電腦之間的資料通訊提供物理連接。 網卡的工作原理就係整理電腦發往網路的資料並將 資料分解為適當大小的資料包,然後把它們發送到網路 中,同時也可以接受從網路中傳輸過來的資料包。具體而 言,發送資料時,網卡首先偵聽介質上是否有載波(載波 由電壓指示),如果有,則認為其他站點正在傳送資訊,繼 φ 續偵聽介質。一旦通信介質在一定時間段内(稱為框間缝 隙IFG=9.6微秒)係安靜的,即沒有被其他站點佔用,則 開始進行框資料發送,同時繼續偵聽通信介質,以檢測衝 突。在發送資料期間,如果檢測到衝突,則立即停止該次 發送,並向介質發送一個“阻塞”信號,告知其他站點已經 發生衝突,從而丟棄那些可能一直在接收的受到損壞的框 資料,並等待一段隨機時間(CSMA/CD確定等待時間的 演算法是二進位指數退避演算法)。在等待一段隨機時間 後,再進行新的發送。如果重傳多次後(大於16次)仍發 1317585 生衝突,毅棄發送。純時,網卡流覽介質上傳輸的每 個框,如果其長度小於64位元組,則認為是衝突碎片。如 果接收到的框不是衝突碎片且目的位址是本地位址,則對 框進行兀整性k驗,如果框長度大於1518位元組(稱為超 長框)戈未月b通過迴圈几餘石馬校驗(CyCiic Redundancy Check ’簡稱CRC) ’則認為該框發生了畸變。通過校驗的 框被認為係有效的,網卡將它接收下來進行本地處理。 網卡係電腦必不可少的基本設備,網卡出現故障不只 是影響了工作站本身,還常常影響到整個網路的正常運 行。因此,在出廠之前有必要對網卡傳輸速度進行測試。 目前對於網卡的測試方法主要採用伺服器/用戶端架構,即 將飼服器與用戶端透過網卡進行連接,由一方發送資料, 另一方接收資料來進行測試。這種測試方法至少需要兩台 電腦來測試網卡的傳輸速度,造成了測試成本和應用空間 上的不必要浪費。 【發明内容】 鑒於以上内容,有必要提供一種網卡傳輸速度測試系 統及方法,其僅用一台電腦來同時對兩塊網卡傳輪性能進 行測試’並且節省測試成本。 一種網卡傳輸速度測試系統’該系統包括電腦,所述 的電腦還包括第一網卡及第二網卡,同時還配置有虛擬網 卡。所述的電腦包括:網卡配置模組,用於配置第一網卡 及第二網卡的IP位址,配置虚擬網卡的IP位址及Mac 位址’以及將第二網卡設置成潞雜模式;指標設置模組, 1317585 用於設置網卡傳輸速度指標;資料包發送模組,用於债測 虛擬網卡的IP位址及MAC位址,並根據該ip位址及MAc '位址將一定數量的資料包透過第一網卡發送給該虛擬網 卡;資料包捕獲模組,用於透過第二網卡捕獲上述發送給 虛擬網卡的資料包;統計模組,用於統計資料包捕獲模組 捕獲完所有資料包所需的捕獲時間;計算模組,用於根據 所發送的資料包大小及捕獲時間計算第一網卡及第二網卡 連接時的最低網卡傳輸速度;判斷模組,用於判斷該最低 * 網卡傳輸速度是否超過設置的網卡傳輸速度指標。 一種網卡傳輸速度測試方法,其利用電腦對網卡進行 傳輸速度進行測試,所述的電腦還包括第一網卡及第二網 卡,同時還配置有虛擬網卡。該方法包括如下步驟:(a) 配置第一網卡及第二網卡的IP位址’並配置虛擬網卡的 IP位址及MAC位址;(b)將第二網卡設置成混雜模式;(c) 設置網卡傳輸速度指標;(d )债測虛擬網卡的ip位址及 φ MAC位址,並根據該IP位址及MAC位址將一定數量的 資料包透過第一網卡發送給該虛擬網卡;(e)透過第二網 卡捕獲上述發送給虛擬網卡的資料包;(f)統計捕獲完所 有資料包所需的捕獲時間;(g)根據所發送的資料包大小 及捕獲時間計算第一網卡及第二網卡連接時的最低網卡傳 輸速度;(h)判斷該最低網卡傳輸速度是否超過設置的網 卡傳輸速度指標。 相較於習知技術,所述的網卡傳輸速度測試系統及方 法,其透過在Linux系疵中配置虛擬網卡來同時對同一台 1317585 測試高效並且節省 電腦中兩塊網卡的傳輪性能進行測試 測試成本。 【實施方式】Card), which provides a physical connection for data communication between computers. The working principle of the network card is to organize the data sent by the computer to the network and decompose the data into packets of appropriate size, and then send them to the network, and also accept the data packets transmitted from the network. Specifically, when sending data, the network card first listens to whether there is a carrier on the medium (the carrier is indicated by voltage), and if so, it considers that other stations are transmitting information, and then continues to listen to the medium. Once the communication medium is quiet for a certain period of time (referred to as inter-frame slot IFG = 9.6 microseconds), i.e., not occupied by other stations, frame data transmission is initiated while continuing to listen to the communication medium to detect the collision. During the transmission of the data, if a collision is detected, the transmission is immediately stopped, and a "blocking" signal is sent to the medium to inform other stations that a collision has occurred, thereby discarding the corrupted frame data that may have been received, and Waiting for a random time (CSMA/CD determines the latency of the algorithm is the binary exponential backoff algorithm). Wait for a random time before making a new transmission. If there are still 1317585 conflicts after retransmission (more than 16 times), I will send them. In pure time, each frame transmitted on the NIC is considered to be a collision fragment if its length is less than 64 bytes. If the received frame is not a conflicting fragment and the destination address is the local address, the box is subjected to a reconciliation test. If the frame length is greater than 1518 bytes (called a super long box), Ge Weiyue b passes through the loop. The CyCiic Redundancy Check (CRC) is considered to be distorted. The checked box is considered valid and the network card receives it for local processing. The network card is an essential basic device for the computer. The failure of the network card not only affects the workstation itself, but also affects the normal operation of the entire network. Therefore, it is necessary to test the NIC transmission speed before leaving the factory. At present, the test method for the network card mainly adopts the server/user end architecture, that is, the feeding device and the user end are connected through the network card, one party sends the data, and the other party receives the data for testing. This test method requires at least two computers to test the transmission speed of the network card, resulting in unnecessary waste of test costs and application space. SUMMARY OF THE INVENTION In view of the above, it is necessary to provide a network card transmission speed test system and method that uses only one computer to simultaneously test the performance of two network card transmissions' and saves test costs. A network card transmission speed test system 'The system includes a computer, and the computer further includes a first network card and a second network card, and is also configured with a virtual network card. The computer includes: a network card configuration module, configured to configure an IP address of the first network card and the second network card, configure an IP address and a Mac address of the virtual network card, and set the second network card to a noisy mode; Setting module, 1317585 is used to set the network card transmission speed indicator; the data packet sending module is used for the IP address and MAC address of the virtual network card, and a certain amount of data is based on the IP address and the MAc address. The packet is sent to the virtual network card through the first network card; the data packet capture module is configured to capture the data packet sent to the virtual network card through the second network card; and the statistical module is configured to capture all the data packets by the statistical data packet capture module. The required capture time; the calculation module is configured to calculate the minimum network card transmission speed when the first network card and the second network card are connected according to the sent data packet size and the capture time; the determining module is configured to determine the minimum* network card transmission Whether the speed exceeds the set NIC transmission speed indicator. A method for testing a network card transmission speed, which uses a computer to test a transmission speed of a network card. The computer further includes a first network card and a second network card, and is also configured with a virtual network card. The method comprises the following steps: (a) configuring an IP address of the first network card and the second network card and configuring an IP address and a MAC address of the virtual network card; (b) setting the second network card to a promiscuous mode; (c) Setting a network card transmission speed indicator; (d) measuring the ip address of the virtual network card and the φ MAC address, and transmitting a certain number of data packets to the virtual network card through the first network card according to the IP address and the MAC address; e) capturing the above-mentioned data packet sent to the virtual network card through the second network card; (f) counting the capture time required to capture all the data packets; (g) calculating the first network card and the first according to the size of the transmitted data packet and the capture time The minimum network card transmission speed when the second network card is connected; (h) determining whether the minimum network card transmission speed exceeds the set network card transmission speed indicator. Compared with the prior art, the network card transmission speed test system and method, by configuring a virtual network card in a Linux system, simultaneously test and test the same 1317585 efficiency and save the transmission performance of two network cards in the computer. cost. [Embodiment]

!所$ ’係本發明網卡傳輸速度測H统的較 括雷1例的系統架構圖。本較佳實施例的系統架構主要包 右笛^ 1輪入设備3,及輸出設備4。所述的電腦1包括 網卡 11,第二網卡 12,CPU (Central processing Π’中央處理器)13,儲存設備14及匯流排15。所述的 接:t U ’第二網卡12,CPU 13 ’及健存讀14均連 所、,fir排15 ’透過該匯流排15進行資料間的互相傳輸。 ::々、、周卡11及第二網卡12可以係板載網卡,也可 線進行點接網卡11與該第二網卡12透過網 做成六. 連接其中,該進行點對點連接的網線應當 又叉線,即,網線一端是ΤΙΑ/ΕΙΑ 568A標準,從左 =右的芯線卿為:綠白、綠、撥白、藍、藍白、撥、掠 標,網線另一端是TIA/EIA 568B標準,從左到右的 心、’、順序為:橙白、橙、綠白、藍、藍白、綠、棕白、棕。 斤述的電腦1中還裝有Linux作業系統,儲存於儲存設 備14中。所述的Unux作業系統可以係此化霞e,The $ ’ is the system architecture diagram of the LTE network transmission speed measurement system. The system architecture of the preferred embodiment mainly includes a right flute 1 rounding device 3 and an output device 4. The computer 1 includes a network card 11, a second network card 12, a CPU (Central processing Π' central processing unit) 13, a storage device 14, and a bus bar 15. The connection: t U 'the second network card 12, the CPU 13' and the health read 14 are connected, and the fir row 15' transmits the data to each other through the bus 15 . ::々,, Zhouka 11 and the second network card 12 may be connected to the onboard network card, or may be connected to the network card 11 and the second network card 12 through the network. The network cable for the point-to-point connection shall be connected. Also forked, that is, one end of the cable is ΤΙΑ / ΕΙΑ 568A standard, from the left = right core is: green white, green, white, blue, blue and white, dial, grazing, the other end of the cable is TIA / EIA 568B standard, left to right heart, ', order: orange white, orange, green white, blue, blue white, green, brown white, brown. The computer 1 of the computer 1 is also equipped with a Linux operating system and stored in the storage device 14. The Unux operating system can be used to make this chemistry,

Redhat,Suse,TurboLinux,Debian,XteamLinux,Redhat, Suse, TurboLinux, Debian, XteamLinux,

BluePoint’紅旗Linux等。由於Linux内核採用回環通道, 在同一電腦上兩網卡之間進行資料通訊時,資料包直接透 過網路層傳輸,而不會傳輸到資料連結層、物理層來透過 實際的網卡傳輸。因此在本較佳實施例中,還配置有虛擬 1317585 網卡21,讓資料包經由第一網卡11傳輪給非本機的虛擬 網卡21,並透過第二網卡12來捕獲該資料包。 所述的輸入設備3,主要包括鍵盤及滑鼠,用於接收操 作者相關輸入資訊。所述的輸出設備4,主要包括顯示器, 用於顯不操作者相關輸入資訊及測试結果資訊等。所述的 儲存設備14’主要包括硬碟及記憶體’用於儲存Linux作 業系統及所捕獲的資料包等。 參閱圖2所示,係圖1中電腦的功能模組圖。該電腦工 I 包括網卡配置模組110,指標設置模組120 ’線程創建模組 130,資料包發送模組140,資料包捕獲模組150,統計模 組160,計算模組170,及判斷模組180。 所述的網卡配置模組110,用於配置第一網卡11及第 二網卡12的IP (Internet Protocol,網際協議)位址,以及 用於配置虛擬網卡21的IP位址及MAC ( Message Authentication Code,資訊證實代碼)位址。在本較佳實施 φ 例中,所述的第一網卡11、第二網卡12及虛擬網卡21的 IP位址應當配置在一個網段内。例如,可以將第一網卡11 的IP位址設置成192.168.0.1,將第二網卡12的IP位址設 置成192.168.0.2,將虛擬網卡21的IP位址分別設置成 192.168.0.254。所述的第一網卡11及第二網卡12是電腦 1中實際存在的網卡,本身有一個固定的MAC位址。所述 的MAC位址就係在媒體接入層上使用的位址,也叫物理 位址、硬體位址或鏈路位址’由網路設備製造商生產時寫 在硬體内部,MAC位址通常表示為12個16進制數,如 1317585 00:D0:F8:0A:FB:83。在本較佳實施例中,所配置的虛幾網 •卡21的MAC位址應當不同於第一網卡11及第二網卡12 •的MAC位址。戶斤述的網卡配置模組110還用於將第二網 卡12設置成混雜槔式。一般來說,網卡有四種接收模式: 廣播方式、組播方式、直接方式、及混雜模式。在混雜模 式下,該第二網+ 12能夠捕獲一切透過它的資料包,而不 管該資料包的目的地址是否為該第二網卡12,也即,該第 二網卡12會捕獲從第一網卡11發送給虛擬網卡21的所有 資料包。 所述的指標级ί模組I20,用於設置網卡傳輸速度指 標。其中,所述的傳輸速度指標係判斷網卡傳輸性能是否 合格的最低傳輸速度指標’只要所測試的傳輸速度超過了 該傳輸速度指標,則表示所測試的網卡合格。 所述的線輕刻建模組130 ’用於創建偵聽子線程及發 送子線程。所述的摘聽子線程用於分配CPU 13時間片來 給資料包捕押模解及統计核組160進行執行’所述的 發送子線程用於分齡CPU 13時間片來給資料包發送模組 140進行執行。在其他較佳實施例中’也可以不創建镇聽 子線程及發送子線择,直接透過進程分配CPU 13時間片 來給資料包發送模解140、資料包捕獲模組150及統計模 組160進行執行。其中’進程是資源分配的基本單位。所 有與該進程有關的資源’都被記錄在進程控制塊PCB中。 與進程相對應,瘃择與資源分配無關,它屬於某一個進程, 並與進程内的其他線程一起共用進程的資源。線程只由相 11 1317585 關堆疊(祕棧或用戶棧)寄翻和線程式控制製表τ⑶ 組成。當進程發生調度時’不同的進程擁有不同的虛擬位 •址空間’而同-進程内的不同線程共用同一位址空間。因 此,相較於進程,本實施例中採用創建债聽子線程及發送 子線程分配CPU I3時間片的方式給資料包發送模組 140、資料包捕獲模組15G及統計模組16〇進行執行具有更 快的處理效率。 〃 所述的資料包發送模組14G,用於彳貞測虛擬網卡21的 IP位址及MAC位址,並根據該Ip位址及MAc位址將一 定數量的資料包透萄1卡11發送給虛擬網卡21。通 常’在網路傳輸過財,資料包的長度在64〜1518位元电 (Byte)之PH本較佳實施财,#料包發送模組14〇 所發送的資料包的長度不應過小,由於資料包透過第一網 卡11傳輸出去之前要經過應用層、表示層、會話層、傳輪 層、網路層、資料連結層的封裝並加上相應的頭部和尾部, 因此,右資料包長度過小’資料包頭部或尾部就會相對過 大而降低測量的精確度。在本較佳實施例中,資料包發送 模組140總共發送20000個資料包,每個資料包的長度 1440 Byte。 所述的資料包捕獲模組15G,詩捕獲透過第二網卡 12的所有欠資料包,也即,經由第一網卡11發送給虛擬網 t 21的資料包。所述的資料包捕獲模組15〇還將所捕獲的 資料包儲存到儲存設備14中。 所述的統計模組16〇,用於統計資料包捕獲模組15〇 12 1317585 捕獲完所有資料包所需的捕獲時間。所述的統計捕獲時間 '是從資料包捕獲模組150捕獲到第一個資料包時開始統 •計,直到捕獲完最後一個資料包時結束。 所述的計算模組170,用於計算第一網卡11及第二網 卡12連接時的最低網卡傳輸速度。其中,所述的計算的方 法為:最低網卡傳輸速度等於資料包發送模組140所發送 的資料包個數乘以每個資料包長度,再除以統計模組160 所統計的捕獲時間。例如,若統計模組160所統計出的捕 獲時間為0.25秒(S),則 20000*1440^ 傳輸速度= 0^255 =115200000 B/S, 115200000 也即,1024*1024MB/S=109.8633 MB/S。 所述的判斷模組180,用於判斷計算模組170所計算 出的最低網卡傳輸速度是否超過參數設置模組120所設置 的網卡傳輸速度指標。其中,若判斷模組180所計算的最 低網卡傳輸速度超過參數設置模組120所設置的網卡傳輸 速度指標,則表示該第一網卡11及第二網卡12傳輸性能 合格;若判斷模組180所計算的最低網卡傳輸速度不超過 參數設置模組120所設置的網卡傳輸速度指標,則表示該 第一網卡11或第二網卡12傳輸性能不合格,需更換另一 塊網卡重新進行測試。例如,若參數設置模組120所設置 的網卡傳輸速度指標為98 MB/S,則上述所測試的最低網 13 1317585 卡傳輸速度109.8633 MB/S > 98 MB/S ’也即’所述的第一 網卡11及第二網卡12傳輸性能合格。 參閱圖3所示,係網卡傳輸速度測試方法的較佳實施 例的流程圖。首先’步驟S11,網卡配置模組110配置第 一網卡11及第二網卡12的IP位址,配置虛擬網卡21的 IP位址及MAC位址,並將第二網卡12設置成混雜模式。 其中,所述的第一網卡11、第二網卡12及虛擬網卡21的 IP位址應當配置在一個網段内。所述的虛擬網卡21的 MAC位址應當不同於第一網卡11及第二網卡12的MAC 位址。 步驟S12,指標設置模組120設置網卡傳輸速度指標。 其中’所述的傳輸速度指標係判斷網卡傳輸性能是否合格 的最低傳輸速度指標’只要所測試的傳輸速度超過了該傳 輸速度指標,則表示所測試的網卡合格。 步驟S13,線程創建模組ι3〇創建偵聽子線程及發送子 線程。 步驟S14 ’資料包發送模組14〇偵測虛擬網卡21的ιρ 位址及MAC位址,並根據該Ip位址及mac位址將一定 數量的資料包透過第一網卡U發送給虛擬網卡21。其中, 步驟S14係透過發送子線程分配cpu 13時間片來進行執 行的。通常’在網路傳輪過程中,資料包的長度在64〜1518 位元組(Byte)之間。資料包發送模組ι4〇所發送的資料 包的長度不應過小,在本較佳實施例中,所發送的的資料 包長度為1440Byte。 1317585 步驟S15,資料包捕獲模組15〇捕獲透過第二網卡12 的所有資料包,並將所捕獲的資料包儲存到儲存設備14 中^同時統計模組160統計資料包捕獲模組15()捕獲完所 有資料包所需的捕獲時間。其中,步驟S15係透過偵聽子 線程分配CPU 13時間片來進行執行的。 步驟S16,計算模組170計算第一網卡u及第二網卡 12連接時的最低網卡傳輸速度。其中,所述的計算的方法 為:最低網卡傳輸速度等於所發送的資料包個數乘以資料 包長度,再除以捕獲時間。 步驟S17,判斷模組180判斷步驟S16所計算出的最低 網卡傳輪速度是否超過步驟S12所設置的網卡傳輸速度指 標。 步驟S18,若步驟S17判斷出最低網卡傳輪速度超過了 網卡傳輸速度指標,則該第一網卡n及第二網卡12傳輸 性能合格。 步驟S19,若步驟sl7判斷出最低網卡傳輪速度不超 過網卡傳輸速度指標,則該第一網卡U或第二網卡12傳 輸性能不合格,需更換另一塊網卡重新進行測試。 【圖式簡單說明】 圖1係本發明網卡傳輸速度測試系統的較佳實施例的 系統架構圖。 圖2係圖1中電腦的功能模組圖。 圖3係本發明網卡傳輸速度測試方法的較佳實施例的 流程圖。 15 1317585 【主要元件符號說明】BluePoint’ Red Flag Linux and more. Since the Linux kernel uses a loopback channel, when data is exchanged between two network cards on the same computer, the data packets are transmitted directly through the network layer, and are not transmitted to the data link layer or the physical layer to be transmitted through the actual network card. Therefore, in the preferred embodiment, a virtual 1317585 network card 21 is further disposed, and the data packet is transferred to the non-native virtual network card 21 via the first network card 11, and the data packet is captured through the second network card 12. The input device 3 mainly includes a keyboard and a mouse for receiving input information related to the operator. The output device 4 mainly includes a display for displaying operator-related input information and test result information. The storage device 14' mainly includes a hard disk and a memory device for storing a Linux operating system and captured data packets. Referring to Figure 2, it is a functional module diagram of the computer in Figure 1. The computer worker I includes a network card configuration module 110, an indicator setting module 120' thread creation module 130, a data packet sending module 140, a data packet capturing module 150, a statistical module 160, a computing module 170, and a judgment module. Group 180. The network card configuration module 110 is configured to configure an IP (Internet Protocol) address of the first network card 11 and the second network card 12, and an IP address and a MAC address for configuring the virtual network card 21 (Message Authentication Code) , information verification code) address. In the preferred embodiment of the present invention, the IP addresses of the first network card 11, the second network card 12, and the virtual network card 21 should be configured in one network segment. For example, the IP address of the first network card 11 can be set to 192.168.0.1, the IP address of the second network card 12 can be set to 192.168.0.2, and the IP address of the virtual network card 21 can be set to 192.168.0.254. The first network card 11 and the second network card 12 are network cards actually existing in the computer 1, and have a fixed MAC address. The MAC address is the address used on the media access layer, also called the physical address, hardware address or link address. When written by the network equipment manufacturer, it is written inside the hardware, MAC bit. The address is usually expressed as 12 hexadecimal numbers, such as 1317585 00: D0: F8: 0A: FB: 83. In the preferred embodiment, the MAC address of the configured virtual network card 21 should be different from the MAC address of the first network card 11 and the second network card 12. The network card configuration module 110 of the user is also used to set the second network card 12 to be a hybrid type. In general, NICs have four receiving modes: broadcast mode, multicast mode, direct mode, and promiscuous mode. In the promiscuous mode, the second network + 12 can capture all packets passing through it, regardless of whether the destination address of the data packet is the second network card 12, that is, the second network card 12 captures the first network card. 11 All packets sent to the virtual network card 21. The indicator level module I20 is used to set a network card transmission speed indicator. Wherein, the transmission speed indicator is a minimum transmission speed indicator for determining whether the network card transmission performance is qualified. If the tested transmission speed exceeds the transmission speed indicator, it indicates that the tested network card is qualified. The line slick modeling group 130' is used to create a listening sub-thread and a sending sub-thread. The listening sub-thread is used to allocate the CPU 13 time slice to perform the packet capture mode and the statistical core group 160 to execute. The sending sub-thread is used for the age-old CPU 13 time slice to send the data packet. The module 140 performs execution. In other preferred embodiments, the parental thread and the sending sub-line may not be created, and the CPU 13 time slice is directly allocated through the process to send the template 140, the packet capture module 150, and the statistics module 160 to the data packet. Execute. The 'process' is the basic unit of resource allocation. All resources related to this process are recorded in the process control block PCB. Corresponding to the process, the decision has nothing to do with resource allocation. It belongs to a certain process and shares the resources of the process with other threads in the process. The thread consists only of the phase stacking (the stack or the user stack) and the threaded control tab τ(3). When a process is scheduled, 'different processes have different virtual bit addresses' and different threads within the same process share the same address space. Therefore, compared with the process, in this embodiment, the packet sending module 140, the packet capturing module 15G, and the statistic module 16 are executed in a manner of creating a debt listening sub-thread and transmitting a sub-thread to allocate a CPU I3 time slice. Faster processing efficiency. The packet sending module 14G is configured to detect the IP address and the MAC address of the virtual network card 21, and send a certain number of data packets to the card 1 according to the IP address and the MAc address. Give virtual network card 21. Usually, the length of the data packet is 64~1518 Bytes, and the length of the data packet is better. The length of the data packet sent by the packet sending module 14〇 should not be too small. Since the data packet is transmitted through the first network card 11 through the application layer, the presentation layer, the session layer, the transport layer, the network layer, and the data link layer, and the corresponding header and tail are added, the right packet is If the length is too small, the head or tail of the packet will be relatively large and the accuracy of the measurement will be reduced. In the preferred embodiment, the packet transmission module 140 transmits a total of 20,000 data packets, each of which has a length of 1440 Bytes. The packet capture module 15G captures all of the owed packets that pass through the second NIC 12, that is, the packets sent to the virtual network 214 via the first NIC 11. The packet capture module 15 〇 also stores the captured data packets into the storage device 14. The statistical module 16〇 is used for the capture time required by the statistical packet capture module 15〇 12 1317585 to capture all the data packets. The statistical capture time ' begins when the first packet is captured by the packet capture module 150 and ends when the last packet is captured. The computing module 170 is configured to calculate a minimum network card transmission speed when the first network card 11 and the second network card 12 are connected. The calculation method is as follows: the minimum network card transmission speed is equal to the number of data packets sent by the data packet sending module 140 multiplied by the length of each data packet, and divided by the capture time counted by the statistical module 160. For example, if the capture time counted by the statistics module 160 is 0.25 seconds (S), then the 20000*1440^ transmission speed = 0^255=115200000 B/S, 115200000, that is, 1024*1024MB/S=109.8633 MB/ S. The determining module 180 is configured to determine whether the lowest network card transmission speed calculated by the computing module 170 exceeds the network card transmission speed indicator set by the parameter setting module 120. If the lowest network card transmission speed calculated by the module 180 exceeds the network card transmission speed indicator set by the parameter setting module 120, it indicates that the first network card 11 and the second network card 12 have passed the transmission performance; If the calculated minimum network card transmission speed does not exceed the network card transmission speed indicator set by the parameter setting module 120, it indicates that the transmission performance of the first network card 11 or the second network card 12 is unsatisfactory, and another network card needs to be replaced for testing. For example, if the network card transmission speed index set by the parameter setting module 120 is 98 MB/s, the above-mentioned lowest network 13 1317585 card transmission speed is 109.8633 MB/S > 98 MB/S 'is also described. The first network card 11 and the second network card 12 have passed the transmission performance. Referring to Figure 3, there is shown a flow chart of a preferred embodiment of a method of testing network card transmission speed. First, in step S11, the network card configuration module 110 configures the IP addresses of the first network card 11 and the second network card 12, configures the IP address and MAC address of the virtual network card 21, and sets the second network card 12 to the promiscuous mode. The IP addresses of the first network card 11, the second network card 12, and the virtual network card 21 should be configured in one network segment. The MAC address of the virtual network card 21 should be different from the MAC address of the first network card 11 and the second network card 12. In step S12, the indicator setting module 120 sets a network card transmission speed indicator. Wherein the transmission speed indicator is a minimum transmission speed indicator for determining whether the network card transmission performance is qualified. If the measured transmission speed exceeds the transmission speed indicator, it indicates that the tested network card is qualified. In step S13, the thread creation module ι3 creates a listening sub-thread and a sending sub-thread. Step S14' The packet sending module 14 detects the address and MAC address of the virtual network card 21, and sends a certain number of data packets to the virtual network card 21 through the first network card U according to the IP address and the mac address. . Step S14 is performed by transmitting a cpu 13 time slice by the sending sub-thread. Usually, during the network pass, the length of the packet is between 64 and 1518 bytes. The length of the data packet sent by the packet transmission module ι4〇 should not be too small. In the preferred embodiment, the length of the transmitted data packet is 1440 Bytes. 1317585 Step S15, the packet capture module 15 captures all the data packets transmitted through the second network card 12, and stores the captured data packets in the storage device 14 and simultaneously counts the statistical module 160 statistical data packet capture module 15 () Capture time required to capture all packages. Step S15 is performed by allocating a CPU 13 time slice through the listening sub-thread. In step S16, the calculation module 170 calculates the lowest network card transmission speed when the first network card u and the second network card 12 are connected. The calculation method is as follows: the minimum network card transmission speed is equal to the number of data packets sent multiplied by the packet length, and divided by the capture time. In step S17, the determining module 180 determines whether the lowest network card transmission speed calculated in step S16 exceeds the network card transmission speed indicator set in step S12. In step S18, if it is determined in step S17 that the lowest network card transmission speed exceeds the network card transmission speed index, the first network card n and the second network card 12 have passed the transmission performance. In step S19, if it is determined in step sl7 that the lowest network card transmission speed does not exceed the network card transmission speed index, the transmission performance of the first network card U or the second network card 12 is unsatisfactory, and another network card needs to be replaced for re-testing. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a system architecture diagram of a preferred embodiment of a network card transmission speed test system of the present invention. Figure 2 is a functional block diagram of the computer of Figure 1. Fig. 3 is a flow chart showing a preferred embodiment of the method for testing the transmission speed of the network card of the present invention. 15 1317585 [Description of main component symbols]

電腦 1 虛擬網卡 21 輸入設備 3 輸出設備 4 第一網卡 11 第二網卡 12 CPU 13 儲存設備 14 匯流排 15 網卡配置模組 110 指標設置模組 120 線程創建模組 130 資料包發送模組 140 資料包捕獲模組 150 統計模組 160 計算模組 170 判斷模組 180Computer 1 Virtual network card 21 Input device 3 Output device 4 First network card 11 Second network card 12 CPU 13 Storage device 14 Bus 15 Network card configuration module 110 Index setting module 120 Thread creation module 130 Packet sending module 140 Data package Capture module 150 statistical module 160 computing module 170 determining module 180

1616

Claims (1)

1317585 十、申請專利範圍 • 1、一種網卡傳輸速度測試系統,該系統包括電腦,所述 . 的電腦包括第一網卡及第二網卡,同時還配置有虛擬 網卡,其中所述的電腦包括: 網卡配置模組,用於配置第一網卡及第二網卡的IP位 址,配置虛擬網卡的IP位址及MAC位址,以及將第 二網卡設置成混雜模式; 指標設置模組,用於設置網卡傳輸速度指標; 資料包發送模組,用於偵測虛擬網卡的IP位址及MAC 位址,並根據該IP位址及MAC位址將一定數量的資 料包透過第一網卡發送給該虛擬網卡; 資料包捕獲模組,用於透過第二網卡捕獲上述發送給 虛擬網卡的資料包, 統計模組,用於統計資料包捕獲模組捕獲完所有資料 包所需的捕獲時間; 計算模組,用於根據所發送的資料包大小及捕獲時間 計算第一網卡及第二網卡連接時的最低網卡傳輸速 度;及 判斷模組,用於判斷該最低網卡傳輸速度是否超過設 置的網卡傳輸速度指標。 2、 如申請專利範圍第1項所述的網卡傳輸速度測試系 統,其中所述的電腦還包括線程創建模組,用於創建 偵聽子線程及發送子線程。 3、 如申請專利範圍第2項所述的網卡傳輸速度測試系 統,其中所述的偵聽子線程用於分配CPU時間片來給 資料包捕獲模組及統計模組執行,所述的發送子線程 用於分配CPU時間片來給資料包發送模組執行。 4、 如申請專利範圍第1項所述的網卡傳輸速度測試系 統,其中所述的第一網卡、第二網卡及虛擬網卡的IP 位址配置在一個網段内,並且虛擬網卡的MAC位址 17 1317585 配置成不同於第一網卡及第二網卡的MAC位址。 .5、如申請專利範圍第1項所述的網卡傳輸速度測試系 統,其中所述的計算模組計算第一網卡及第二網卡^ 接時的最低網卡傳輸速度的方法為:最低網卡傳輸速 度等於所發送的資料包個數乘以資料包長度,再除以 捕獲時間。 6、 如申請專利範圍第1項所述的網卡傳輸速度測試系 統’其中,若該最低網卡傳輸速度超過了網卡傳輸速 度指標,則第一網卡及第二網卡傳輸性能合格。 7、 如申請專利範圍第1項所述的網卡傳輸速度測試系 統’其中,右'該最低網卡傳輸速度不超過網卡傳輸速 度指標’則第一網卡或第二網卡傳輸性能不合格。 8、 一種網卡傳輸速度測試方法,其利用電腦對網卡進行 傳輸速度進行測試’所述的電腦包括第一網卡及第二 網卡,同時還配置有虛擬網卡,其中該方法包括如下 步驟: 配置第一網卡及第二網卡的IP位址,並配置虛擬網卡 的IP位址及MAC位址; 將第二網卡設置成混雜模式; 設置網卡傳輸速度指標; 偵測虛擬網卡的IP位址及MAC位址,並根據該ip 位址及MAC位址將一定數量的資料包透過第一網卡 發送給該虛擬網卡; 透過第二網卡捕獲上述發送給虛擬網卡的資料包; 統計捕獲完所有資料包所需的捕獲時間; 根據所發送的資料包大小及捕獲時間計算第一網卡及 第二網卡連接時的最低網卡傳輸速度;及 判斷該最低網卡傳輸速度是否超過設置的網卡傳輸速 度指標。 9、 如申请專利範圍第8項所述的網卡傳輸速度測試方 18 1317585 法,其中所述的最低網卡傳輸速度等於所發送的資料 包個數乘以資料包長度,再除以捕獲時間。 10、如申請專利範圍第8項所述的網卡傳輸速度測試方 法,其中: 若該最低網卡傳輸速度超過了網卡傳輸速度指標,則 第一網卡及第二網卡傳輸性能合格; 若該最低網卡傳輸速度不超過網卡傳輸速度指標,則 第一網卡或第二網卡傳輸性能不合格。1317585 X. Patent application scope 1. A network card transmission speed test system, the system includes a computer, the computer includes a first network card and a second network card, and is also configured with a virtual network card, wherein the computer includes: a network card The configuration module is configured to configure an IP address of the first network card and the second network card, configure an IP address and a MAC address of the virtual network card, and set the second network card to a promiscuous mode; and an indicator setting module, configured to set the network card a transmission speed indicator; a data packet sending module, configured to detect an IP address and a MAC address of the virtual network card, and send a certain number of data packets to the virtual network card through the first network card according to the IP address and the MAC address The data packet capture module is configured to capture the data packet sent to the virtual network card by using the second network card, and the statistical module is used for collecting the capture time required by the data packet capture module to capture all the data packets; The method is configured to calculate a minimum network card transmission speed when the first network card and the second network card are connected according to the sent packet size and the capture time; and the determining module, Analyzing the lowest card in the card transfer rate exceeds the set transmission speed indicator. 2. The network card transmission speed testing system of claim 1, wherein the computer further comprises a thread creation module for creating a listening sub-thread and a sending sub-thread. 3. The network card transmission speed test system according to claim 2, wherein the listening sub-thread is configured to allocate a CPU time slice to perform execution on a packet capture module and a statistics module, and the sender Threads are used to allocate CPU time slices for module execution. 4. The network card transmission speed test system according to claim 1, wherein the IP addresses of the first network card, the second network card, and the virtual network card are configured in one network segment, and the MAC address of the virtual network card is configured. 17 1317585 is configured to be different from the MAC address of the first network card and the second network card. 5. The network card transmission speed test system according to claim 1, wherein the calculation module calculates the lowest network card transmission speed when the first network card and the second network card are connected: the lowest network card transmission speed Equal to the number of packets sent, multiplied by the length of the packet, divided by the capture time. 6. The network card transmission speed test system described in claim 1 wherein, if the lowest network card transmission speed exceeds the network card transmission speed indicator, the first network card and the second network card have passed the transmission performance. 7. The network card transmission speed test system described in claim 1 of the patent application, wherein the right 'the lowest network card transmission speed does not exceed the network card transmission speed indicator', the first network card or the second network card transmission performance is unqualified. 8. A method for testing a network card transmission speed, which uses a computer to test a transmission speed of a network card. The computer includes a first network card and a second network card, and is also configured with a virtual network card, wherein the method includes the following steps: The IP address of the network card and the second network card, and configure the IP address and MAC address of the virtual network card; set the second network card to promiscuous mode; set the network card transmission speed indicator; detect the IP address and MAC address of the virtual network card And sending a certain number of data packets to the virtual network card through the first network card according to the ip address and the MAC address; capturing the data packet sent to the virtual network card through the second network card; and collecting statistics required for capturing all the data packets Capture time; calculate the lowest network card transmission speed when the first network card and the second network card are connected according to the sent packet size and the capture time; and determine whether the minimum network card transmission speed exceeds the set network card transmission speed indicator. 9. The NIC transmission speed tester 18 1317585 method as claimed in claim 8, wherein the minimum NIC transmission speed is equal to the number of packets sent by the packet length, and divided by the capture time. 10. The method for testing a network card transmission speed according to item 8 of the patent application scope, wherein: if the lowest network card transmission speed exceeds the network card transmission speed indicator, the first network card and the second network card have a good transmission performance; if the minimum network card transmission If the speed does not exceed the NIC transmission speed indicator, the transmission performance of the first NIC or the second NIC is unqualified. 1919
TW95138104A 2006-10-16 2006-10-16 System and method for testing the transmission speed of network interface cards TWI317585B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW95138104A TWI317585B (en) 2006-10-16 2006-10-16 System and method for testing the transmission speed of network interface cards

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW95138104A TWI317585B (en) 2006-10-16 2006-10-16 System and method for testing the transmission speed of network interface cards

Publications (2)

Publication Number Publication Date
TW200820671A TW200820671A (en) 2008-05-01
TWI317585B true TWI317585B (en) 2009-11-21

Family

ID=44770247

Family Applications (1)

Application Number Title Priority Date Filing Date
TW95138104A TWI317585B (en) 2006-10-16 2006-10-16 System and method for testing the transmission speed of network interface cards

Country Status (1)

Country Link
TW (1) TWI317585B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI396403B (en) * 2008-09-04 2013-05-11 Inventec Corp Method for testing switching speed of a network interface card
CN109962824A (en) * 2017-12-26 2019-07-02 新汉股份有限公司 High-speed network appliance and its self test method

Also Published As

Publication number Publication date
TW200820671A (en) 2008-05-01

Similar Documents

Publication Publication Date Title
CN101163051A (en) Network card transmission speed testing system and method
US8391157B2 (en) Distributed flow analysis
Rosen Linux kernel networking: Implementation and theory
CN103929334B (en) Network Abnormal Notification Method and device
EP3082293B1 (en) Switching device and packet loss method therefor
EP2903213B1 (en) Throughput test method and apparatus
JP2005006303A (en) Virtual network address
US8542597B2 (en) Soft error recovery for converged networks
WO2019179384A1 (en) Communication method and related device
JP5932409B2 (en) Metadata capture for inspecting TCP connections
CN112383452B (en) DPDK frame-based DDS data transmission diagnosis method and system
WO2023236905A1 (en) Delay reliability determination method, and access network device and storage medium
CN115174432B (en) RDMA network state monitoring method, device, equipment and readable storage medium
CN109246189B (en) Network data distribution method and device, storage medium and server
US9985864B2 (en) High precision packet generation in software using a hardware time stamp counter
WO2024021495A1 (en) Method and apparatus for identifying flooding attack in cloud platform, and device and storage medium
TWI317585B (en) System and method for testing the transmission speed of network interface cards
CN111404872A (en) Message processing method, device and system
CN1860734A (en) Method and apparatus for network throughput measurement
WO2021114722A1 (en) Switch, loopback diagnosis method and apparatus for management network port thereof, and storage medium
TWI220612B (en) Network physical layer apparatus with smart cable analyzing function and application device thereof
JP4413121B2 (en) Data communication apparatus and data communication method using TCP / IP socket
CN110098982B (en) Link state providing method, device, router and computer readable storage medium
EP4270183A1 (en) Public cloud tenant service management method and device
CN118118433A (en) Message processing method and device applied to DPU, computer equipment and storage medium

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees