1

I'm receiving a IPv6 address from a mobile network. The connection management is handled by mbim-network. I like to add a static IPv6 address to my interface and have several questions to the procedure. Also I like to check with you guys if the steps are correct.

1) After the connection is established im querying the assigned IP and add it to my wwan0 interface. Querying the IP configuration:

[/dev/cdc-wdm0] IPv6 configuration available: 'address, gateway, dns'
 IP [0]: 'fe80::1:1:4a8c:75b0/120'
Gateway: 'fe80::1:1:4a8c:7501'

I don't understand why I receive a Link IP, I expected to receive a Global IPv6 address.

2) I add the received IP and gateway to wwan0 interface

ip addr add fe80::1:1:4a8c:75b0/120 dev wwan0
route add default gw fe80::1:1:4a8c:7501

Checking ifconfig

wwan0     Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
      inet6 addr: 2a02:d20:10:ee:xxxx:xxxx:xxxx:xxxx/64 Scope:Global
      inet6 addr: fe80::1:1:4a8c:75b0/120 Scope:Link
      inet6 addr: fe80::bc17:cff:fe0e:6b3a/64 Scope:Link
      UP BROADCAST RUNNING NOARP MULTICAST  MTU:1428  Metric:1
      RX packets:43 errors:0 dropped:0 overruns:0 frame:0
      TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:4480 (4.3 KiB)  TX bytes:3280 (3.2 KiB)

I now see that I received a global IP address, how is this coming? I read something about SLAAC, where the router is broadcasting its prefix.

3) Now adding my prefered static IP

ip addr add 2a02:d20:10:ee::xxxx/64 dev wwan0

ping6 on the static IP is working from outside, still I'm not sure if I did this the correct way.

Thanks for your help, Matthias

moatze
  • 11

1 Answers1

1

Apparently your provider does some magic when an interface appearing with a certain link-local address in the network, probably this triggers sending a Router Advertisement which contains the globally routable prefix. From this the OS generates the address - yes, this is how SLAAC works. What the interface ID is depends on the kernel configuration and compiled-in features; it could be the same as the for the default link-local address (which, by the way, gives your HW address away that you cared to mask out) or it could be a random one.

I'm not sure if I did this the correct way.

In principle, the way you did it is correct, but it is not persistent across reboots. If you don't like (for whatever reason) the default globally unique address and if the prefix is changing, then you need a bit of post-init scripting in order to add your desired address; if the prefix is fixed, then you can just assign this address statically.

countermode
  • 7,533
  • 5
  • 31
  • 58
  • I put some more reading in this and found a way to use ip token set ::xxxx dev wwan0- but this results in RTNETLINK answers: Invalid argument. See: https://unix.stackexchange.com/questions/335596/ipv6-addressing-dynamic-prefix-static-local-part – moatze Sep 14 '17 at 10:23