why tap device transmit icmpv6 ping request use the first ipv6 show in tap device?

90 Views Asked by At

I am opening a TAP device at centos 7, it has the IPv6 addresses fec0::a:1/64 and 2408:8160:a100:2::2. It has the route 3000::/64 via fec0::a:2.

I need to ping 3000::1 at host, use C program to reply neighbor advertisement, wireshark capture packet as follows:

enter image description here

The TAP device uses 2408:8160:a100:2::2 as source IP to send an ICMPv6 ping request.

I find that when I use "IP a" to show infomation of the TAP, 2408:8160:a100:2::1 is in front of fec0::a:1/64, so the source IP is 2408:8160:a100:2::2; if I add fec0::b:1/64 to TAP device, fec0::b:1/64 is in front of fec0::a:1, it will use fec0::b:1/64 as source IP.

"ip a" result as following: [enter image description here

if the TAP only has one IPv6 address fec0::a:1, the source IP will be fec0::a:1.

So how can I use fec0::a:1 as source IP forever when tap device has other IPv6 address?

0

There are 0 best solutions below