計算機網絡實驗 Labexercise1-1 Protocol Layers(Wireshark抓包與協議分析實驗)


計算機網絡實驗 Labexercise1-1 Protocol Layers(Wireshark抓包與協議分析實驗)

本人博客園個人首頁CSDN個人首頁

前言:本博客包含Windows10下安裝wget、Wireshark。
一些有用的鏈接:

一些有用的提示:
開始實驗進行抓包時,校園網環境下的同學不建議使用一些 [ 上網不涉密涉密不上網 ] 的校園網進行抓包,可能會導致抓不到包捏 😃(找了半天bug,氣死我了)

1. 下載安裝wget

參考資料:wget for windows 下載與安裝

點擊此鏈接,選擇合適的版本下載.exe文件,然后把下好的.exe文件放在C:/windows/system32目錄下即可。

wget下載網站

在cmd終端輸入wget --version,顯示如下,則安裝成功:

C:\Users\hp\Desktop>wget --version
GNU Wget 1.21.2 built on mingw32.

+cares +digest +gpgme +https +ipv6 +iri +large-file +metalink -nls
+ntlm +opie +psl +ssl/openssl

Wgetrc:
    /win32dev/misc/wget/out64/etc/wgetrc (system)
Compile:
    x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H
    -DSYSTEM_WGETRC="/win32dev/misc/wget/out64/etc/wgetrc"
    -DLOCALEDIR="/win32dev/misc/wget/out64/share/locale" -I.
    -I../../src -I../lib -I../../lib
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include -DCARES_STATICLIB
    -I/win32dev/misc/wget/out64/include -DPCRE2_STATIC
    -I/win32dev/misc/wget/out64/include -DHAVE_LIBSSL
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include -DNDEBUG -ggdb
Link:
    x86_64-w64-mingw32-gcc -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include -DCARES_STATICLIB
    -I/win32dev/misc/wget/out64/include -DPCRE2_STATIC
    -I/win32dev/misc/wget/out64/include -DHAVE_LIBSSL
    -I/win32dev/misc/wget/out64/include
    -I/win32dev/misc/wget/out64/include -DNDEBUG -ggdb
    -L/win32dev/misc/wget/out64/lib -L/win32dev/misc/wget/out64/lib
    -lmetalink -lunistring -liconv -L/win32dev/misc/wget/out64/lib
    -lcares -L/win32dev/misc/wget/out64/lib -lpcre2-8
    -L/win32dev/misc/wget/out64/lib -lssl -lcrypto
    -L/win32dev/misc/wget/out64/lib -lz -L/win32dev/misc/wget/out64/lib
    -lpsl -lidn2 -lunistring -liconv -lws2_32 -lole32 -lcrypt32 -lexpat
    -L/win32dev/misc/wget/out64/lib -lgpgme -lassuan -lgpg-error
    ftp-opie.o mswindows.o openssl.o http-ntlm.o ../lib/libgnu.a
    -lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32
    /win32dev/misc/wget/out64/lib/libiconv.a
    /win32dev/misc/wget/out64/lib/libunistring.a -lws2_32

Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.

嘗試使用wget時,可以在終端輸入wget 網址把目標鏈接下載到當前目錄下,也可以輸入wegt -p 指定目錄 網址把目標鏈接下載到指定目錄下。

2. 下載安裝Wireshark

參考資料:win10安裝抓包工具wireshark

Wireshark的官網下載地址中,在Stable Release中選擇符合你計算機型號的安裝包,我Windows10 64位電腦選擇的是 Windows Installer (64-bit),雙擊下載的.exe文件進行安裝。

如果你僅僅只是為了完成課程實驗,在安裝的過程當中可以一路無腦next,在選擇安裝路徑時可以更改為你想要的路徑。

3.開始實驗

Step 1-3

打開Wireshark,界面如下圖所示,選擇WLAN,點擊捕獲-選項。
步驟1

在捕獲選項界面,僅勾選WLAN,取消其他接口的混雜,在下方綠色的部分輸入tcp port 80,使用“tcp端口80”篩選器啟動捕獲。
步驟2

打開cmd終端,抓包一個網站,這里選擇的是https://www.baidu.com/,網頁獲取完成后,立刻在Wireshark點擊左上角的停止(紅色正方形),顯示如下圖。
步驟3
步驟4

找到上方Protocol為HTTP,且Info是GET的,點擊藍色部分的Hypertext,可以看到整個窗口的最下方顯示415 byte(s),這是HTTP的實際有效開銷。
步驟5

接下來分別查看以太網(Ethernet)、IP、TCP占用的字節,分別如下為14 types、20 types、20 types。
步驟6
步驟7
步驟8

由此,可以回答實驗報告中的第一個 turn in:
Step 3: Packet Structure
Turn-in: Hand in your packet drawing.
turn

Step 4

Protocol Overhead指的是協議開銷,由於協議本身的報頭等內容也需要占用一定的空間,用來標識該種協議、報文內各個字段的含義等信息,這種內容就是協議開銷了。
下載的包從一個Info中帶有SYN,ACK信號的包開始,到下面第一個遇到的HTTP包后面的TCP包為止。

由此,可以回答實驗報告中的第二個 turn in:
Your estimate of download protocol overhead as defined above. Tell us whether you find this overhead to be significant.
turn2
協議開銷一共有 66+54+469+66=665字節
HTTP有效開銷一共有415字節,415/665≈62.41%,協議開銷占比較小。

Step 5

點擊中間那一欄的以太網和IP,分別可以從Type和Protocol中找到第五步問題的答案。

由此,可以回答實驗報告中的第三個 turn in:

  1. Which Ethernet header field is the demultiplexing key that tells it the next higher layer is IP? What value is used in this field to indicate “IP”?
    turn3
    以太網報頭字段是Type,對應的值是0x0800。
  2. Which IP header field is the demultiplexing key that tells it the next higher layer is TCP? What value is used in this field to indicate “TCP”?
    turn4
    IP報頭字段是Protocol,對應的值是6。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM