Score:1

Ubuntu 20.04 stop/start/reload network stack with netplan

us flag

I have looked at all the solutions about how to stop/start/reload the network stack when using netplan configurations (without installing NetworkManager or nmcli) and none of them seem to give a complete option of how to restart the network stack.

I tried:

sudo systemctl stop networking; sudo systemctl start networking sudo systemctl restart networking

sudo systemctl restart sytemd-networking

sudo ifdown ; sudo ifup interface

and obviously

sudo netplan apply

I'm looking for a method that essentially will turn off all the networking and start everything from scratch - as if it were a reboot but without having to reboot. This is especially critical when VLANs are defined since none of the methods that I have tried know how to remove a VLAN definition even if it not longer appears in the /etc/netplan/*.yaml files.

Here is an example netplan file that I was using (this one doesn't include a VLAN though but happened with this file as well):

$ cat /etc/netplan/01-network-manager-all.yaml
  network:
  version: 2
  renderer: networkd
  ethernets:
          enp226s0:
                  dhcp4: no
                  addresses: [192.168.10.32/24]
                  gateway4: 192.168.10.254
                  nameservers:
                          addresses: [192.168.1.11]
                          search: [road2.local]
          enp225s0f0:
                 dhcp4: no
                 mtu: 9000
          enp225s0f1:
                 dhcp4: no
                 mtu: 9000
  bonds:
          bond0:
                 dhcp4: no
                 mtu: 9000
                 interfaces:
                           - enp225s0f0
                           - enp225s0f1
                 parameters:
                           mode: balance-rr
                           mii-monitor-interval: 100
  bridges:
          br0:
                 dhcp4: no
                 mtu: 9000
                 interfaces:
                           - bond0
                 addresses: [192.168.1.10/24]
                 gateway4: 192.168.1.254
                 routes:
                           - to: 192.168.9.0/24
                             via: 192.168.1.254
Bodo avatar
pt flag
You should [edit] your question and add links to "all the solutions" you looked at and show the "methods you have tried".
user535733 avatar
cn flag
Your question should show the `renderer:` line of your Netplan YAML.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.