网络层的一些附属协议

网络层主要是IP协议。但是

其他一些辅助进行包转发、路由和包安全的协议也算入了网络层。例如ICMP,EIGRP等

ICMP is the Internet Control Message Protocol.

ICMP is a complementary protocol to IP (Internet Protocol). Like IP, ICMP resides on the Network Layer of the OSI Model.

ICMP is designed for sending control and test messages across IP networks.

Unlike the Transport Layer protocols TCP(Transmission Control Protocol) and UDP(User Datagram Protocol) which operate on top of IP, ICMP exists alongside IP.

The ability to understand ICMP is a requirement for any IP-compatible network device. However, many security devices such as firewalls block or disable all or part of ICMP functionality for security purposes.

ICMP ICMP (Internet Control Message Protocol)

ICMP Message Types

ICMP operates by sending and receiving a limited number of messages types. The ICMP message types are defined in IANA ICMP Type Numbers.

The most common ICMP message types are:

TypeName
0Echo Reply
3Destination Unreachable
4Source Quench
5Redirect
6Alternate Host Address
8Echo
9Router Advertisement
10Router Solicitation
11Time Exceeded
12Parameter Problem
13Timestamp
14Timestamp Reply
15Information Request
16Information Reply
17Address Mask Request
18Address Mask Reply
30Traceroute

ICMP Echo Request and Echo Reply

The two most important ICMP messages are Echo Request (8) and Echo Reply (0).

Echo Request and Echo Reply are utilized by the `ping` command to test network connectivity.

Here we use the `ping` command to send three 64-byte ICMP Echo Request messages to www.freebsd.org and receive three Echo Reply messages in response:

bash-2.05a$ ping -c 3 www.freebsd.org 
PING www.freebsd.org (216.136.204.117): 56 data bytes 
64 bytes from 216.136.204.117: icmp_seq=0 ttl=55 time=63.708 ms 
64 bytes from 216.136.204.117: icmp_seq=1 ttl=55 time=62.725 ms 
64 bytes from 216.136.204.117: icmp_seq=2 ttl=55 time=62.618 ms

— www.freebsd.org ping statistics — 
3 packets transmitted, 3 packets received, 0% packet loss 
round-trip min/avg/max/stddev = 62.618/63.017/63.708/0.491 ms

This output tells us that network connectivity to www.freebsd.org is working. It also tells us the time each packet took to return.

`ping` is an extremely useful tool for network troubleshooting.

Additional Reading on ICMP

ICMP is defined in RFC 792: Internet Control Message Protocol. 

原文地址:https://www.cnblogs.com/jjkv3/p/2497169.html