2

I have an Ubuntu server 18.04 and simple netplan configuration (see below):

---
network:
  ethernets:
    ens1:
      dhcp4: false
      addresses:
      - "192.168.99.1/24"
    ens2:
      dhcp4: false
      addresses:
      - "172.20.0.82/23"
      gateway4: "172.20.0.1"
      nameservers:
        addresses:
        - "172.20.0.62"
  renderer: "networkd"
  version: 2

If I run the command: "ip link set dev ens1 down" so the corresponding interface has status "down". If then I run the command "netplan apply" so this interface brings up. How can I change netplan configuration (without committing and lines deleting) in order to have bring down and specified in netplan configuration interfaces not brought up?

1
  • 2
    This seems like an XY Question. It's not clear what problem you are trying to solve, but mucking about with netplan configs is almost certainly the wrong way to solve that problem.
    – user535733
    Jul 8, 2021 at 20:10

2 Answers 2

1

There is presently no support for defining interface configuration in netplan without netplan apply also bringing those interfaces up. This is a longstanding feature request which required systemd work before it could be implemented. The work is tracked at https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1664844.

Note that the tasks for Ubuntu bionic have been marked "wontfix"; so this will only be available in netplan in Ubuntu 20.04 and later.

1

You can use the keyword optional to reach your goal like below

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
      eno2:
          dhcp4: true
      eno1:
          optional: true

More detail can go to http://manpages.ubuntu.com/manpages/hirsute/man5/netplan.5.html and look for optional keyword

1
  • the man says - This is only supported by networkd.
    – Alex
    Sep 19, 2023 at 10:58

You must log in to answer this question.

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