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?
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
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
I always configure for a static ip the "dhcp" with the value of "no" like this
dhcp4: no
See an example below
My first time coming across this new way of networking and the "expected mapping" error. It's a nice one.
I got a static IP working by editing etc/netplan/50-cloud-init.yaml but found that it was SUPER picky about the layout (spaces).
I used the examples given at
https://netplan.io/examples
By going to the line BEFORE the line mentioned in the error (given when it didn't work) and pressing "return", a new line and the correct amount of indent was automatically inserted.
Restated... I had an error reported in line 12, so I went to the end of line 11 and pressed "return". A carriage return AND the (presumably) correct amount of indentation was automatically inserted.
If the error was at line 1 (as for the OP) I can only guess that the syntax is wrong.
I learned that if the indents are not perfect, it does not work. Even though I went off another example, the example I found was incorrect. Here's the contents of
00-installer-config.yaml
that worked for me in case it helps someone else later:Here is a screenshot of
00-installer-config.yaml
.I tried several formats
Ubuntu 20 (
netplan apply
command) only accepted config after I configured exact spaces before each line:After that, error went away and I was able to connect to 172.16.1.95 server via SSH