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.

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:

    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 192.168.178.88 255.255.255.0 192.168.178.1 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. 192.168.178.88 represents the chosen static IP address itself
    3. 255.255.255.0 is the network mask used for the target network
    4. 192.168.178.1 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.

One thought on “Set static IP on LibreELEC

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.