LoginSignup
7
5

More than 5 years have passed since last update.

IPoEでmtuを1500に出来ないときの解決法 (付・IPv6トンネルのmtuを1460にする方法)

Last updated at Posted at 2017-04-03

IPoEが開通して、やっとパケット損失無しの生活に突入しました。しかし、何故かmtuが1500にならないため調査。なお、OSはUbuntu前提となっています。

MTU 1500をセットするものの

Network-ManagerでMTUを1500に設定して繋ぎ直し、ifconfig eth1でMTUが1500になっているのを確認しましたが、何故か大きなパケットが通りません。

$ sudo ping6 -M do -s 1407 -c1 ipv6.google.com
PING ipv6.google.com(kix05s02-in-x0e.1e100.net) 1407 data bytes
ping: local error: Message too long, mtu=1407

--- ipv6.google.com ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

MTU = 1406 (ping6で通るペイロードの限界) + 40 (IPv6ヘッダサイズ) + 8 (ICMPv6ヘッダサイズ) = 1454。何かがおかしいです。結論から言うと、sysctl net.ipv6.conf.eth1.mtu が何故か1454になっていたので、sudo sysctl net.ipv6.conf.eth1.mtu=1500とすれば解決しました。原因は不明。

MTU変更後は、sudo ip -6 route flush cacheでIPv6のMTUのキャッシュをクリアし、ping6で1500バイトのパケットが通るか確認します。

$ sudo ping6 -M do -s 1452 -c1 ipv6.google.com
PING ipv6.google.com(nrt13s48-in-x0e.1e100.net) 1452 data bytes
72 bytes from nrt13s48-in-x0e.1e100.net: icmp_seq=1 ttl=54 (truncated)

--- ipv6.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 5.393/5.393/5.393/0.000 ms

IPv6トンネルのMTUを上げる

こちらの環境はDS-Liteであるため、DS-LiteのトンネルのMTUも上げときます。

DS-LiteのMTUは、1500 (IPv6のMTU) - 40 (IPv6ヘッダサイズ) = 1460 になるかと思いきや、標準ではencapsulation limitとして8バイトが必要となるため、MTUは1452となるらしいです。これを無効にするためには、ip -6 tunnel add時にencaplimit noneを追加すれば良いようです。再度トンネルを追加しなおせば、自動的にMTUが上がります。

$ sudo sysctl net.ipv6.conf.ip6tnl1.mtu
net.ipv6.conf.ip6tnl1.mtu = 1460

その後、sudo ip -4 route flush cacheでIPv4のMTUのキャッシュをクリアし、pingで1460バイトのパケットが通るか確認します。

$ ping  -M do -s 1432 -c1 www.google.com
PING www.google.com (216.58.197.196) 1432(1460) bytes of data.
72 bytes from nrt13s48-in-f4.1e100.net (216.58.197.196): icmp_seq=1 ttl=57 (truncated)

--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 5.824/5.824/5.824/0.000 ms

終わりに

やっぱり、定期的にnet.ipv6.conf.eth1.mtuが1454に戻ってしまいます。何が原因でしょうか? とりあえず、while [ 1 ]; do sysctl net.ipv6.conf.eth1.mtu=1500 > /dev/null; sleep 1 ; done を実行して回避しています。

追記: sudo /etc/init.d/network-manager restartでNetwork Managerを再起動したら治ったように見えます。Network Managerは鬼門だなぁ。

7
5
1

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
7
5