1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MTUを調べる

Posted at

MTUを調べてみた

MTU(Maximum Transmission Unit)、いわゆる、ネットワークにて一度に遅れるパケットサイズ(ここではIPパケット)の調査したときのメモ。

何を調べる?

デフォルトは1500バイトである。OSごとに設定できる下限、設定したときにパケットが分割されるか、、を調べることにした。

結果

Windows

netshコマンドでMTUサイズを変更できる。

C:\WINDOWS\system32>netsh interface ipv4 set interface 6 mtu=575
パラメーターが間違っています。

C:\WINDOWS\system32>netsh interface ipv4 set interface 6 mtu=576
OK

C:\WINDOWS\system32>netsh interface ipv4 show interface

Idx     Met         MTU          状態                 名前
---  ----------  ----------  ------------  ---------------------------

  6          35         576  connected     イーサネット

最低値は576バイトのようだ。次に、MTUを1280バイト(後述)に設定する。

C:\WINDOWS\system32>netsh interface ipv4 set interface 6 mtu=1280
OK

C:\WINDOWS\system32>netsh interface ipv4 show interface

Idx     Met         MTU          状態                 名前
---  ----------  ----------  ------------  ---------------------------

  6          35        1280  connected     イーサネット

この状態で、1300バイト指定のpingを実行する。

C:\WINDOWS\system32>ping -l 1300 192.168.10.1

192.168.10.1 に ping を送信しています 1300 バイトのデータ:
192.168.10.1 からの応答: バイト数 =1300 時間 =25ms TTL=63
...

このときのWiresharkで取得したネットワークキャプチャデータは下記となる。
pingWin.png
分割されている。Ethernetヘッダを含めたサイズが1290バイト、IPパケットは1276バイト(1290-14)となっている。MTU=1280と指定したはずだが、4バイト差がある。

Mac

MTUatMac.png
MacでのMTU指定は簡単である。最小が1280。なので、さきほどのWindowsの検証でも、MTU値として1280を用いた。

$ /sbin/ifconfig en107
en107: flags=863<UP,BROADCAST,SMART,RUNNING,SIMPLEX> mtu 1280
...

ifconfigでも、MTU=1280となっている。1300バイトのpingを実施。

$ /sbin/ping -c 4 -s 1300 192.168.10.1
PING 192.168.10.1 (192.168.10.1): 1300 data bytes
1308 bytes from 192.168.10.1: icmp_seq=0 ttl=63 time=340.437 ms
...

Wiresharkで取得したネットワークキャプチャデータは下記となる。
pingMac.png
ここでも、Ethernetヘッダを含めたサイズが1290バイト、IPパケットは1276バイト(1290-14)となっており、4バイトの差がある。また、ICMPのデータサイズが、1292バイトとなっているところがよくわからず、、、。

Linux(lubuntu)

まずバージョン情報。

$ cat /etc/issue
Ubuntu 20.04.4 LTS \n \l
$ sudo ip link set dev enx00011b0c2a33 mtu 1
$ ip link show dev enx00011b0c2a33
2: enx00011b0c2a33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1
...

というわけで、MTUの最小値として、”1”が設定できる様子。次に、MTU=1280とする。

$ sudo ip link set dev enx00011b0c2a33 mtu 1280
$ ip link show dev enx00011b0c2a33
2: enx00011b0c2a33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 
...

1300バイトのpingを実施。

$ ping 192.168.10.1 -s 1300 -c 4
PING 192.168.10.1 (192.168.10.1) 1300(1328) バイトのデータ
1308 バイト応答 送信元 192.168.10.1: icmp_seq=1 ttl=63 時間=14.4ミリ秒

”1300(1328)”と見える。”()”の表記は不明。Wiresharkで取得したネットワークキャプチャデータは下記となる。
pingLinux.png
ここでも、Ethernetヘッダを含めたサイズが1290バイト、IPパケットは1276バイト(1290-14)となっており、4バイトの差がある。また、ICMPのデータサイズが、1292バイトとなっているところが、Macと同じ。MacもUnix系だからか、、?

終わりに

いずれにせよ、MTUサイズにより、クライアントOSでもパケットが分割されることを確認。微妙な差については、未調査。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?