ICMP(7) Linux Programmer’s Manual ICMP(7) 名前 icmp, IPPROTO_ICMP - Linux IPv4 ICMP カーネルモジュール 説明 このカーネルモジュールは RFC 792 で定義されている Internet Control Mes- sage Protocol を実装したものである。このプロトコルはエラー状況を知ら せ た り診断を行うために用いられる。ユーザーはこのモジュールとは直接には通 信できない。このモジュールはカーネルの他のプロトコルと通信し、それら の プロトコルが ICMP エラーをアプリケーションレイヤに渡す。カーネルの ICMP モジュールは ICMP リクエストに対する応答も行う。 raw ソケットをプロトコル IPPROTO_ICMP でオープンすれば、ユーザープロ ト コ ルはローカルなソケット全てに対する ICMP パケットを受信することができ る。詳細は raw(7) を参照のこと。ソケットに渡される ICMP パケットのタ イ プは ICMP_FILTER オプションによってフィルターできる。 ICMP パケットは ( たとえユーザーソケットに渡される場合でも)、常にカーネルによって (も) 処 理される。 Linux では ICMP エラーパケットのレートをそれぞれの送り先に対して制限し ている。 ICMP_REDIRECT と ICMP_DEST_UNREACH も到着したパケットの行き 先 経路 (destination route) を制限する。 /proc インタフェース ICMP では、いくつかのグローバルパラメータを設定するための /proc ファイ ル群が用意されている。これらのパラメータには、 /proc/sys/net/ipv4/ ディ レ クトリ内のファイルの読み書きでアクセスできる。これらのパラメータのほ とんどは特定の ICMP タイプに対するレート制限 (rate limitation) である。 Linux 2.2 は ICMP の制限にトークン・バケット・フィルタ (token bucket filter) を用いる。それぞれの値は、バーストの後にトークン・バケット・ フ ィ ルタがクリアされるまでのタイムアウトを秒単位で表したものである。最小 単位(jiffy)はシステム依存の単位で i386 システムは通常 10ms 、alpha や ia64 では 1ms である。 icmp_destunreach_rate (Linux 2.2 から 2.4.9 まで) ICMP 不達パケット (Destination Unreachable packet) を送る最大レ ート。これは特定のルートまたは行き先にパケットを送信するレートを 制 限 す る 。 こ の 制 限 は 、 path MTU discovery に必要な ICMP_FRAG_NEEDED パケットの送信には影響しない。 icmp_echo_ignore_all (Linux 2.2 以降) この値が非ゼロの場合は、 Linux はすべての ICMP_ECHO 要求を無視す る。 icmp_echo_ignore_broadcasts (Linux 2.2 以降) こ の値が非ゼロの場合は、 Linux はブロードキャストアドレスに送ら れたすべての ICMP_ECHO 要求を無視する。 icmp_echoreply_rate (Linux 2.2 から 2.4.9 まで) ICMP_ECHOREQUEST パケットに応答する ICMP_ECHOREPLY パケットの 最 大送信レート。 icmp_errors_use_inbound_ifaddr (Boolean; default: disabled; Linux 2.6.12 以降) こ れを無効にすると、ICMP エラーメッセージは、出力インタフェース のプライマリアドレスで送信される。 これを有効にすると、エラーメッセージは ICMP エラーの原因となった パケットを受信したインタフェースのプライマアドレスで送信される。 この動作は、多くのネットワーク管理者がルータに対して期待している ものであり、これにより複雑なネットワークレイアウトのデバッグがよ り容易になる。 選択されたインタフェースでプライマリアドレスが存在しない場合は、 この設定に関わらず、最初のループバック以外のインタフェースで、プ ライマリアドレスを持つインタフェースのプライマリアドレスが使用さ れる点に注意すること。 icmp_ignore_bogus_error_responses (Boolean; default: disabled; Linux 2.2 以降) ルータの中には、RFC1122 に違反し、ブロードキャストフレームに対し て偽の応答を送信するものがある。このような違反は通常カーネルの警 告としてログに記録される。このパラメータを有効にすると、カーネル はこのような警告を出さなくなり、ログファイルに雑音のような情報が 記録されるのを避けることができる。 icmp_paramprob_rate (Linux 2.2 から 2.4.9 まで) ICMP_PARAMETERPROB パケットの最大送信レート。これらのパケットは 不正な IP ヘッダを持つパケットが到着した場合に送信される。 icmp_ratelimit (integer; default: 1000; Linux 2.4.10 以降) 種別が icmp_ratemask (下記参照) にマッチした ICMP パケットの、特 定 の送信先への送信レートの最大値を制限する。 0 はレート制限を無 効にすることを、 0 以外の値は応答間の最小間隔 (ミリ秒単位) を 示 す。 icmp_ratemask (integer; default: 下記参照; Linux 2.4.10 以降) レート制限を行う ICMP タイプを決めるマスク。 有効ビット: IHGFEDCBA9876543210 デフォルトマスク: 0000001100000011000 (0x1818) ビット定義 (カーネルソースファイル include/linux/icmp.h を参照): 0 Echo Reply 3 Destination Unreachable * 4 Source Quench * 5 Redirect 8 Echo Request B Time Exceeded * C Parameter Problem * D Timestamp Request E Timestamp Reply F Info Request G Info Reply H Address Mask Request I Address Mask Reply アスタリスク印が付いたビットは、デフォルトでレート制限が有効にな っている (上記のマスクのデフォルトも参照)。 icmp_timeexceed_rate (Linux 2.2 から 2.4.9 まで) ICMP_TIME_EXCEEDED パケットの最大送信レート。これらのパケットは パケットがあまりに多くの hop を通過した場合に、ループを防ぐた め に送られる。 バージョン ICMP_ADDRESS 要求に対するサポートは 2.2 で削除された。 ICMP_SOURCE_QUENCH は Linux 2.2 で削除された。 注意 他 の多くの実装では、 IPPROTO_ICMP raw ソケットがサポートされていない。 この機能は移植性が必要なプログラムでは用いるべきでない。 Linux がルーターとして動作していないときには、 ICMP_REDIRECT パケットは 送 信されない。またこれらが受け取られるのも、発信元がルーティングテーブ ルに定義されている古いゲートウェイで、リダイレクト・ル ー ト (redirect route) が適当な時間の後に期限切れになっている場合に限られる。 ICMP_TIMESTAMP から返される 64 ビットのタイムスタンプは、 1970 年 1 月 1 日からの経過時間をミリ秒単位で表したものである。 Linux ICMP は ICMP を送るために内部で raw ソケットを用いる。 raw ソケッ トは netstat(8) の出力に 0 inode として出力される。 関連項目 ip(7) RFC 792: ICMP プロトコルの説明 Linux 2008-11-24 ICMP(7)
ICMP(7) Linux Programmer’s Manual ICMP(7) NAME icmp, IPPROTO_ICMP - Linux IPv4 ICMP kernel module. DESCRIPTION This kernel protocol module implements the Internet Control Message Protocol defined in RFC 792. It is used to signal error conditions and for diagnosis. The user doesn’t interact directly with this module; instead it communicates with the other protocols in the kernel and these pass the ICMP errors to the application layers. The kernel ICMP module also answers ICMP requests. A user protocol may receive ICMP packets for all local sockets by open- ing a raw socket with the protocol IPPROTO_ICMP. See raw(7) for more information. The types of ICMP packets passed to the socket can be filtered using the ICMP_FILTER socket option. ICMP packets are always processed by the kernel too, even when passed to a user socket. Linux limits the rate of ICMP error packets to each destination. ICMP_REDIRECT and ICMP_DEST_UNREACH are also limited by the destination route of the incoming packets. /proc interfaces ICMP supports a set of /proc interfaces to configure some global IP parameters. The parameters can be accessed by reading or writing files in the directory /proc/sys/net/ipv4/. Most of these parameters are rate limitations for specific ICMP types. Linux 2.2 uses a token bucket filter to limit ICMPs. The value is the timeout in jiffies until the token bucket filter is cleared after a burst. A jiffy is a system dependent unit, usually 10ms on i386 and about 1ms on alpha and ia64. icmp_destunreach_rate (Linux 2.2 to 2.4.9) Maximum rate to send ICMP Destination Unreachable packets. This limits the rate at which packets are sent to any individual route or destination. The limit does not affect sending of ICMP_FRAG_NEEDED packets needed for path MTU discovery. icmp_echo_ignore_all (since Linux 2.2) If this value is non-zero, Linux will ignore all ICMP_ECHO requests. icmp_echo_ignore_broadcasts (since Linux 2.2) If this value is non-zero, Linux will ignore all ICMP_ECHO pack- ets sent to broadcast addresses. icmp_echoreply_rate (Linux 2.2 to 2.4.9) Maximum rate for sending ICMP_ECHOREPLY packets in response to ICMP_ECHOREQUEST packets. icmp_errors_use_inbound_ifaddr (Boolean; default: disabled; since Linux 2.6.12) If disabled, ICMP error messages are sent with the primary address of the exiting interface. If enabled, the message will be sent with the primary address of the interface that received the packet that caused the ICMP error. This is the behavior that many network administrators will expect from a router. And it can make debugging compli- cated network layouts much easier. Note that if no primary address exists for the interface selected, then the primary address of the first non-loopback interface that has one will be used regardless of this setting. icmp_ignore_bogus_error_responses (Boolean; default: disabled; since Linux 2.2) Some routers violate RFC1122 by sending bogus responses to broadcast frames. Such violations are normally logged via a kernel warning. If this parameter is enabled, the kernel will not give such warnings, which will avoid log file clutter. icmp_paramprob_rate (Linux 2.2 to 2.4.9) Maximum rate for sending ICMP_PARAMETERPROB packets. These packets are sent when a packet arrives with an invalid IP header. icmp_ratelimit (integer; default: 1000; since Linux 2.4.10) Limit the maximum rates for sending ICMP packets whose type matches icmp_ratemask (see below) to specific targets. 0 to disable any limiting, otherwise the minimum space between responses in milliseconds. icmp_ratemask (integer; default: see below; since Linux 2.4.10) Mask made of ICMP types for which rates are being limited. Significant bits: IHGFEDCBA9876543210 Default mask: 0000001100000011000 (0x1818) Bit definitions (see the kernel source file include/linux/icmp.h): 0 Echo Reply 3 Destination Unreachable * 4 Source Quench * 5 Redirect 8 Echo Request B Time Exceeded * C Parameter Problem * D Timestamp Request E Timestamp Reply F Info Request G Info Reply H Address Mask Request I Address Mask Reply The bits marked with an asterisk are rate limited by default (see the default mask above). icmp_timeexceed_rate (Linux 2.2 to 2.4.9) Maximum rate for sending ICMP_TIME_EXCEEDED packets. These packets are sent to prevent loops when a packet has crossed too many hops. VERSIONS Support for the ICMP_ADDRESS request was removed in 2.2. Support for ICMP_SOURCE_QUENCH was removed in Linux 2.2. NOTES As many other implementations don’t support IPPROTO_ICMP raw sockets, this feature should not be relied on in portable programs. ICMP_REDIRECT packets are not sent when Linux is not acting as a router. They are also only accepted from the old gateway defined in the routing table and the redirect routes are expired after some time. The 64-bit timestamp returned by ICMP_TIMESTAMP is in milliseconds since January 1, 1970. Linux ICMP internally uses a raw socket to send ICMPs. This raw socket may appear in netstat(8) output with a zero inode. SEE ALSO ip(7) RFC 792 for a description of the ICMP protocol. COLOPHON This page is part of release 3.22 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-11-24 ICMP(7)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa