Ubuntu and netplan

Patrice Brien 21 Reputation points
2021-09-09T21:23:04.573+00:00

I start playing with netplan.
What I apply is working, until I reboot.

Netplan YAML file reset and what I done is lost.

  • How to keep my new configuration after reboot?
  • Also, why if I set nameservers in the netplan file, when I do a nslookup, these new NS are not used?
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,196 questions
Skype for Business Linux
Skype for Business Linux
Skype for Business: A Microsoft communications service that provides communications capabilities across presence, instant messaging, audio/video calling, and an online meeting experience that includes audio, video, and web conferencing.Linux: A family of open-source Unix-like operating systems.
456 questions
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,891 Reputation points Microsoft Employee
    2021-09-22T05:32:48.84+00:00

    @Patrice Brien Thank you for your patience over the matter!!!

    I had discussion internally and below are the inputs I got :

    It looks like DHCP is overwriting the Netplan file when rebooted. Please try below format.

    network:  
    version: 2  
    renderer: networkd  
    ethernets:  
     eno1:  
     dhcp4: no                                             #No DHCP  
     dhcp6: no                                             #No DHCP  
     addresses: [ 10.64.12.18/29 ]  
     nameservers:  
              addresses: [10.64.5.5,10.64.6.6]            #DNS IPs  
          routes:                                   #Static routes  
                  - to: 10.0.0.0/8  
                    via: 10.64.12.17  
        eno2:                                     #Second interface in this example  
          dhcp4: no                                               #No DHCP  
          dhcp6: no                                               #No DHCP  
          addresses: [ 104.44.223.89/26 ]  
          gateway4: 104.44.223.65                         #Default gateway in this case  
    

    Also If you are looking for adding custom name servers alone its better to do it from Portal rather than updating from OS. When DHCP in place, any changes to all this files will get reset during reboot or refreshing the dhcp service.

    134212-image.png

    If we need to add custom domain as well then use /etc/dhcp/dhclient.conf for both

    Hope it helps!!!

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.


0 additional answers

Sort by: Most helpful