0

I started using netplan on my Ubuntu hosts with NetworkManager as a renderer and I noticed that it fails to retrieve an IPv4 address from my router using DHCP. I NetworkManager. I can set the option to require an IPv4 address. How do I do this with netplan? I checked the examples on netplan.io and documentation on GitHub.

Update: Here is my /etc/netplan/01-netcfg.yaml

network:                                                                                                                                                                                                                                                                   
  renderer: NetworkManager                                                                                                                                                                                                                                                 
  version: 2                                                                                                                                                                                                                                                               
  ethernets:                                                                                                                                                                                                                                                               
    eno2:                                                                                                                                                                                                                                                                  
      dhcp4: true                                                                                                                                                                                                                                                          
      dhcp6: true                                                                                                                                                                                                                                                          
      ipv6-privacy: false                                                                                                                                                                                                                                                  
      accept-ra: false                                                                                                                                                                                                                                                     
      dhcp-identifier: mac 

Edit: Looking at existing NetworkManager connections in /etc/NetworkManager/system-connections/ the option I'm looking for is ipv4.may-fail. Adding ipv4.may-fail: false or ipv4-may-fail: false to my netplan yaml results in an error:

$ sudo netplan apply 
/etc/netplan/01-netcfg.yaml:9:7: Error in network definition: unknown key 'ipv4-may-fail'
      ipv4-may-fail: false
      ^
  • This question is too vague to answer. Please provide the exact text of the netplan config you're using which does not work as you expect. – slangasek Aug 5 at 16:15
  • Are you using a Desktop or Server installation? – heynnema Aug 5 at 23:36
  • It is a desktop installation. – LiveWireBT Aug 7 at 17:40
1

With a Desktop installation, you should be using NetworkManager. Netplan is really for Server installations.

Netplan .yaml files are VERY fussy. No tabs, specific indentation, no extra spaces (you had lots of these at the end of each line).

To use NetworkManager...

Set your .yaml file to:

network:
  renderer: NetworkManager
  version: 2

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot computer

And configure your network connections using the NM GUI.

To use netplan...

Set your .yaml file to:

network:
  renderer: networkd
  version: 2
  ethernets:
    eno2:
      dhcp4: true
      dhcp6: true

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot computer

  • Thanks. The spaces are due to pasting from vim, they are not in the file itself. If they were, a plugin (ALE) would eliminate them. After upgrading my machines to 18.04 behavior of the network configuration on clients changed (wake on lan not being enabled, dhcp identifier). I looked at files in /etc/NetworkManager/system-connections/ some time ago and didn't find anything interesting. Also netplan looked like a good solution to get rid of distractions, but I just realized that nmcli offers a lot more configuration options than the GUI, TUI or netplan. Like ipv(4|6).may-fail for instance. – LiveWireBT Aug 9 at 22:18
  • 1
    @LiveWireBT Look at nm-connection-editor in the terminal. – heynnema Aug 10 at 3:11
  • @LiveWireBT status please... – heynnema Aug 14 at 13:36
  • I'm back to NetworkManager, configured ipv4-may-fail: false, rebooted the router and the client reconnected. – LiveWireBT Aug 14 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.