diff --git a/data/chapter1/preface.tex b/data/chapter1/preface.tex index 79ce111..6f84f35 100644 --- a/data/chapter1/preface.tex +++ b/data/chapter1/preface.tex @@ -7,3 +7,4 @@ 掌握以太网、802.11、ARP、IP、ICMP和TCP等重要协议传输单元结构, 深入理解相关网络命令和重要协议算法的工作原理, 从而培养网络故障检测、网络性能改进和网络安全分析的能力。 +(备注:第二版将增补实验1.4: IEEE 802.11协议分析。) \ No newline at end of file diff --git a/data/chapter1/section1.tex b/data/chapter1/section1.tex index 473ab43..7110eae 100644 --- a/data/chapter1/section1.tex +++ b/data/chapter1/section1.tex @@ -137,7 +137,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-boot-ui} + \includegraphics[width=16cm]{c1_wireshark-boot-ui} \caption{Wireshark软件启动界面} \label{fig:c1_wireshark-boot-ui} \end{figure} @@ -149,14 +149,14 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-main-ui} + \includegraphics[width=16cm]{c1_wireshark-main-ui} \caption{Wireshark主窗口界面} \label{fig:c1_wireshark-main-ui} \end{figure} \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-setup-ui} + \includegraphics[width=16cm]{c1_wireshark-setup-ui} \caption{Wireshark的设置界面} \label{fig:c1_wireshark-setup-ui} \end{figure} @@ -180,7 +180,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-filters} + \includegraphics[width=16cm]{c1_wireshark-filters} \caption{显示过滤规则的示例} \label{fig:c1_wireshark-filters} \end{figure} @@ -190,7 +190,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-save} + \includegraphics[width=16cm]{c1_wireshark-save} \caption{操作主菜单保存数据文件} \label{fig:c1_wireshark-save} \end{figure} @@ -205,7 +205,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-special-type} + \includegraphics[width=16cm]{c1_wireshark-special-type} \caption{选中特定的捕获类型} \label{fig:c1_wireshark-special-type} \end{figure} @@ -217,7 +217,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-statistic} + \includegraphics[width=16cm]{c1_wireshark-statistic} \caption{统计功能} \label{fig:c1_wireshark-statistic} \end{figure} @@ -232,7 +232,7 @@ IP地址长度为4字节。每个字段的含义如下: \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_eth-frame-detail} + \includegraphics[width=16cm]{c1_eth-frame-detail} \caption{以太网帧结构展开界面} \label{fig:c1_eth-frame-detail} \end{figure} diff --git a/data/chapter1/section2.tex b/data/chapter1/section2.tex index b452dcb..6cf8ccb 100644 --- a/data/chapter1/section2.tex +++ b/data/chapter1/section2.tex @@ -113,7 +113,7 @@ ICMP询问报文有回送请求和应答、时间戳请求和应答、 \begin{figure}[!htp] \centering - \includegraphics[width=10cm]{c1_icmp-structure} + \includegraphics[width=12cm]{c1_icmp-structure} \caption{ICMP报文结构示意图} \label{c1_icmp-structure} \end{figure} @@ -235,7 +235,7 @@ tracert命令(Linux)格式和常用参数如图\ref{fig:tracert-cmd}所示 \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-monitor} + \includegraphics[width=16cm]{c1_wireshark-monitor} \caption{Wireshark监视器界面} \label{fig:c1_wireshark-monitor} \end{figure} @@ -245,7 +245,7 @@ tracert命令(Linux)格式和常用参数如图\ref{fig:tracert-cmd}所示 \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_ip-view} + \includegraphics[width=16cm]{c1_ip-view} \caption{查看IP数据报} \label{fig:c1_ip-view} \end{figure} @@ -255,7 +255,7 @@ tracert命令(Linux)格式和常用参数如图\ref{fig:tracert-cmd}所示 \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_echo-request} + \includegraphics[width=16cm]{c1_echo-request} \caption{Echo request示例} \label{fig:c1_echo-request} \end{figure} @@ -289,7 +289,7 @@ tracert命令(Linux)格式和常用参数如图\ref{fig:tracert-cmd}所示 \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_wireshark-filter-setup} + \includegraphics[width=16cm]{c1_wireshark-filter-setup} \caption{在Wireshark中设置过滤条件} \label{fig:c1_wireshark-filter-setup} \end{figure} @@ -299,8 +299,8 @@ tracert命令(Linux)格式和常用参数如图\ref{fig:tracert-cmd}所示 \begin{figure}[!htp] \centering - \includegraphics[width=11cm]{c1_traceroute-exec} - \caption{在Wireshark中设置过滤条件} + \includegraphics[width=16cm]{c1_traceroute-exec} + \caption{在终端中执行traceroute命令示例} \label{fig:c1_traceroute-exec} \end{figure} diff --git a/data/chapter1/section3.tex b/data/chapter1/section3.tex index 0fc9696..bb5ebcf 100644 --- a/data/chapter1/section3.tex +++ b/data/chapter1/section3.tex @@ -358,7 +358,7 @@ CUBIC的关键特征是:cwnd窗口的增长依赖两次丢包的时间。 \begin{enumerate} \item 编写一对简单的TCP连接程序, - 也可以直接运行指导书提供的Python程序(见附件)。 + 也可以直接运行指导书提供的Python程序(见附件)。 在客户端快速发送数据给服务端,而服务端则有意缓慢地接收数据, 观察TCP如何用窗口大小值进行流量控制。虚拟机两端分别运行 \texttt{python3 server.py}和\texttt{python3 client.py}。 @@ -467,3 +467,59 @@ CUBIC的关键特征是:cwnd窗口的增长依赖两次丢包的时间。 \item (10分)完成任2道思考题。 \item (10分)记录自己在本次实验中所遇到的问题,以及心得感悟实验总结。 \end{enumerate} + +\subsection{附件} +\label{subsec:c1_s3_additionalprg} +1. Python3 TCP socket通信程序。 +\ 服务端 server.py +\lstset{language=python3} +\begin{lstlisting} + import socket + import time + def recv_data(sock,length): + data=b'' + while len(data) < length: + more = sock.recv(length - len(data)) + if not more: + pass + data += more + return data + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + # 设置接收缓冲区大小为1024 + s.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1024) + s.bind(('0.0.0.0', 9999)) + s.listen(1) + print("Sever listening on 9999...") + try: + sc, addr = s.accept() + while True: + rcvdata = recv_data(sc,16) + time.sleep(0.01) + pass + finally: + sc.close() + s.close() +\end{lstlisting} +\\ +\ 客户端 client.py +\lstset{language=python3} +\begin{lstlisting} + import socket + import time + ip_port = ("192.168.100.144", 9999) + data = "0123456789\n"*100 + c = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + c.connect(ip_port) + print("Connected.") + time.sleep(1) + i=0 + while i<10: + print("Send:"+data) + c.send(data.encode()) + i=i+1 + finally: + print("Sent. Waiting....") + while True: + time.sleep(0.001) +\end{lstlisting} \ No newline at end of file diff --git a/figure/chapter1/c1_TCP-status-machine.png b/figure/chapter1/c1_TCP-status-machine.png index 7b7d24d..43e21ef 100644 Binary files a/figure/chapter1/c1_TCP-status-machine.png and b/figure/chapter1/c1_TCP-status-machine.png differ diff --git a/figure/chapter1/c1_TCP-time-line.png b/figure/chapter1/c1_TCP-time-line.png index 72d0ddc..12af25c 100644 Binary files a/figure/chapter1/c1_TCP-time-line.png and b/figure/chapter1/c1_TCP-time-line.png differ diff --git a/figure/chapter1/c1_arp-format.png b/figure/chapter1/c1_arp-format.png index 02004bd..fde08c0 100644 Binary files a/figure/chapter1/c1_arp-format.png and b/figure/chapter1/c1_arp-format.png differ diff --git a/figure/chapter1/c1_icmp-structure.png b/figure/chapter1/c1_icmp-structure.png index 36bb397..d95ea87 100644 Binary files a/figure/chapter1/c1_icmp-structure.png and b/figure/chapter1/c1_icmp-structure.png differ diff --git a/figure/chapter1/c1_ip-structure.png b/figure/chapter1/c1_ip-structure.png index 15af114..46cd430 100644 Binary files a/figure/chapter1/c1_ip-structure.png and b/figure/chapter1/c1_ip-structure.png differ diff --git a/figure/chapter1/c1_traceroute-exec.png b/figure/chapter1/c1_traceroute-exec.png index 40a8210..cb20b0a 100644 Binary files a/figure/chapter1/c1_traceroute-exec.png and b/figure/chapter1/c1_traceroute-exec.png differ diff --git a/figure/chapter1/c1_wireshark-boot-ui.png b/figure/chapter1/c1_wireshark-boot-ui.png index ea22b0f..6d26e9f 100644 Binary files a/figure/chapter1/c1_wireshark-boot-ui.png and b/figure/chapter1/c1_wireshark-boot-ui.png differ diff --git a/figure/chapter1/c1_wireshark-filters.png b/figure/chapter1/c1_wireshark-filters.png index 9712588..72c108a 100644 Binary files a/figure/chapter1/c1_wireshark-filters.png and b/figure/chapter1/c1_wireshark-filters.png differ diff --git a/figure/chapter1/c1_wireshark-main-ui.png b/figure/chapter1/c1_wireshark-main-ui.png index 68c070d..65b1376 100644 Binary files a/figure/chapter1/c1_wireshark-main-ui.png and b/figure/chapter1/c1_wireshark-main-ui.png differ diff --git a/figure/chapter1/c1_wireshark-save.png b/figure/chapter1/c1_wireshark-save.png index 3695860..42647a7 100644 Binary files a/figure/chapter1/c1_wireshark-save.png and b/figure/chapter1/c1_wireshark-save.png differ diff --git a/figure/chapter1/c1_wireshark-setup-ui.png b/figure/chapter1/c1_wireshark-setup-ui.png index 2558d74..c109ed5 100644 Binary files a/figure/chapter1/c1_wireshark-setup-ui.png and b/figure/chapter1/c1_wireshark-setup-ui.png differ diff --git a/figure/chapter1/c1_wireshark-special-type.png b/figure/chapter1/c1_wireshark-special-type.png index 0cdef6a..75e7440 100644 Binary files a/figure/chapter1/c1_wireshark-special-type.png and b/figure/chapter1/c1_wireshark-special-type.png differ diff --git a/figure/chapter1/c1_wireshark-statistic.png b/figure/chapter1/c1_wireshark-statistic.png index 9588e62..b3cbaf3 100644 Binary files a/figure/chapter1/c1_wireshark-statistic.png and b/figure/chapter1/c1_wireshark-statistic.png differ