Netplan error in network definition expected mapping
79,271
Solution 1
removing dhcp4 setting fixed the issue...who knows!
maybe because if you enable the dhcp you have to set it to "true" and if you disable you have to set to "no"? I really hope not!!
debug info completely useless
Solution 2
a netplan configuration is base on yaml, when looking your configuration. i think the indentation is error because its have 3 space. maybe you can try this
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config:disabled}
network:
version: 2
ethernets:
enp0s3:expected mapping
addresses: [192.168.0.183/24]
gateway4: 192.168.0.250
dhcp4: false
nameservers:
addresses: [8.8.8.8,8.8.4.4]
optional: true
Related videos on Youtube
Author by
Giox
Updated on September 18, 2022Comments
-
Giox over 1 year
no way to make the network works on the new ubuntu server. This is the netplan yaml file:
# To disable cloud-init's network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config:disabled} network: version: 2 ethernets: enp0s3: addresses: [192.168.0.183/24] gateway4: 192.168.0.250 dhcp4: false nameservers: addresses: [8.8.8.8,8.8.4.4] optional: true
running netplan --debug apply I get:
Error in network definition //etc/netplan/50-cloud-init.yaml line 1 column 1: expected mapping
I'm going crazy, it was so simple before! Why doesn't work? what does it mean this error?
-
noobninja over 4 yearsif you add a second device under
ethernets
, you may be able to configure that new network device to bothdhcp4: false
anddhcp6: false
. in other words, it may be the initial network device which needs DHCP.