LoginSignup
AKIHARU-m
@AKIHARU-m

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

ping6の from のインターフェースを指定する方法はありますか

解決したいこと

2つのラズパイ(仮に A と B )をハブを経由して有線で繋げています。
AはWifiも有効になっており、無線ルータにも繋がっています。
BはWifiは無効状態です。
この時、ping6 B が unreachableになってしまうことがあります。

ping6 結果

A: $ ping6 B.local
PING B.local(B.local (fe80::44d1:690c:8b22:fdf)) 56 data bytes
From A.local (fe80::ab19:e12f:8dae:261c%wlan0): icmp_seq=1 Destination unreachable: Address unreachable
From A.local (fe80::ab19:e12f:8dae:261c%wlan0): icmp_seq=2 Destination unreachable: Address unreachable

その時のping6 の表示を見ると、
自分(つまり A)のIPv6アドレスが Wifi側(wlan0)になっています。

ping6が通らない時の 各ラズパイの IPアドレス

ラズパイA
A:$ ifconfig (一部のみ抜粋)
eth0: inet 169.254.251.32 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::b37f:e233:ea18:8bfe prefixlen 64 scopeid 0x20
ether b8:27:eb:b8:36:97 txqueuelen 1000 (イーサネット)
wlan0: flags=4163 mtu 1500
inet 192.168.11.46 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::ab19:e12f:8dae:261c prefixlen 64 scopeid 0x20

ラズパイB
B:$ ifconfig (一部のみ抜粋)
eth0: inet 169.254.14.46 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::44d1:690c:8b22:fdf prefixlen 64 scopeid 0x20
ether b8:27:eb:b9:73:27 txqueuelen 1000 (イーサネット)
wlan0: ether b8:27:eb:flag_ec:26:72 txqueuelen 1000 (イーサネット)

ラズパイの起動によっては、ping6のFromがWifi側ではなく有線側(eth0)になることがあり、その時には 問題なく pin6が通ります。

また、ping6ではなく、ping では問題は発生しません。

0

1Answer

   -I interface
      interface is either an address, an interface name or a VRF name. If interface is an address, it sets source address to specified interface address. If
      interface is an interface name, it sets source interface to specified interface. If interface is a VRF name, each packet is routed using the corresponding
      routing table; in this case, the -I option can be repeated to specify a source address. NOTE: For IPv6, when doing ping to a link-local scope address, link
      specification (by the '%'-notation in destination, or by this option) can be used but it is no longer required.

-I で指定できると思います。
例)

ping6 -I fe80::ead8:d1ff:fecf:b2b6%eth0 fe80::124b:46ff:febb:340f
0Like

Comments

  1. @AKIHARU-m

    Questioner

    ありがとうございます。ご指摘の方法でping6が通りました。IPアドレスを書かなくてもインターフェース名だけでも通ることが確認できました。ありがとうございました。

    $ ping6 -I fe80::b37f:e233:ea18:8bfe%eth0 B.local
    PING B.local(B.local (fe80::44d1:690c:8b22:fdf)) from fe80::b37f:e233:ea18:8bfe%eth0 eth0: 56 data bytes
    64 bytes from B.local (fe80::44d1:690c:8b22:fdf%eth0): icmp_seq=1 ttl=64 time=0.637 ms

    $ ping6 -I eth0 B.local
    ping6: Warning: source address might be selected on device other than eth0.
    PING B.local(B.local (fe80::44d1:690c:8b22:fdf)) from :: eth0: 56 data bytes
    64 bytes from B.local (fe80::44d1:690c:8b22:fdf%eth0): icmp_seq=1 ttl=64 time=0.679 ms
    64 bytes from goro37.local (fe80::44d1:690c:8b22:fdf%eth0): icmp_seq=2 ttl=64 time=0.759 ms

Your answer might help someone💌