DEV Community

Cover image for Netplan: Bring interface up even if link is down
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Netplan: Bring interface up even if link is down

Netplan is a utility for easily configuring networking on a linux system.

We can specify a static configuration for an interface, for example eth0.

Here is a basic configuration of a static network interface:

network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            addresses:
                - 192.168.50.1/24
Enter fullscreen mode Exit fullscreen mode

Every time the system boot will assing the fixed IP 192.168.50.1 to the eth0 network interface if it's up.

But what happens if the cable is not connected or the link is down, aka there's no carrier?
Well, the system will try to get up the interface and will fail due to timeout, so the fixed IP address will never be configured to the interface.

If we have services that bind to that interface, those will also fail.

So, if we want the interface to be up even if there's no connection, we have to set the boolean ignore-carrier property in our Netplan configuration file.

network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            ignore-carrier: true
            addresses:
                - 192.168.50.1/24
Enter fullscreen mode Exit fullscreen mode

With this property, even if the cable is not connected, the interface will be up and all the services binded will be running.

This is useful if you're configuring a DHCP server, so the interface is always up waiting for a cable to be connected to start providing DHCP leases.

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs