By default, your Clear Linux* OS system automatically gets an IP address from your network via DHCP. If you do not have a DHCP server on your network or simply want to use a static IP address, follow the steps in this guide.


  1. Create this directory structure:

    sudo mkdir -p /etc/systemd/network
  2. Identify the interface to be assigned the static IP address:

    ip addr

    The system returns the following:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: wlp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
        link/ether 4a:98:8d:e5:43:15 brd ff:ff:ff:ff:ff:ff
    3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
        link/ether f4:4d:30:68:96:20 brd ff:ff:ff:ff:ff:ff
        inet brd scope global dynamic eno1
           valid_lft 6766sec preferred_lft 6766sec
        inet6 fe80::f64d:30ff:fe68:9620/64 scope link
           valid_lft forever preferred_lft forever

    In this example, we will use the eno1 interface.

  3. Create the file and add the following:

    sudo $EDITOR /etc/systemd/network/
    Name=[interface name]
    Address=[IP address]/24
    DHCP=yes # to get DNS info, etc.

    Replace [interface name] and [IP address] with your specific settings.

  4. Restart the networkd service:

    sudo systemctl restart systemd-networkd

Congratulations! You have successfully assigned a static IP address.