Airgapped Self-Bootstrap with unknown IP addresses?

Scenario: I have 3 nodes in a shipping container with no access to the outside world and no knowledge of what exists in their surround network/services environment.

I need them to come up and join together in to a Consul Cluster, and I don’t know what their IPs are, or if there’s even DHCP available.

How to do this?

My initial thought is that through zeroconf (avahi) I can give every node a link-local address, then have that get advertised as “node-x.consul.local” and put those “node1/2/3.consul.local” hostnames in my consul config. … but this ridiculous avahi bug makes me hesitant:

Is there a better/obvious way to do this that I’m missing?

Is it correct to say they won’t know what their network subnet will be ahead of time?

Yes, that’s absolutely correct- and I’m hoping that avahi bug can be worked around by disabling IPV6 (or I’ll have my team fix the code themselves- go go open source!)

These nodes need to self-identify, advertise their presence, and then come together.
I am thinking that I can can hardcode some known hostnames (3 or 5 of them) and include some startup mDNS->response logic that mirrors the initial link-local address setup:

“If hostname-x is unresolvable, assume I am hostname-x → advertise this hostname on my link-local IP via mDNS”
“If hostname-x resolves, try hostname-x+1”

Where I’m a bit cloudier is how I’ll want to set the various consul bootstrap options to “look out properly” for this kind of startup.
From here: Bootstrap a Datacenter | Consul | HashiCorp Developer

It seems that if I start them all up with “-bootstrap-expect 3” and “-retry-join hostname-1 -retry-join hostname-2 -retry-join hostname-3” then everything should JUST WORK assuming I can get them all on those hostnames with link-local addresses. Anything I’m missing?

Since you’re considering link-local addresses it seems like they only need to communicate with each other and nothing else on the network. You could pick your own IP subnet and hardcode their IP addresses with a VLAN.

If you have three nodes in a shipping container with no access to the outside world and no knowledge of their IPs or the surrounding network environment, setting up a Consul Cluster can be challenging. However, there are a few alternative approaches you can consider to achieve this without relying on avahi or DHCP.

This feature has been requested in the past. Here’s a related thread where another user was requesting this same capability.

I recommend upvoting the following GitHub issue so that we can more accurately gauge interest in this feature. Thanks!