question

PatriceBrien-5709 avatar image
0 Votes"
PatriceBrien-5709 asked prmanhas-MSFT commented

Ubuntu and netplan

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-machinesoffice-teams-linux-itpro
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PatriceBrien-5709

Do you make the netplan in Microsoft Teams in Linux?

What is your version of Ubuntu?

0 Votes 0 ·


  • Netplan in Microsof Teams? (Sorry don't understand ou question)

  • Ubuntu 20.04LTS

0 Votes 0 ·

Hi @PatriceBrien-5709

I start playing with netplan.

Sorry, I don't understand what is your meaning of netplan? And I also curious about if this netplan is related to Teams for Linux?

0 Votes 0 ·

@PatriceBrien-5709 Can you please provide inputs as per ask so we can help you better?

Thanks

0 Votes 0 ·

T think the question is very easy to understand.

Even if I give you input, it wont help you.

Here is netplan configuration look like: (Not mine, it is juste an example)


network:
version: 2
renderer: networkd
ethernets:
en01:
addresses:
- 192.168.1.25/24
- "2001:1::1/64"
gateway4: 192.168.1.1
gateway6: "2001:1::2"
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4


If I decide to change DNS 8.8.8.8 to 1.1.1.1, on an server hosted by Azure, after reboot you will lose the 1.1.1.1 and return to 8.8.8.8

I mean every thing I do in netplan on a server hosted on Azure. I lose my netplan config.
So not possible to setup a static route in there.

But the same changes in an server hosted on my laptop under Virtualbox work.

0 Votes 0 ·
prmanhas-MSFT avatar image prmanhas-MSFT PatriceBrien-5709 ·

@PatriceBrien-5709 Thank you for responding back. Let me check internally on this and I will keep you posted once I have an update.

Thanks

0 Votes 0 ·

@PatriceBrien-5709 Any updates on the issue?

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

Thanks



0 Votes 0 ·

1 Answer

prmanhas-MSFT avatar image
0 Votes"
prmanhas-MSFT answered prmanhas-MSFT commented

@PatriceBrien-5709 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.








image.png (45.7 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DHCP was an example.
Static route, DHCP, etc, everything is erased after reboot when netplan is used under Azure

For my stactic route, I use @REBOOT in cron to execute a script that creat the route at reboot.

0 Votes 0 ·
prmanhas-MSFT avatar image prmanhas-MSFT PatriceBrien-5709 ·

@PatriceBrien-5709 Yes, all this network settings would get reset on reboot as we configure DHCP as default.

For static route can you please add in /etc/rc.local file which would get added whenever server reboots.

Like below (without those #)

135813-image.png

Hope it helps!!!

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



0 Votes 0 ·
image.png (162.7 KiB)