Set static IP on LibreELEC

Today I stumbled upon the fact that my KODI based media box (Raspberry Pi 4) is still using a dynamic IPv4 address. Hence I want to connect via ssh regularly, I had to set a static IP on LibreElec (former OpenELEC) which my KODI mediacenter is running on.
Static IP on LibreEllec Logo

To achieve that, I had to connect to the Raspberry via SSH and ran the following command.

$> connmanctl config "$(connmanctl services | awk '/^\*/ {print $3}')" --ipv4 manual

What this command does to set a static IP on LibreELEC is:

  1.  It determines the the currently used  service interface via  “$(connmanctl services | awk ‘/^\*/ {print $3}’)” .
    connmanctl services  gives a list of a available services to connect to the network.
    For example:

    *AO Wired                ethernet_dca12324234f3_cable
        WLAN01               wifi_dca12324234f3_4ee233232232256c61_managed_psk
        o2-WLAN40            wifi_dca12324234f3_656ff574c4f86e3430_managed_psk
        OTHERWLAN            wifi_dca12324234f3_888fff887_managed_psk

    As you can see, it lists LAN and WiFi based connection services as well.
    The second part after the pipe (awk ‘/^\*/ {print $3}’ ) filters the output after the line starting with an asterisk (*), which identifies the currently used connection. Afterwards it returns the last part of the line (here: ethernet_dca12324234f3_cable).

  2. The determined interface name is used by the connmanctl config  command as parameter. So the target interface for the subsequent  settings ist defined.
  3. Finally the IP settings are defined by –ipv4 manual to set a static IP on LibreELEC.
    The distinct parts have the following meanings:

    1. –ipv4 manual specifies that the IP should be bound statically
    2. represents the chosen static IP address itself
    3. is the network mask used for the target network
    4. is the gateway to use for that connection

That’s it! After executing the command, the connection is lost immediately and you have to reconnect by using the newly created static IP.  As you can see, its not that hard to set a static IP on LibreELEC.

4 thoughts on “Set static IP on LibreELEC

    1. Hello Steve,
      did you already try the command from my first comment?
      If this didn’t work either, please give me the whole command causing this error. I don’t have an LibreELEC anymore, but perhaps I can see, what’s wrong.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.