Score:0

Undoing netplan configuration in Ubuntu 22.04.2 LTS

mv flag

I've followed the highest voted answer by heynnema on this Linux Ubuntu Server 20.04 LTS: 'Network Unreachable' question on netplan:

  1. Changed /etc/netplan/'01-network-manager-all.yml content to
  network:
      version: 2
      renderer: networkd
      ethernets:
        enp4s0:
          addresses:
            - 192.168.1.200/24
          gateway4: 192.168.1.254
          nameservers:
            addresses:
              - 8.8.8.8
              - 8.8.4.4
  1. ran following commands
sudo netplan generate
    
sudo netplan apply
    
reboot # mandatory

and am now cut off from the internet on that machine. I had made a copy of the original '01-network-manager-all.yml' file and ran the commands specified in the answer again on that,

sudo netplan generate

sudo netplan apply

reboot # mandatory

but to no success. How can I undo those netplan changes?

Edit:

ip a output:

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 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 5c:ba:ef:cd:c6:19 brd ff:ff:ff:ff:ff:ff
    inet 192.168.30.19/24 brd 192.168.30.255 scope global dynamic noprefixroute wlp1s0
       valid_lft 604268sec preferred_lft 604268sec
    inet6 fe80::44ae:37a2:66c5:b8ce/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: lxcbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
       valid_lft forever preferred_lft forever
4: br-bd526d132fb7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:24:07:b4:a3 brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-bd526d132fb7
       valid_lft forever preferred_lft forever
    inet6 fe80::42:24ff:fe07:b4a3/64 scope link 
       valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:fd:ac:22:cc brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
7: vethc2e94a7@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-bd526d132fb7 state UP group default 
    link/ether 1e:00:18:36:2a:c7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::1c00:18ff:fe36:2ac7/64 scope link 
       valid_lft forever preferred_lft forever
mpboden avatar
do flag
Is this Ubuntu Desktop or Server installation? Is that your correct gateway address?
user_90809 avatar
mv flag
Ubuntu Desktop Installation and the gateway address was wrong as I just found out, but changing it, executing the commands and rebooting did not fix the problem.
mpboden avatar
do flag
If it’s a Desktop installation, change the renderer line to `renderer: NetworkManager`. The desktop install doesn’t use `networkd`
user_90809 avatar
mv flag
Done. The issue unfortunately is still there.
user_90809 avatar
mv flag
I just don't know why reverting to the original file content does not fix the network connection.
us flag
The Desktop installation uses whichever backend you configure it to use.
us flag
Why are you using static networking instead of DHCP?
mpboden avatar
do flag
Please update your question to include the output if `ip a`.
mpboden avatar
do flag
@slangasek True…Desktop can use `networkd`. I misspoke. But by default, Desktop is using Network Manager. So if OP wants to use `networkd`, then they’d have to stop, disable, and mask Network Manager service. Then unmask, enable, and start `systemd-networkd` service. I made an assumption that this hasn’t been done.
user535733 avatar
cn flag
You can choose whichever (`networkd` vs. `NetworkManager`) you prefer, but we strongly recommend NetworkManager for desktop users unfamiliar with the details of networking. `netplan` will set up your network *exactly* the way you specify, even if your specification is wrong.
user_90809 avatar
mv flag
@user535733 And how do I revert to NetworkManager? My 01-network-manager-all.yaml file in /etc/netplan/ contains the original file content and I tried to do exactly that.
user_90809 avatar
mv flag
@mpboden I want to revert back to the original NetworkManager solution. I don't want to use networkd. Will update my question with ip a output.
mpboden avatar
do flag
Your new YAML file is setting up a static IP on the `enp4s0` interface, but the output of `ip a` indicates that you don’t have an interface of that ID. So I would start by deleting the YAML file you created and restore the original so that there is only one YAML file in the `/etc/Netplan` directory.
user_90809 avatar
mv flag
@mpboden That's what I did when I noticed the internet connection was gone, which didn't help.
I sit in a Tesla and translated this thread with Ai:

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.