TritonDataCenter / smartos-docs

SmartOS Wiki static site
https://docs.smartos.org/
15 stars 46 forks source link

docs/setting-up-ipv6-in-a-zone.md: IPv6 instructions not valid for Bhyve/KVM zones #76

Open blackhelicoptersdotnet opened 2 weeks ago

blackhelicoptersdotnet commented 2 weeks ago

The procedure for configuring IPv6 set out in docs/blob/master/docs/setting-up-ipv6-in-a-zone.md does not work for Linux in Bhyve or KVM zones.

The addrconf value gets passed to cloud-init as an IP address but cloud-init has no idea what to do with it, and so it throws an error.

# cloud-init status -l
status: error
extended_status: error
boot_status_code: enabled-by-generator
last_update: Mon, 21 Oct 2024 00:52:15 +0000
detail:
Cloud-init enabled by systemd cloud-init-generator
errors:
    - Address addrconf is not a valid ip address
    - Address addrconf is not a valid ip address
recoverable_errors:
ERROR:
    - Address addrconf is not a valid ip network
    - Address addrconf is not a valid ip network
WARNING:
    - failed stage init
    - failed stage init-local

/var/lib/cloud/instances/c3cfc40e-9b68-4330-bbd1-5f36f4439815/network-config.json

{
 "config": [
  {
   "mac_address": "e2:7f:c1:50:eb:99",
   "name": "net0",
   "subnets": [
    {
     "address": "10.64.1.130/26",
     "gateway": "10.64.1.129",
     "type": "static"
    },
    {
     "address": "addrconf",
     "type": "static"
    }
   ],
   "type": "physical"
  },
  {
   "address": [
    "10.64.255.1"
   ],
   "search": [],
   "type": "nameserver"
  }
 ],
 "version": 1
} 
blackhelicoptersdotnet commented 2 weeks ago

I've got a PR pending in cloud-init to fix the issue there, but it might not be backported to images that are presently in the wild, and so the docs may continue to cause some confusion.

https://github.com/canonical/cloud-init/pull/5831

bahamat commented 2 weeks ago

Hi @blackhelicoptersdotnet,

Yes, this is most definitely a bug in cloud-init not recognizing how we designate address auto configuration.

One thing about your cloud-init PR, in SmartOS addrconf means either stateless (i.e., SLAAC), or stateful (DHCPv6) configuration. I notice that you set subnet = {"type": "dhcp6"}. If cloud-init has a distinction for SLAAC, that should be accounted for. Otherwise, that PR looks good from my perspective.

blackhelicoptersdotnet commented 2 weeks ago

@bahamat I was thinking the same thing. It turns out that dhcp6 in cloud-init is imprecisely named; in practice it results in SmartOS addrconf style behaviour on most/all distros.

There are other options, such as ipv6_dhcpv6-stateful to force specific behaviour.

bahamat commented 2 weeks ago

@blackhelicoptersdotnet Ok, great. Sounds good.