7

My system is a Dell PowerEdge T140, running Ubuntu 18.04.2.

I have a service that depends on the host's primary IP address, and that service fails to start if that address is not configured on the host.

Is there a way to have netplan bring a statically-configured interface up, even if the link for that interface is down at boot time, and keep it up if if the link is lost at any given time? I haven't been able to do it yet, neither with NetworkManager nor with networkd as the renderer.

During my testing, I tried to force the network up with ip link set eno1 up, but it didn't work. However, e.g. ifconfig eno1 192.168.1.1 netmask 0xffffff00 does work, and possibly I could use it as a workaround (by doing something like adding that command to rc.local and forcing the broken service to restart).

The workaround solution, however, is very ugly, and it uses a tool (ifconfig) which is no longer in the default installation, so I'd rather avoid it, and stick to being as close to standard configurations as possible.

5
  • I know that with Debian if you configure a static interface in /etc/network/interfaces, NetworkManager won't touch that interface, and you can then configure the IP address on that interface irrespective of the link being up or not. However perhaps Ubuntu is different.
    – wurtel
    Mar 29, 2019 at 15:35
  • 1
    Related, ifconfig replacement is ip addr. command -v ifconfig and command -v ip will tell you which one is available. I miss the old days when hostname, ifconfig, cron and friends worked...
    – user56041
    Mar 29, 2019 at 17:13
  • actually one ifconfig command setting an address should be replaced with two commands: ip addr add ... + ip link set ... up, because the up is implicit in ifconfig in such case.
    – A.B
    Mar 29, 2019 at 17:57
  • 1
    possible explanation there: Why is Netplan/Networkd not bringing up a static ethernet interface?
    – A.B
    Mar 29, 2019 at 18:00
  • @A.B, yes... I think it is the right explanation. Thank you for the find (I did a lot of search before asking my question, but maybe not with the correct terms)! I'll try it as soon as I return home.
    – Paulo1205
    Mar 29, 2019 at 19:44

1 Answer 1

6

The boolean property ignore-carrier does the trick. In your netplan yaml file (typically under /etc/netplan/):

     eno1:
        ignore-carrier: true
        addresses:
        - 192.168.1.1/24
        match:
            macaddress: <NIC MAC addr>
        mtu: 1500
        optional: true
        set-name: eno1

More details at Netplan Reference

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .