mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4
1074 words
5 minutes
Experiment 2: IP Protocol Analysis
2022-07-01

1. Experiment Objectives#

  • Understand the IP packet format, and become familiar with the meaning and length of each IP header field
  • Master packet capture and analysis techniques based on tcpdump and Wireshark

2. Experimental Environment#

  • Hardware requirements: One Alibaba Cloud ECS instance.
  • Software requirements: Linux/Windows operating system

3. Experimental Content#

3.1 Basic tcpdump Usage#

tcpdump is a tool used to capture network packets and output their contents. With its powerful features and flexible capture filters, it has become the preferred tool on UNIX-like systems for network analysis and problem troubleshooting.

tcpdump supports filtering by network layer, protocol, host, network, or port, and provides logical statements such as and, or, not to help you weed out unnecessary information.

References:

https://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html

https://www.jianshu.com/p/d9162722f189

3.2 Basic Wireshark Usage#

Wireshark (formerly Ethereal) is a network packet analysis software. The function of network packet analysis software is to capture network packets and display as detailed packet information as possible. Wireshark uses WinPcap as the interface, exchanging data frames directly with the network card.

Network administrators use Wireshark to detect network problems; network security engineers use Wireshark to inspect information security related issues; developers use Wireshark to debug new communication protocols; ordinary users use Wireshark to learn about network protocols. Its interface is shown in the figure below.

References:

https://www.wireshark.org/#download

https://pc.qq.com/search.html#!keyword=wireshark

https://www.cnblogs.com/csnd/p/11807736.html

https://pc.qq.com/search.html#!keyword=xshell

3.3 Capture Packets with tcpdump and Analyze with Wireshark#

On the Alibaba Cloud host, run the command traceroute www.xju.edu.cn –T, and capture packets using tcpdump. Download the file to your local machine and analyze it with Wireshark.

Tips:

  1. You must run the capture command first, then run the traceroute command. Capture command: tcpdump -i eth0 -w test.cap
  2. You can download the data using the scp command or by using xshell and xftp.
  1. Capture with tcpdump, analyze the captured data with wireshark, analyze the IP packet structure, and fill the IP protocol tree’s field names, field lengths, and field information into the table below.
Field NameField LengthField ValueField Description
Version4bit4Indicates the IP protocol version
Header length IP4bit20Indicates the IP header length
Differentiated services Field8bit0x00Used to obtain better service. In old standards this field was called Type of Service and used to indicate packet priority, but it has not been used in practice.
Total length16bit40Indicates the total length of this IP packet
Indentification16bit0x6f33An ID number for the packet used to identify the data packet
flag3bit0x40Flags indicating whether there are more fragments
Fragment offset13bit0Offset of the fragment relative to the start of the original packet
Time to time8bit64Sets the maximum number of routers a datagram can traverse, also known as “hops.”
protocol8bit6Identifies which encapsulation protocol is used above the network layer
Header checksum16bit0x9d2cUsed to check the correctness of the header to prevent IP header data corruption
source32bit172.16.2.237Source IP address
destination32bit100.100.27.15Destination IP address
  1. Use Wireshark to analyze and interpret the relevant traceroute command results.

Tip: Set the Wireshark filter bar to display only ICMP

4. Experimental Results and Analysis#

4.1 Basic tcpdump Usage#

tcpdump is a tool used to capture network packets and output their contents. With its powerful features and flexible capture filters, it has become the preferred tool on UNIX-like systems for network analysis and problem troubleshooting.

tcpdump supports filtering by network layer, protocol, host, network or port, and provides logical statements such as and, or, not to help you weed out useless information

  • Default startup
tcpdump//普通情况下,直接启动tcpdump将监视第一个网络接口上所有流过的数据包。

XBDLEKRJiZI1o4z.png

  • Capture packets on a specified network interface
tcpdump -i eth1//如果不指定网卡,默认tcpdump只会监视第一个网络接口,一般是eth0

4.2 Basic Wireshark Usage#

Wireshark (formerly Ethereal) is a network packet analysis tool. Its purpose is to capture network packets and display packet details as comprehensively as possible. Wireshark uses WinPcap as an interface to exchange data frames directly with the network card.

Network administrators use Wireshark to diagnose network issues, network security engineers use it to inspect information security problems, developers use it to debug new communication protocols, and ordinary users use it to learn about network protocols. Its interface is shown below.

hwT2YybXpv4DZdP.png

4.3 Capture Packets with tcpdump and Analyze with Wireshark#

  1. Execute the capture command tcpdump -i eth0 -w test.cap and store the captured information in the file /root/test.cap

tMLwgqz9cHUPhDa.png

  1. Run the command traceroute www.xju.edu.cn –T

bekUQoM2hriayS4.png

  1. Use xftp to connect to the host, and save the captured packet file to your computer

Mn1O56hby9ultBL.png

  1. Use wireshark to open the test.cap file, and analyze

F2Sg186ZxmW4HYn.png

  1. For the captured packets, analyze the IP header structure and fill the IP protocol tree with the field names, lengths, and information into the table below.
Field NameField LengthField ValueField Description
Version4bit40100 … = Version: 4
Header length IP4bit20… 0101 = Header Length: 20 bytes (5)
Differentiated services Filed8bit0x00Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total length16bit40Total Length: 40
Indentification16bit0x6f33Identification: 0x6f33 (28467)
flag3bit0x40Flags: 0x40, Don’t fragment
Fragment offset13bit0…0 0000 0000 0000 = Fragment Offset: 0
Time to time8bit64Time to Live: 64
protocol8bit6Protocol: TCP (6)
Header checksum16bit0x9d2cHeader Checksum: 0x9d2c [validation disabled]
source32bit172.16.2.237Source Address: 172.16.2.237
destination32bit100.100.27.15Destination Address: 100.100.27.15
  1. Analyze and interpret the results of the related traceroute command execution, using ICMP to analyze the results.

2jCLdqIHZOUyec5.png

G3D2ajfuXOV7LFM.png

VviL34IUOpz5tjF.png

Analysis results:

ICMP message types fall into two categories: ICMP error messages and ICMP echo messages. It can be seen that the ICMP messages we captured are all of type Time Exceeded in Transit, i.e., TTL exceeded. Choosing a random ICMP message, we can see that this ICMP message has Type=11, Code=0, which is an error-message type indicating time exceeded. Its checksum is 0x4e4d, which is correct, and the checksum status is good, with TTL equal to 4.

5. Experiment Summary#

5.1 Problems and Solutions#

The problem when using the traceroute command produced the error -bash: traceroute: command not found. Solution: use yum install traceroute to install traceroute.
When connecting to the server with Xftp, connection errors occurred. Solution: reconnect via campus network; after investigation found the cause was the server firewall.

5.2 Reflections#

  • This experiment familiarized me with the operation of code and software involved in IP protocol analysis, validating the knowledge learned in class. Through this experiment, I learned the concrete workflow for using the traceroute command, understood the basic usage of commonly used IP protocol analysis software, and improved my programming abilities.
  • Through these common IP protocol analysis command operations, tracing IP protocol usage, this reinforced the knowledge taught in class.
Share

If this article helped you, please share it with others!

Experiment 2: IP Protocol Analysis
https://dreaife.tokyo/en/posts/ip-protocol-analysis/
Author
dreaife
Published at
2022-07-01
License
CC BY-NC-SA 4.0

Some information may be outdated

Related Posts Smart
1
Experiment 3: UDP Protocol Analysis
cs-base This experiment aims to master UDP protocol content and working principles and analyze UDP packets from DNS queries and QQ communication. It includes packet capture and analysis using tcpdump and Wireshark, and the results show that UDP datagrams consist of source port, destination port, length, and checksum. Through the experiment, traceroute and Xftp connection issues were resolved, and understanding of IP protocol analysis and programming ability were improved.
2
Experiment 4: TCP Protocol Analysis
cs-base This experiment aims to understand the basic concepts of the TCP protocol and packet structure, analyze connection establishment and teardown, and master TCP protocol analysis using tcpdump and Wireshark. The experiment downloads a web page with wget and captures packets, analyzes TCP headers and fields, explores the three-way handshake and four-way termination processes, and summarizes issues and solutions encountered, improving understanding of IP protocols and TCP packet structure.
3
Experiment 7: HTTP Protocol Analysis and Measurement
cs-base This experiment aims to understand the HTTP protocol and its message structure, and to master HTTP packet capture and analysis using tcpdump and Wireshark. By downloading the Xinjiang University homepage, it analyzes the HTTP version, IP addresses, status code, content length, and header fields. A connection error encountered during the experiment was resolved, improving programming skills and understanding of HTTP.
4
Experiment 6: DNS Protocol Analysis and Measurement
cs-base This experiment aims to understand the DNS protocol and its basic concepts, including domain name structure, DNS servers, and the principles of domain name resolution. It covers DNS system configuration, DNS information measurement with the dig tool, and DNS query packet analysis using tcpdump and Wireshark. The results show the fields in DNS queries and their meanings, and the experiment concludes with issues encountered and solutions, improving understanding of DNS and programming skills.
5
Experiment 5: Email
cs-base This experiment aims to understand the basic structure of email systems and communication protocols including SMTP and POP3. By sending and receiving emails using mail agents, clients, webmail, and telnet commands, the communication process and protocols are analyzed. The results show a clearer understanding of the detailed mail sending workflow and SMTP protocol analysis, improving programming ability and protocol understanding.

Table of Contents