Quantcast
Channel: Network – Benjr.tw
Viewing all articles
Browse latest Browse all 56

TCP / IP 的錯誤

$
0
0

在開始 TCP / IP 的錯誤前,我們先來看看 TCP / IP 是怎麼建立連線的,TCP 是透過三方交握 (TCP 3-way handshake) 的方式,也就是 Server 與 Client 需要 3 次的溝通,才會開始進行資料的傳輸,這步驟如下:

  1. Client 用戶端向 Server 伺服器發送一個 "SYN" 訊息,跟 Server 伺服器請求連線.
  2. 如果 Server 伺服器準備好與 Client 用戶端連線,就會回傳一個 "SYN-ACK" 的訊息.
  3. 如果 Client 用戶端接受到剛剛的 "SYN-ACL" 而且也準備好,就會向 Server 伺服器發送一個 "ACK"訊號,讓 Server 伺服器知道現在要開始傳送資料了.

接下來即開始資料的傳送,Client 用戶端每送一筆資料 Server 伺服器收到資料都會回傳給 Client 用戶端一個 ACK 訊號.但這樣未免太沒效率,所以通常會一次傳送多筆資料過去,這就是 TCP Sliding Window.

因為這樣的機制,所以 TCP / IP 在傳送與接收會因為網路上的干擾而產生錯誤,這些錯誤都會一一被記錄下來,透過 #ifconfig , #ip , #ethtool 這幾個指令可以查出錯誤的統計資料.

#ifconfig
先來看 #ifconfig 會顯示哪一些錯誤.

root@benjr:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:dd:6c:5b
          inet addr:192.168.42.254  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fedd:6c5b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4491 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2377 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5380620 (5.3 MB)  TX bytes:199243 (199.2 KB)

上面的統計資料可以分為 RX(Receive 接收) / TX(Transmit 傳送)

  • RX / TX packets – 這個網路裝置從開機後所 RX / TX 的封包總數量.
  • RX / TX errors – 這個網路裝置從開機後所 RX / TX 有發生錯誤的總數量.
  • RX / TX dropped – 這個網路裝置從開機後所 RX / TX 有發生封包被丟棄的總數量.
  • RX / TX overrun – ring size (或是 ring buffer) 是網路卡所需要的一塊記憶體空間,藉由增加網路介面接收信號緩衝區( ring size , ring buffer )
    而 overruns 就是封包 RX / TX 已經來不及處理了,通常這種問題發生在:網路卡本身,驅動程式,PC 負載太重…
  • RX frame – frame 已經 misaligned (錯位,順序不對了)
  • TX carrier – 這個似乎是網路底層的錯誤 (link media failures).

IP
比剛剛的 #ifconfig , #ip 還多了一些資訊可以查看.

root@benjr:~# ip -s link ls eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 08:00:27:dd:6c:5b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    5376554    4448     0       0       0       87
    RX errors: length  crc     frame   fifo    missed
               0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    194815     2344     0       0       0       0
    TX errors: aborted fifo    window  heartbeat
               0        0       0       0
  • RX mcast – 這個網路裝置從開機後所收到的多點傳送 (Multicast) 封包.
  • TX collsns – 這個網路裝置從開機後所傳送遇到碰撞 (collision) 的次數.

Error 還有細分為
RX errors: length , crc , frame , fifo , missed
TX errors: aborted , fifo , window , heartbeat

ethtool
透過 #ifconfig , #ip 能知道 Errors 有限,這時候可以透過 #ethtool 就更清楚知道是哪一些錯誤了.

root@benjr:~# ethtool -S eth0
NIC statistics:
     rx_packets: 4529
     tx_packets: 2654
     rx_bytes: 5395609
     tx_bytes: 211341
     rx_broadcast: 216
     tx_broadcast: 3
     rx_multicast: 19
     tx_multicast: 54
     rx_errors: 0
     tx_errors: 0
     tx_dropped: 0
     multicast: 19
     collisions: 0
     rx_length_errors: 0
     rx_over_errors: 0
     rx_crc_errors: 0
     rx_frame_errors: 0
     rx_no_buffer_count: 0
     rx_missed_errors: 0
     tx_aborted_errors: 0
     tx_carrier_errors: 0
     tx_fifo_errors: 0
     tx_heartbeat_errors: 0
     tx_window_errors: 0
     tx_abort_late_coll: 0
     tx_deferred_ok: 0
     tx_single_coll_ok: 0
     tx_multi_coll_ok: 0
     tx_timeout_count: 0
     tx_restart_queue: 0
     rx_long_length_errors: 0
     rx_short_length_errors: 0
     rx_align_errors: 0
     tx_tcp_seg_good: 1
     tx_tcp_seg_failed: 0
     rx_flow_control_xon: 0
     rx_flow_control_xoff: 0
     tx_flow_control_xon: 0
     tx_flow_control_xoff: 0
     rx_long_byte_count: 5395609
     rx_csum_offload_good: 0
     rx_csum_offload_errors: 0
     alloc_rx_buff_failed: 0
     tx_smbus: 0
     rx_smbus: 0
     dropped_smbus: 0

Viewing all articles
Browse latest Browse all 56

Trending Articles


Girasoles para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tagalog Quotes About Crush – Tagalog Love Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Tagalog Quotes To Move on and More Love Love Love Quotes


5 Tagalog Relationship Rules


Best Crush Tagalog Quotes And Sayings 2017


Re:Mutton Pies (lleechef)


FORECLOSURE OF REAL ESTATE MORTGAGE


Sapos para colorear


tagalog love Quotes – Tiwala Quotes


Break up Quotes Tagalog Love Quote – Broken Hearted Quotes Tagalog


Patama Quotes : Tagalog Inspirational Quotes


Pamatay na Banat and Mga Patama Love Quotes


Tagalog Long Distance Relationship Love Quotes


BARKADA TAGALOG QUOTES


“BAHAY KUBO HUGOT”


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.