0

I am setting up my static ip but i keep getting the error: Error in network defenition etc/netplan/01-netcfg.yaml line 0 collumn 8: expected mapping.

Here is my config:

 network:
 version: 2
 renderer: networkd
 ethernets:
 ens3:
 dhcp4: no
 dhcp6: no
 addresses: [5.157.82.219/23]
 gateway4: 5.157.82.1
 nameservers:
 addresses: [109.235.76.162,93.94.226.236,85.158.203.252,85.158.200.76,8.8.8.8]

2 Answers 2

1

You have to indent the properties accordingly to identify parent and child properties. Otherwise netplan is not able to parse your YAML configuration. A valid YAML file for netplan would be as follows.

network:
 version: 2
 renderer: networkd
 ethernets:
  ens3:
   dhcp4: no
   dhcp6: no
   addresses: [5.157.82.219/23]
   gateway4: 5.157.82.1
   nameservers:
    addresses: [109.235.76.162,93.94.226.236,85.158.203.252,85.158.200.76,8.8.8.8]

You are free in choosing the indentation spaces, but it should be the same within the YAML file.

For comprehensive examples of netplan configurations, please also read through netplan examples.

0
0

Thank you, its working.

Now i want to add a second ip, my vps has 2 ip-adresses

network:
 version: 2
 renderer: networkd
 ethernets:
  ens3:
   dhcp4: no
   dhcp6: no
   addresses: [5.157.82.219/23, 185.37.68.40/24]
   gateway4: 5.157.82.1
   nameservers:
    addresses: [109.235.76.162,93.94.226.236,85.158.203.252,85.158.200.76,8.8.8.8]

But it's not working.. can not ping the second ip. in ifconfig the ip does not show up.

I think the config is correct?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .