GithubHelp home page GithubHelp logo

Static ip about device-init HOT 6 OPEN

hypriot avatar hypriot commented on July 27, 2024 21
Static ip

from device-init.

Comments (6)

souhaiebtar avatar souhaiebtar commented on July 27, 2024 4

to fix ip address
sudo nano /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
#source-directory /etc/network/interfaces.d
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.97
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8

ctrl+x and tape y than ENTER
don't forget to use your own address, network, broadcast and gateway
the gateway address is the address of your internet router, the one you use to get access to modem panel, for network generally the first 3 par (for me 192.168.1.) and add 0, for broadcast same as before but it end with 255, the gateway should already be calculated, for dns-nameservers you can use the same ( it's of google)

from device-init.

ryansch avatar ryansch commented on July 27, 2024

This has been open for nearly a year; any plans to make it a reality? I'm looking for a solution to recovery from a power outage where my dhcp server isn't up yet when the pi boots.

from device-init.

Tabaluga avatar Tabaluga commented on July 27, 2024

Dear @tsouhaieb ,

your fix is working indeed but the dns-nameservers are not copied over to the /etc/resolv.conf file.

After every reboot I need to add the nameservers to re-establish the network-connection with sudo /etc/resolv.conf.

Is there a fix already present or perhaps another solution?

best regards

from device-init.

gadieichhorn avatar gadieichhorn commented on July 27, 2024

the workaround works but would be great to have a solution with config and without a need to log in to the pi and set this manually. This is useful when using a cluster (k8s) you dont want IP to change. thanks

from device-init.

StefanScherer avatar StefanScherer commented on July 27, 2024

We no longer actively maintain device-init any longer. HypriotOS 1.7.0 switched to cloud-init.
Here is an example to set a static IP address with the user-data cloud-config file.
https://github.com/hypriot/flash/blob/master/sample/static.yml

from device-init.

Bazmundi avatar Bazmundi commented on July 27, 2024

@StefanScherer

We no longer actively maintain device-init any longer. HypriotOS 1.7.0 switched to cloud-init.
Here is an example to set a static IP address with the user-data cloud-config file.
https://github.com/hypriot/flash/blob/master/sample/static.yml

Yep and using that exact example file (with IP addresses edited to suit) and flash (2.7.0) to burn Hypriot 1.12.3 to SD does not result in a static IP being set when RPi booted with SD inserted. The RPi still is running on auto IP via DHCP. Any hacks to set a static IP have knock on problems.

Command line that uses your suggestion @StefanScherer but does not result in static IP working:

flash --userdata static.yaml hypriotos-rpi-v1.12.3.img.zip

Noting /etc/dhcpcd.conf is definitely set according to --userdata.

Noting /etc/resolv.conf is auto populated with name servers, pull from gateway via DHCP server on gateway, and so name resolution is provided.

However IP is provided DHCP and not static.

Noting also that if static IP hack is used to "fix" the problem with --userdata method failing, /etc/resolv.conf will end up empty of references to nameservers and you therefore don't get name resolution. For example, using Hypriot 1.12.3 with static IP hacks and no name services means you cannot pull docker images since you cannot find the hub on the internet.

The missing nameservers in /etc/resolv.conf is because all suggested hacks, for getting around --userdata method failing, involve disabling cloud-init. Understanding also that a warning is provided in /etc/resolv.conf to the effect manual entry of nameservers is verboten, because the contents of /etc/resolv.conf will be automatically replaced.

Something clearly needs to be done to allow static IP being set that doesn't require hacks and takes account of the problems with setting of static IP, including disabling of cloud-init, and therefore of dropping access to nameservers. Copying junk into /etc/dhcpcd.conf does not appear to help nor does the other hacks on offer.

from device-init.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.