Changing to DHCP


#1

I can change the ip address of the host to a fixed IP address, but not back to dhcp again - any suggestions?

This works:
dhclient -r && ifconfig wlan0 192.168.1.180 netmask 255.255.255.0

This doesnt:

/sbin/dhclient-script: line 43: /etc/resolv.conf: Read-only file system```

#2

You should try to use dbus interface to interact with the host OS, including networking (see in the docs about Container Runtime for some overview, and the dbus communication section in particular).

There are some other posts in the forum that have examples on how to do this (controlling the network interface from within the container), for example this post. Either Connman (the network manager in resinOS 1.x) and NetworkManager (the one used in resinOS 2.x) can be controlled over dbus.

In general, network configuration within the container is precarious and have a lot of edge cases. What sort of use case you have in mind for this, if you don’t mind my asking?


#3

Hi there - the use case is a UI that manages the whole device, along with the services we have running on it - part of the admin is device ip/dhcp, hostname, wifi, etc.

We cant use dbus as we’re running under a non-root user and get security exceptions, see my other post on this - and I’d prefer to use standard well-documented linux commands if possible! I’m opening an ssh from the container to the host, and will provide (this one special, locked-down container) an ssh key once I’m on a prod resin.