概要
MLDv2の理解のため、Ubuntu上で、network namespace + mcjoinを用いて、簡易動作検証を行う。
環境
- osxのmultipass上で動作するUbuntu20.04
- mcjoin version 2.1
準備
- mcjoinをインストールする
公式のbuilding for gitの手順でgitからソースコード取得して、ビルドする。
git clone https://github.com/troglobit/mcjoin.git
cd mcjoin/
./autogen.sh
./configure && make
sudo make install-strip
なお、事前に以下インストールをしておくこと。
$ sudo apt-get install automake autoconf gcc make
mcjoinのusageは以下の通り。
$ mcjoin -h
Usage: mcjoin [-dhjosv] [-c COUNT] [-f MSEC ][-i IFACE] [-l LEVEL] [-p PORT]
[-r SEC] [-t TTL] [-w SEC]
[[SOURCE,]GROUP0[:PORT] .. [SOURCE,]GROUPN[:PORT] |
[SOURCE,]GROUP[:PORT]+NUM]
- network namespaceでレシーバとセンダーを作成する。
以下sunがマルチキャストのセンダー、moonがマルチキャストのレシーバである。
sudo ip netns add moon
sudo ip netns add sun
sudo ip link add sun-veth0 type veth peer name moon-veth0
sudo ip link set sun-veth0 netns sun
sudo ip link set moon-veth0 netns moon
sudo ip netns exec sun ip link set sun-veth0 up
sudo ip netns exec moon ip link set moon-veth0 up
sudo ip netns exec sun sysctl net.ipv6.ip_forward=1
sudo ip netns exec moon sysctl net.ipv6.ip_forward=1
sudo ip netns exec sun ip addr add 2001:db8::1/64 dev sun-veth0
sudo ip netns exec moon ip addr add 2001:db8::2/64 dev moon-veth0
検証
(1)チャネル(*,G): ASM(Any Source Multicast)
- マルチキャスト の配信を開始する。ソースアドレス(配信サーバのアドレス)は 2001:db8::1、グループアドレスはff2e::42。
sudo ip netns exec sun mcjoin -s ff2e::42 -i sun-veth0
- レシーバでグループに参加する。
sudo ip netns exec moon mcjoin ff2e::42
- レシーバを終了する。
ctrl + c
- tcpdumpでキャプチャ
以下のようにセンダーからマルチキャストパケットが配信される。
1 0.000000 2001:db8::1 ff2e::42 UDP 162 41888 41888 → 1234 Len=100
以下レシーバからReport(changed to exclude,グループアドレス ff2e::42 )が送信されている。
15 1.698231 fe80::9c81:aeff:fecd:bd8f ff02::16 ICMPv6 90 Multicast Listener Report Message v2
Internet Control Message Protocol v6
Type: Multicast Listener Report Message v2 (143)
Code: 0
Checksum: 0x67be [correct]
[Checksum Status: Good]
Reserved: 0000
Number of Multicast Address Records: 1
Multicast Address Record Changed to exclude: ff2e::42
Record Type: Changed to exclude (4)
Aux Data Len: 0
Number of Sources: 0
Multicast Address: ff2e::42
レシーバでmcjoin停止時、以下のようにReport(Changed to include)が送信されている。
48 5.865150 fe80::9c81:aeff:fecd:bd8f ff02::16 ICMPv6 90 Multicast Listener Report Message v2
Internet Control Message Protocol v6
Type: Multicast Listener Report Message v2 (143)
Code: 0
Checksum: 0x68be [correct]
[Checksum Status: Good]
Reserved: 0000
Number of Multicast Address Records: 1
Multicast Address Record Changed to include: ff2e::42
Record Type: Changed to include (3)
Aux Data Len: 0
Number of Sources: 0
Multicast Address: ff2e::42
(2)チャネル(S,G): SSM(Source Specific Multicast)
- マルチキャスト の配信を開始する。ソースアドレス(配信サーバのアドレス)は 2001:db8::1、グループアドレスはff2e::42。
sudo ip netns exec sun mcjoin -s ff2e::42 -i sun-veth0
- レシーバでグループに参加する。ソースアドレスに2001:db8::1を指定、グループアドレスにff2e::42を指定。
sudo ip netns exec moon mcjoin 2001:db8::1,ff2e::42
- レシーバを終了する。
ctrl + c
- tcpdumpでキャプチャ
以下のようにセンダーからマルチキャストパケットが配信される。
1 0.000000 2001:db8::1 ff2e::42 UDP 162 41888 41888 → 1234 Len=100
以下レシーバからReport(Allow new sources,ソースアドレス 2001:db8::1グループアドレス ff2e::42 )が送信されている。
22 2.779693 fe80::9c81:aeff:fecd:bd8f ff02::16 ICMPv6 106 Multicast Listener Report Message v2
Internet Control Message Protocol v6
Type: Multicast Listener Report Message v2 (143)
Code: 0
Checksum: 0x38f3 [correct]
[Checksum Status: Good]
Reserved: 0000
Number of Multicast Address Records: 1
Multicast Address Record Allow new sources: ff2e::42
Record Type: Allow new sources (5)
Aux Data Len: 0
Number of Sources: 1
Multicast Address: ff2e::42
Source Address: 2001:db8::1
レシーバでmcjoin停止時、以下のようにReport(Block old sources)が送信されている。
52 6.486825 fe80::9c81:aeff:fecd:bd8f ff02::16 ICMPv6 106 Multicast Listener Report Message v2
Internet Control Message Protocol v6
Type: Multicast Listener Report Message v2 (143)
Code: 0
Checksum: 0x37f3 [correct]
[Checksum Status: Good]
Reserved: 0000
Number of Multicast Address Records: 1
Multicast Address Record Block old sources: ff2e::42
Record Type: Block old sources (6)
Aux Data Len: 0
Number of Sources: 1
Multicast Address: ff2e::42
Source Address: 2001:db8::1
参考