計算機網絡實驗 Labexercise1-1 Protocol Layers(Wireshark抓包與協議分析實驗)
本人博客園個人首頁、CSDN個人首頁
前言:本博客包含Windows10下安裝wget、Wireshark。
一些有用的鏈接:
一些有用的提示:
開始實驗進行抓包時,校園網環境下的同學不建議使用一些 [ 上網不涉密涉密不上網 ] 的校園網進行抓包,可能會導致抓不到包捏 😃(找了半天bug,氣死我了)
1. 下載安裝wget
點擊此鏈接,選擇合適的版本下載.exe文件,然后把下好的.exe文件放在C:/windows/system32
目錄下即可。
在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,點擊捕獲-選項。
在捕獲選項界面,僅勾選WLAN,取消其他接口的混雜,在下方綠色的部分輸入tcp port 80
,使用“tcp端口80”篩選器啟動捕獲。
打開cmd終端,抓包一個網站,這里選擇的是https://www.baidu.com/
,網頁獲取完成后,立刻在Wireshark點擊左上角的停止(紅色正方形),顯示如下圖。
找到上方Protocol為HTTP,且Info是GET的,點擊藍色部分的Hypertext,可以看到整個窗口的最下方顯示415 byte(s),這是HTTP的實際有效開銷。
接下來分別查看以太網(Ethernet)、IP、TCP占用的字節,分別如下為14 types、20 types、20 types。
由此,可以回答實驗報告中的第一個 turn in:
Step 3: Packet Structure
Turn-in: Hand in your packet drawing.
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.
協議開銷一共有 66+54+469+66=665字節
HTTP有效開銷一共有415字節,415/665≈62.41%,協議開銷占比較小。
Step 5
點擊中間那一欄的以太網和IP,分別可以從Type和Protocol中找到第五步問題的答案。
由此,可以回答實驗報告中的第三個 turn in:
- 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”?
以太網報頭字段是Type,對應的值是0x0800。- 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”?
IP報頭字段是Protocol,對應的值是6。