Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

static ip address #159

Closed
souhaiebtar opened this issue Feb 15, 2017 · 8 comments
Closed

static ip address #159

souhaiebtar opened this issue Feb 15, 2017 · 8 comments

Comments

@souhaiebtar
Copy link

how to fix ip address, on raspbian jessy i normally edit /etc/dhcpcd.conf file,
but in hypriot os this file doesn't exist and even if i create it and edit i, the change in it does not take effect even after reboot, how we can fix and change fixed ip address on hypriotos, sorry for the bothering and thanks for this great work,

Salam,
Peace

@carljmosca
Copy link

check /etc/network/interfaces.d for your interface(s)

@firecyberice
Copy link
Member

Currently we do not have dhcpcd installed by default so creating /etc/dhcpcd.conf has no effect.

@souhaiebtar
Copy link
Author

i already find a way, you can check device-init#6

@StefanScherer
Copy link
Member

We have switched to cloud-init.
Cloud-init normally does static IP with other files, but then you need the MAC address of your Pi. But what if you want to unbox a fresh RPi and flash and boot it?

With cloud-init there is another hacky way to write the information into /boot/user-data file

#cloud-config
# vim: syntax=yaml
#

# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
hostname: static
manage_etc_hosts: true
# don't write debian.org into apt mirrors
apt_preserve_sources_list: true

# You could modify this for your own user information
users:
  - name: pirate
    gecos: "Hypriot Pirate"
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    groups: users,docker,video
    plain_text_passwd: hypriot
    lock_passwd: false
    ssh_pwauth: true
    chpasswd: { expire: false }

package_upgrade: false

# Static IP address
write_files:
  - content: |
      persistent
      # Generate Stable Private IPv6 Addresses instead of hardware based ones
      slaac private

      # static IP configuration:
      interface eth0
      static ip_address=192.168.1.31/24
      #static ip6_address=fd51:42f8:caae:d92e::ff/64
      static routers=192.168.1.1
      static domain_name_servers=192.168.1.1 8.8.8.8

    path: /etc/dhcpcd.conf

@machine1104
Copy link

not working for me :(

@isc30
Copy link

isc30 commented Mar 19, 2019

same, not working with v1.10.0

@vishco
Copy link

vishco commented May 31, 2020

not working for me either

@Bazmundi
Copy link

Bazmundi commented Aug 23, 2020

Does not work with 1.12.3 either. I note there are other so-called static IP "hacks" for Hypriot but you can ignore them. They work in as far you end up with a static IP, but they involve disabling cloud init and so stop /etc/resolv.conf automatically being updated with nameservers from your gateway configuration. So, you end up with a RPi that cannot connect to the net and cannot pull docker images.

The explanation above does update /etc/dhcpcd.conf for sure but the IP address for your RPi will still be DHCP driven since Hypriot appears not to use /etc/dhcpcd.conf >insert shrugging shoulder emoji<.

The saga continues as there is something systemically wrong as the flash tool is not able to touch up all things that need be touched to get the static IP running and leaving /etc/resolv.conf to be automatically updated by whatever DHCP client is being shutdown by the static IP "hacks".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants