0

yaml setup I have the following netplan layout and it keeps coming up with the error

IP address shown here as xxx

ethernets: check indentation^

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s8:
    addresses: [xxx.xxx.xxxx.xxx/xx]
    gateway4: xxx.xxx.xxx.xxx
    nameservers:
      addresses: [8.8.8.8,x.x.x.x]

As far as I am aware the spacing is all correct. (2 spaces for each indent) Not sure what I am missing.

Any assistance greatly appreciated

  • @steeldriver everything after enp0s8: in fact. – Jos May 22 at 12:27
2

The correct format is:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s8:
      addresses:
        - 10.10.10.2/24
      gateway4: 10.10.10.1
      nameservers:
          addresses: [10.10.10.1, 1.1.1.1]

The correct spacing is found in /usr/share/doc/netplan/examples/static.yaml.

Follow with:

sudo netplan generate
sudo netplan apply
  • Hi so to make sure i get this right then under enp0s8 we still follow the indent rules and place the - under the 'p' (2 spaces in) then leave a space for the IP address and then go gateway and nameservers go back under the 'a' in address. Trying that now :) – Patdundee May 22 at 12:38
  • still comes up with the followin "Error in network definition. Expected Mapping (check indentation) ethernets:^ – Patdundee May 22 at 12:50
  • The - goes under the second d in 'addresses.' Then one space and then the actual address. Are you using the spacebar or tab? Netplan won't accept tabs. What is the result of: sudo netplan generate --debug ? – chili555 May 22 at 13:12
  • I have it half running now where the debug is fine. It was also reading in the static.yaml and the 50-cloud which were set incorrect so i have deleted these and also added dhcp4: no in the cfg. The netplan has now been generated and applied without issue. Once I connect the network cable it will ping itself only. It will not ping anything else on the network or its gateway or anything on the internet. This is frustrating but i do not which to use the old ifup/down and need to get my head around this :) – Patdundee May 22 at 13:41
  • I would certainly try a reboot. Without knowing the addresses, at least the last part; e.g. xxx.xxx.12.1 or xxx.xxx.12.155/24, etc. it is hard to troubleshoot further. – chili555 May 22 at 13:51

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.