TCP/IP Protocol Learning Fourth Chapter Icmp:internet Control Message Protocol

Source: Internet
Author: User

Send the monkeys to the reinforcements.

An RFC document on ICMP here!

What the hell?

In my opinion, the ICMP protocol is mainly to pass/query some basic information to each other, most of which is to pass some error message.

For example, a sends the UDP message to B's 10000 port, but B's 10000 port does not open, it will return an ICMP packet to a, tell the A10000 port is not open.

Basic query information, such as the most commonly used ping command, is to send an ICMP packet to the destination host, and then wait for the destination host to respond (the response is also an ICMP packet).

Agreement

The protocol definition is very simple. ICMP is a layer above the IP layer. The front is the 20-byte IP header, then the ICMP header.

ICMP header, from the TCP/IP protocol in detail volume one

The combination of type and code two fields determines the purpose of this ICMP packet, such as the 0,0 combination and the 8,0 combination that our usual ping is. Specific as follows:

various types of ICMP packets, from the TCP/IP protocol in detail volume one

Put the code on.

There seems to be nothing to say. Put the direct code on it. Implements the example in the book, one is the query subnet mask, one is the query time. GitHub address, dot me dot Me

Ports not up to

This is also an example in the book. For example, a sends the UDP message to B's 10000 port, but B's 10000 port does not open, it will return an ICMP packet to a, tell the A10000 port is not open.
Take a look at the effect.

Send a UDP message to the 192.168.0.108 10000 port using the Swiss Army knife.

% nc -u 192.168.0.108 10000                                                   ?abcd

Also open a tcpdump monitor to see:

# tcpdump -vvv -x -nn icmp                                                    ?tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes01:48:01.420363 IP (tos 0x0, ttl 64, id 45430, offset 0, flags [DF], proto ICMP (1), length 56)    192.168.0.108 > 192.168.0.104: ICMP 192.168.0.108 udp port 10000 unreachable, length 36    IP (tos 0x0, ttl 64, id 42558, offset 0, flags [DF], proto UDP (17), length 33)    192.168.0.104.60181 > 192.168.0.108.10000: [no cksum] UDP, length 5    0x0000:  4500 0038 b176 4000 4001 072a c0a8 006c    0x0010:  c0a8 0068 0303 eac9 0000 0000 4500 0021    0x0020:  a63e 4000 4011 1269 c0a8 0068 c0a8 006c    0x0030:  eb15 2710 000d 0000
Ping

The implementation of the most important ping is not yet written. Back up.

TCP/IP Protocol Learning Fourth Chapter Icmp:internet Control Message Protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.