image-builder-rpi icon indicating copy to clipboard operation
image-builder-rpi copied to clipboard

Okay, so who's being funny? Static IP are being set n+2*42!

Open Bazmundi opened this issue 5 years ago • 1 comments

I got myself a 32G SD card and used "flash --userdata setup.yml hypriotos-rpi-v1.12.3.img.zip" from my AMD64 Debian box. The setup.yml file was based upon the static.yml example at github and I had a static IP set to 192.168.0.100 .

Everything seemed to run fine and I booted the RPI3+ but found it at 192.168.0.184?!

When I opened up /etc/dhcpcd.conf on the RPI the IP address in that file was certainly set to 192.168.0.100 by the flash tool when flashing the image.

Not a problem when using black-pearl.local but I am having to use raw IP on occasion and have set up my IP map for the Hypriot based home server at 192.168.0.100.

This is a fresh install so what is likely the problem please?

Obviously, the IP changes each time giving it comes from DHCP and not a static IP. I was, of course, using a pop culture reference as 42 is the answer to the question of life, the universe and everything.

Bazmundi avatar Aug 20 '20 12:08 Bazmundi

One means "correct" this problem Hypriot 1.12.3 is actually cited in /etc/network/interfaces.d/50-cloud-init.cfg:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

So, I found the means was:

  1. Creating and editing /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg per guidance in /etc/network/interfaces.d/50-cloud-init.cfg, then
  2. Updating /etc/network/interfaces.d/50-cloud-init.cfg with static IP

When in/etc/network/interfaces.d/50-cloud-init.cfg change:

iface eth0 inet dhcp

to:

iface eth0 inet static
    address <your IPv4 address>/24
    gateway <your IPv4 gateway>

This at least fixes the problem for Hypriot 1.12.3.

The real fix seems to need to be either:

  1. flash needs be updated to detect a static IP being set and then carry out the knock on changes, or
  2. flash example be supplied if flash could, in fact, push /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg into the image and likely push an change to /etc/network/interfaces.d/50-cloud-init.cfg.

If it wasn't for the knock on problem that is.

The problem now though is that when I try docker-compose up I get:

$ docker-compose up
Pulling mybroker (emqx/emqx:v3.2.7)...
ERROR: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:59161->[::1]:53: read: connection refused

Created new issue to cover the impact of so-called "fix" of static IP.

Cheers, A

Bazmundi avatar Aug 22 '20 02:08 Bazmundi