Last Updated on 2015-06-23.
Scenario
You want to change the DHCP IP mode of your OpenELEC system to static IP, but you can only access it via LAN at the moment for whatever reason, so you cannot do it via GUI.
(Background: You might want to open certain firewall ports only for certain static IPs, or avoid problems with DHCP routers. Especially in Austria, many A1 modems include a DHCP server which is extremely buggy, loses routes, host names etc.)
Solution
Using OpenELEC, you will not find IP settings at the usual places like /etc/network/interfaces or similar.
This is the path for a Raspberry Pi 2 system, but I am pretty sure it is similar to other devices:
/storage/.cache/connman/ethernet_xxxxxxxxxxxx_cable/settings
Don’t get confused because of the .cache directory, the settings are saved permanently anyway.
The “xxxx” stands for the MAC address of your device which you can find with command “ifconfig” -> e.g. at part “eth0”.
In the “ethernet_xx_cable” folder you might find other settings files with various endings. As far as I experienced, you can ignore them all and only make changes to the “settings” file itself.
Example for a static IP setting:
[yourMAC] #CAUTION: Leave the original first line with your MAC in the file! Name=Wired AutoConnect=true Modified=1970-01-01T00:00:08.008510Z IPv4.method=manual IPv4.DHCP.LastAddress=10.0.0.1 IPv6.method=off IPv6.privacy=disabled IPv4.netmask_prefixlen=24 IPv4.local_address=10.0.0.124 IPv4.gateway=10.0.0.138 Nameservers=10.0.0.138; Timeservers=pool.ntp.org;0.pool.ntp.org; Domains=home;
Save the file, reboot your device and you should be able to access 10.0.0.124.
Excellent info. There is also a bit simpler way, ssh and type:
connmanctl config “$(connmanctl services | awk ‘/^\*/ {print $3}’)” –ipv4 manual 192.168.1.8 255.255.255.0 192.168.1.1
to set the IP address to 192.168.1.8 and gateway to 192.168.1.1. Adjust these two as you need them.