定期的にIGMP General Queryを送信ツールのページです。
IGMPv2/IGMPv3スヌーピング機能付のL2-SWをサーバと端末間に使用した際、動的にIGMPスヌーピンを行うためにサーバでIGMP General Queryを定期的に送信するツールを作成しました。これにより対応する端末がリスナーリポートを送信することになり、L2-SWでIGMPスヌーピンが実行されます。
コマンド仕様 †
igmp_query [-v] [-h] [-d] [-2] [-f log_facility] [-r <n>] [-t <sec>] [-x <msec>] <interface>
| オプション | 機能 |
|---|
| -v | バージョンを表示します。 |
| -h | ヘルプを表示します。 |
| -d | デーモンとして動作します。(セッションのデタッチ) |
| -2 | IGMPバージョンを2にします。(デフォルトはバージョン3) |
| -f <log_facility> | Syslog出力のファシリティを設定します。(デフォルト:user) |
| -r <n> | Robustnessを指定します。(デフォルト:2) |
| -t <sec> | Query Packetの送信周期を指定します。(125 sec) |
| -x <msec> | 最大応答遅延(デフォルト:10,000 ms) |
参照規格 †
| 規格番号 | タイトル | 記事 |
| 1 | RFC 791 | Internet Protocol | |
| 2 | RFC 1112 | Host Extensions for IP Multicasting | |
| 3 | RFC 2236 | Internet Group Management Protocol, Version 2 | |
| 4 | RFC 3376 | Internet Group Management Protocol, Version 3 | |
| 5 | RFC 4604 | Using Internet Group Management Protocol Version 3 (IGMPv3) and Multicast Listener Discovery Protocol Version 2 (MLDv2) for Source-Specific Multicast | |
| 6 | RFC 2113 | IP Router Alert Option | |
IGMP General Query Packet Format †
IGMPv2 †
| Offset | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 09 | 08 | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 |
|---|
| 00 | Version(4)=4 | IHL(4)=6 | Type of Service(8)=0x00 | Total Length(16)=32 |
|---|
| 01 | Identification(16) | Flag(3)=0 | Fragment Offset(13)=0x0000 |
|---|
| 02 | Time to Live(8)=0x01 | Protocol(8)=2 | Header Checksum(16) |
|---|
| 03 | Source Address(32) |
|---|
| 04 | Destination Address(32)=224.0.0.1 |
|---|
| 05 | Options(32) = Router Alert = 0x94040000 |
|---|
| 06 | Type of Packet(8) =0x11(Membership Query) | Max resp. code(8) | Checksum(16) |
|---|
| 07 | Multicast Address(32) |
|---|
※General Queryでは
- Destination Address = 224.0.0.1
- Source Address = (自局IPアドレス)
IGMPv3 †
| Offset | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 09 | 08 | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 |
|---|
| 00 | Version(4)=4 | IHL(4)=6 | Type of Service(8)=0x00 | Total Length(16)=36 |
|---|
| 01 | Identification(16) | Flag(3)=0 | Fragment Offset(13)=0x0000 |
|---|
| 02 | Time to Live(8)=0x01 | Protocol(8)=2 | Header Checksum(16) |
|---|
| 03 | Source Address(32) |
|---|
| 04 | Destination Address(32)=224.0.0.1 |
|---|
| 05 | Options(32) = Router Alert = 0x94040000 |
|---|
| 06 | Type of Packet(8) =0x11(Membership Query) | Max resp. code(8) | Checksum(16) |
|---|
| 07 | Multicast Address(32) |
|---|
| 08 | Reserved(4)=0 | S | QRV(3) | QQIC(8) | Number of Sources (16)(N) |
|---|
| 09 | Source Address(32)[1] |
|---|
| .. | |
|---|
| .. | |
|---|
| 08+N | Source Address(32)[N] |
|---|
※General Queryでは
- Destination Address = 224.0.0.1
- Source Address = (自局IPアドレス)
- Number of Sources = 0
MAX Response Code †
- 0.1sec単位の応答遅延時間を指定しますが、128以上の値を指定する際は浮動小数点フォーマットになります。
- 128を超える場合は以下のようにコーディングされます。
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|
| Max Response Code | "1" | exp | mant |
|---|
- 従って、最大応答遅延時間(res sec)は
if( code < 128 )
{
res = code / 10;
}
else
{
exp = (code & 0x70) >> 4;
mant = code & 0x0f;
res = (mant | 0x10) << (exp + 3);
res =/ 10;
}
S(Suppress Router-Side Processing) †
- S Flag="1"の場合、マルチキャストルータは通常のタイマー処理を停止します。
IGMP General Queryの場合は”0”
QRV(Querier's Robustness Variable) †
- ロバストネスを指定します。パケットロスの補償として、メッセージの送信回数を指定します。
通常は"2"が指定されます。
QQIC(Querier's Query Interval Code) †
- Querier側の送信間隔が指定されます。(単位:sec)
Eathernet Frame Format †
| Offset | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Remarks |
| 00 | 0xAA | 0xAA |
|---|
| 01 | 0xAA | 0xAA |
|---|
| 02 | 0xAA | 0xAA |
|---|
| 03 | 0xAA | 0xAA |
|---|
| 04 | 0xAA | 0xAA |
|---|
| 05 | 0xAA | 0xAA |
|---|
| 06 | 0xAA | 0xAA |
|---|
| 07 | 0xAB | 0xAB |
|---|
| 08 | Dist MAC(0) | 0x01 |
|---|
| 09 | Dist MAC(1) | 0x00 |
|---|
| 10 | Dist MAC(2) | 0x5e |
|---|
| 11 | Dist MAC(3) | 0x00 |
|---|
| 12 | Dist MAC(4) | 0x00 |
|---|
| 13 | Dist MAC(5) | 0x01 |
|---|
| 14 | Src MAC(0) | |
|---|
| 15 | Src MAC(1) | |
|---|
| 16 | Src MAC(2) | |
|---|
| 17 | Src MAC(3) | |
|---|
| 18 | Src MAC(4) | |
|---|
| 19 | Src MAC(5) | |
|---|
| 20 | Type(0) | 0x08 |
|---|
| 21 | Type(1) | 0x00 |
|---|
| 22 | Payload(0) | |
|---|
| 23 | Payload(1) | |
|---|
| ...... | |
|---|
| 22+N | Payload(N) | |
|---|
| 23+N | FCS | X | |
|---|
※GeneralQuery?では
- Dist Mac = 01:00:5e:00:00:01
- Type = 0x0800(IPv4)