Netplan configured for DHCP on interface ens160:

more /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: yes

When executing netplan restart nothing happens, only when "touching" the file or editing it and then restarting netplan/network it works, after reboot network is down also. This only happens with ubuntu 18.

  • After editing the file, did you do: sudo netplan generate followed by: sudo netplan apply ? Were there any errors or other clues after each command? Welcome to Ask Ubuntu. – chili555 Nov 19 at 14:45
  • no errors, the issue is that the interface don't get an IP when we don't update the file – yossi baruch Nov 21 at 6:33

Please check: cat /usr/share/doc/netplan.io/examples/dhcp.yaml The correct wording is dhcp4: true. Please amend your file to:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: true

Follow with:

sudo netplan generate
sudo netplan apply

Reboot and let us hear your report.

  • I've checked the documentation and found that 'yes' or 'true' are tge same. found examples with both options... went and checked this myself and it doesn't make a difference – yossi baruch Nov 23 at 14:26
  • If you boot when it is not working, are there clues in the log? dmesg | grep -e enp -e netplan – chili555 Nov 23 at 14:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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