4

Trying to setup Static IP and it will not work.

IP address 192.168.100.40

pre 17.10 and netplan config as follows

auto ens160
iface ens160 inet static
address 192.168.100.45
netmask 255.255.252.0
network 192.168.100.0
broadcst 192.168.103.255
gateway 192.168.100.1
dns-nameservers 192.168.100.1

Run sudo netplan ifupdown-migrate

And get ens160: method static is not supported

Try to use this netplan config and it errors out

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
        dhcp4: no
            addresses: [192.168.100.40/22]
            gateway4: 192.168.100.1
            nameservers:
            addresses: [8.8.8.8,8.8.4.4]

add dhhcp6: yes and still errors out via netplan debug

What am I missing?

  • “still errors out...” What is the exact error? Welcome to Ask Ubuntu. – chili555 Mar 27 '18 at 13:03
5

Please try:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: no
      dhcp6: yes
      addresses: [192.168.100.40/24]
      gateway4: 192.168.100.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

In other words, /24 instead of /22 and correct the spacing and indentation. Follow with:

sudo netplan apply

Please post any warnings or errors.

|improve this answer|||||
  • /22 was actually correct in their example. The issue is only indentation. – Mathieu Trudel-Lapierre Mar 27 '18 at 21:22
  • I believe /24, implying the usual 255.255.255.0, is correct. – chili555 Mar 27 '18 at 22:05
  • It certainly doesn't match the config in the question: netmask 255.255.252.0 – Mathieu Trudel-Lapierre Mar 27 '18 at 23:29
  • Hi Chilli555 Tried your action plan still not working get this error Invalid YAML at //etc/netplan/01-netcfg.yaml line 8 column 21: mapping values are not allowed in this context which is exactly the same error as with /22 which is valid in my config – Damien Graves Mar 29 '18 at 8:24
  • Please proofread carefully. Carefully check the spacing and indentation. Confirm there are no typos, such as adresses. Please confirm that the selected address, xx.40, is outside the DHCP pool in the router. Are you saying that /22 works in netplan but /24 does not? Finally, please run and post: netplan --debug generate – chili555 Mar 29 '18 at 14:17

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.