Error in network definition unknown key addresses

Error in network definition unknown key addresses I’ve read the netplan examples here (https://netplan.io/examples) but an still scratching my head with a syntax error. I am trying to set up my DNS servers to avoid an issue I am having with DNS at a work site which uses a home wifi setup with a […]

Содержание

  1. Error in network definition unknown key addresses
  2. Error in network definition: expected mapping (check indentation) #58
  3. Comments
  4. Checks & detection
  5. Main deployment steps:
  6. Installation
  7. Let NetworkManager manage all devices on this system
  8. add configuration for bridge interface

Error in network definition unknown key addresses

I’ve read the netplan examples here (https://netplan.io/examples) but an still scratching my head with a syntax error.

I am trying to set up my DNS servers to avoid an issue I am having with DNS at a work site which uses a home wifi setup with a notoriously flakey DNS server — I have described the issue here:
https://ubuntuforums.org/showthread.php?t=2411835

I am following this tutorial for 18.04 (https://www.techrepublic.com/article/how-to-set-dns-nameservers-in-ubuntu-server-18-04/) which tells me how to setup the DNS servers.

Unfortunately when I

$ sudo netplan —debug apply

I get an error about syntax — it does not seem to like the «nameservers» bit

/etc/netplan/01-network-manager-all.yaml line 1 column 0: unknown key nameservers

My /etc/netplan/01-network-manager-all.yaml line file looks like this:

# Let NetworkManager manage all devices on this systemnetwork:
version: 2
renderer: NetworkManager
nameservers:
addresses: [8.8.4.4, 8.8.8.8, 1.1.0.0, 1.1.1.1]

Any ideas what I am doing wrong?

Netplan, or rather yaml, is very fussy about indentation. The «nameservers» line needs to have the same (or possibly more) indentation as the «renderer» line, and the «addresses» line needs to be further indented than the «nameservers» line.

So, to tweak the example you’ve given, it should look like this:

# Let NetworkManager manage all devices on this systemnetwork:
version: 2
renderer: NetworkManager
nameservers:
addresses: [8.8.4.4, 8.8.8.8, 1.1.0.0, 1.1.1.1]

I don’t use NetworkManager, so I can’t be sure that you won’t need to make other changes, but try updating the formatting first and see if that does the job.

Thanks, I now get two new errors:

If I use four spaces as indentation — e.g:

# Let NetworkManager manage all devices on this systemnetwork:
version: 2
renderer: NetworkManager
nameservers:
addresses: [8.8.4.4, 8.8.8.8, 1.1.0.0, 1.1.1.1]

Invalid YAML at /etc/netplan/01-network-manager-all.yaml line 4 column 15: mapping values are not allowed in this context

If I use two spaces (to bring nameservers in line under renderer) or cut/paste irihapeti’s example (and correct the «network» being on the wrong line) — like this:

# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
nameservers:
addresses: [8.8.4.4, 8.8.8.8, 1.1.0.0, 1.1.1.1]

Error in network definition /etc/netplan/01-network-manager-all.yaml line 2 column 2: unknown key nameservers

Any ideas what I am doing wrong?Yes.

# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
. means what it says. It says and means, let NM do all the work; so long, I’m outa here, buh bye.

I suggest that you revert the faulty changes and simply make the changes in Network Manager:

# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
. means what it says. It says and means, let NM do all the work; so long, I’m outa here, buh bye.

I suggest that you revert the faulty changes and simply make the changes in Network Manager:

Thanks chilli555 — that’s bang-on. Made the changes in Network Manager and all is good — this has also (hopefully — I will test today) solved my other thread too.

Источник

Error in network definition: expected mapping (check indentation) #58

tried to install opennebula on ubuntu 20 :

root@ziomario-I5:/home/ziomario/Scrivania# sudo bash minione

Checks & detection

Checking augeas is installed SKIP will try to install
Checking AppArmor SKIP will try to modify
Checking for present ssh key SKIP
Checking (iptables|netfilter)-persistent are installed SKIP will try to install

Main deployment steps:

Install OpenNebula frontend version 5.12
Configure bridge minionebr with IP 172.16.100.1/24
Enable NAT over enp3s0
Modify AppArmor
Install OpenNebula KVM node
Export appliance and update VM template
Install augeas-tools iptables-persistent netfilter-persistent

Do you agree? [yes/no]:
yes

Installation

Updating APT cache OK
Install augeas-tools iptables-persistent netfilter-persistent OK
Creating bridge interface minionebr OK
Bring bridge interfaces up FAILED

— STDERR —
/etc/netplan/01-network-manager-all.yaml:2:9: Error in network definition: expected mapping (check indentation)
network:
^

this is my 01-network-manager-all.yaml file :

Let NetworkManager manage all devices on this system

network:
version: 2
renderer: NetworkManager

#ethernets:
#eno1:
#dhcp4: no
#disable existing configuration for ethernet
#addresses: [10.0.0.30/24]
#gateway4: 10.0.0.1
#nameservers:
#addresses: [10.0.0.10]
#dhcp6: no

add configuration for bridge interface

#bridges:
#br0:
#interfaces: [eno1]
#dhcp4: no
#addresses: [10.0.0.30/24]
#gateway4: 10.0.0.1
#nameservers:
#addresses: [10.0.0.10]
#parameters:
#stp: false
#dhcp6: no

The text was updated successfully, but these errors were encountered:

Источник

I’m trying to setup a Ubuntu server and running in to a problem setting up a static IP.

My OS is as below:

Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:        17.10
Codename:       artful

My 01-netcfg.yaml is below:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp5s0f0:
      dhcp4: no
      addresses: [192.168.0.109/24]
      gateway4: 192.168.0.1
      nameservers:
        adresses: [8.8.8.8,8.8.4.4]

When running sudo netplan apply I get the below error. Same error when running debug.

Error in network definition //etc/netplan/01-netcfg.yaml line 9 column 8: unknown key adresses

All my google attempts for a correct .yaml file says this should work.
What am I doing wrong?

Nisse Engström's user avatar

asked Mar 3, 2018 at 15:55

Sandoz's user avatar

1

I believe it is telling you that it doesn’t understand adresses. Please try:

addresses: [8.8.8.8,8.8.4.4]

Follow with:

sudo netplan apply

Any improvement?

answered Mar 3, 2018 at 16:42

chili555's user avatar

chili555chili555

57.1k7 gold badges88 silver badges124 bronze badges

1

This is a netplan joke. You must read your error message

Error in network definition //etc/netplan/01-netcfg.yaml line 9 column 8: unknown key adresses

as «there is a section on line 9 (here nameservers) and in this section (in some line below, but surely not the line 9) is a keyword (key) adresses which is unknown.

And now the message is clear and the solution is straightforward.

answered Sep 19, 2018 at 9:29

Gustav Kusnir's user avatar

  • Печать

Страницы: [1]   Вниз

Тема: Поднимите мне брови! netplan … не получается добавить bond интерфейс  (Прочитано 1210 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
Elias292

Конфиг такой:

root@ubuntu:/etc/netplan# cat 00-installer-config.yaml

Пытаюсь применить:

root@ubuntu:/etc/netplan# netplan try --state /etc/netplan
/etc/netplan/00-installer-config.yaml:28:9: Error in network definition: unknown key 'bond0'
        bond0:
        ^

An error occurred: the configuration could not be generated


Вот что за фигня ?

Что-то типа такого должно быть.

« Последнее редактирование: 02 Мая 2022, 16:09:37 от Morisson »


Оффлайн
Morisson

Оформите свое сообщение согласно правил форума. В противном случае оно будет удалено.
Спасибо за понимание.


Оффлайн
Elias292

Оформите свое сообщение согласно правил форума. В противном случае оно будет удалено.
Спасибо за понимание.

Что не так в моем сообщении ?


Оффлайн
Morisson

1.4. Листинги и содержимое текстовых файлов следует добавлять в сообщение с помощью тегов

или

..., либо прикреплять к сообщению в виде отдельного файла. Длинные гиперссылки следует оформлять при помощи тега ….

https://forum.ubuntu.ru/index.php?action=rules


Онлайн
ALiEN175

Вот что за фигня ?

Пробелы в начале строк правильно посчитаны? Для YAML это очень важно.

ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE


Оффлайн
Elias292

В общем…

Конфиг щас такой

Когда даю комманду:

root@ubuntu:/etc# netplan try --state /etc/netplan

bond0: reverting custom parameters for bridges and bonds is not supported

Please carefully review the configuration and use 'netplan apply' directly.


Командой netplan apply
все применяется…
Но сервисы почему то вешаются на ipv6

root@ubuntu:/var/log/munin# !netst
netstat -nlp | grep 4949
tcp6       0      0 :::4949                 :::*                    LISTEN      355919/perl

netplan — отстой!


Пользователь добавил сообщение 02 Мая 2022, 17:43:56:


Вот что за фигня ?

Пробелы в начале строк правильно посчитаны? Для YAML это очень важно.

Где б еще узнать как оно «правильно».

« Последнее редактирование: 02 Мая 2022, 17:43:56 от Elias292 »


Оффлайн
bezbo


Оффлайн
Elias292

Поднимите мне брови!

netplan

Ничего полезного я тут не нашел.
Это заклинания какие-то, без объяснения что и зачем тут написано.


  • Печать

Страницы: [1]   Вверх

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • Networking & Wireless
  • [server] Network netplan yalm -> syntax errors…

  1. Network netplan yalm -> syntax errors…

    First at all, the netplan/yalm implementation on ubuntu is the biggest mistake! My personal opinion!
    Complicated and unuseable!

    But… there seems no other way to setup the network on ubuntu server, so…

    Code:

    --- 
    ethernets: 
      addresses: 
        - 192.168.50.224/24
      dhcp4: false
      dhcp6: false
      gateway4: "192.168.50.250"
      nameservers: 
        addresses: 
          - "192.168.50.225"
          - "192.168.50.250"
        search: 
          - lan
    match: 
      name: enp*s*
    network: 
      renderer: networkd
      version: 2

    YALM Lint checked this config and it is CORRECT!
    But ubuntu server netplan gives this error!

    Code:

    Error in network definition //etc/netplan/01-netcfg.yaml line 1 column 0: unknown key ethernets

    So, what is wrong with ubuntu netplan implementation?!!!


  2. Re: Network netplan yalm -> syntax errors…

    Looking at https://netplan.io/examples, maybe ethernets should be a child/sub-key of network?


  3. Re: Network netplan yalm -> syntax errors…

    It doesn’t matter in which order this is. YAML Lint has restructured this!
    I can also write it in the following order, the error is the same!

    Code:

    match: 
      name: enp*s*
    network: 
      renderer: networkd
      version: 2
    ethernets: 
      addresses: 
        - 192.168.50.224/24
      dhcp4: false
      dhcp6: false
      gateway4: "192.168.50.250"
      nameservers: 
        addresses: 
          - "192.168.50.225"
          - "192.168.50.250"
        search: 
          - lan

    Or this order…

    Code:

    network: 
      renderer: networkd
      version: 2
    match: 
      name: enp*s*
    ethernets: 
      addresses: 
        - 192.168.50.224/24
      dhcp4: false
      dhcp6: false
      gateway4: "192.168.50.250"
      nameservers: 
        addresses: 
          - "192.168.50.225"
          - "192.168.50.250"
        search: 
          - lan

    So, what is wrong with ubuntu netplan?

    YALM Lint says, this is correct!

    Edit:
    So, I think… ubuntu netplan can’t handle ‘match’ and ‘name’ directives!
    This gives no error!

    Code:

    network:
      version: 2
      renderer: networkd
      ethernets:
        enp0s17:
    #    match:
    #      name: enp*s*
            addresses:
              - 192.168.50.224/24
            dhcp4: false
            dhcp6: false
            gateway4: "192.168.50.250"
            nameservers:
              addresses:
                - "192.168.50.225"
                - "192.168.50.250"
              search:
                - lan

    This gives again an error!

    Code:

    network:
      version: 2
      renderer: networkd
      ethernets:
    #    enp0s17:
        match:
          name: enp*s*
            addresses:
              - 192.168.50.224/24
            dhcp4: false
            dhcp6: false
            gateway4: "192.168.50.250"
            nameservers:
              addresses:
                - "192.168.50.225"
                - "192.168.50.250"
              search:
                - lan

    Ubuntu bionic netplan is bugged?

    Last edited by BobMaze; September 19th, 2018 at 06:57 PM.


  4. Re: Network netplan yalm -> syntax errors…

    I am guessing because I haven’t ever configured netplan, but perhaps ethernets should contain a list and not just an object? In which case, perhaps there should be a hyphen before the match keyword to make it the first element of a list.


Bookmarks

Bookmarks


Posting Permissions

ubuntu 2004
I assign network with netplan,then error comes:

/etc/netplan/00-installer-config.yaml:8:3: Error in network definition: unknown key 'nameservers'
  nameservers:

the 00-installer-config.yaml file below:

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens32:
            addresses: [10.9.86.40/24]
            gateway4: 10.9.86.254
  version: 2
  nameservers:
        addresses: [192.168.2.1, 8.8.8.8]

  • netplan

asked May 29, 2021 at 9:01

Dai Wen's user avatar

Dai WenDai Wen

131 silver badge3 bronze badges

1 Answer

don’t use your tab key, only use space

answered Jun 3, 2021 at 9:15

Lukas's user avatar

Ubuntu 18.04 deprecated ifupdown package to configure the network. Instead, they moved to a much more modern application called netplan.

Today I needed to modernize my machine configuration, and I moved from ifupdown configuration to netplan.

I had the following file:

# cat /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
 address 9.3.3.XX
 netmask 255.255.255.0
 network 9.3.3.0
 broadcast 9.3.3.255
 gateway 9.3.3.XX
 # dns-* options are implemented by the resolvconf package, if installed
 dns-nameservers 9.3.1.YY
 dns-search foo.bar.ibm.com

auto eth2
iface eth2 inet static
 address 10.1.1.8
 netmask 255.255.255.0
 mtu 9000

auto eth4
iface eth4 inet static
 address 192.168.1.8
 netmask 255.255.255.0
 mtu 9000

Moving to netplan is quite simple, I just moved to:

# cat /etc/netplan/01-netcfg.yaml
network:
 version: 2
 renderer: networkd
 ethernets:
 eth0:
 dhcp4: no
 addresses: [9.3.3.XX/24]
 gateway4: 9.3.3.X
 nameservers:
 addresses: [9.3.1.YY, 8.8.8.8]

eth4:
 addresses: [10.1.1.8/24]
 mtu: 9000

eth2:
 addresses: [192.168.1.8/24]
 mtu: 9000

After this move, you just need to run netplan apply and you should start to use the newer mechanism.

You can also migrate the scripts from ifupdown to netplan meachnism automatically using netplan ifupdown-migrate command.

PS: If you see errors like `uknown key addrress` means you have something on that block. For example, if I write addresseZ instead of addresses on eth2 block, then I will see the following error points to the  ‘eth2‘ line (Line XX below), but in fact, the error would be on line XX + 1 instead of XX

Error in network definition //etc/netplan/01-netcfg.yaml line XX column Y: unknown key addresss

Background

I’m using Ubuntu 18.04 server (on a laptop, for development) and am trying to get my wifi configured to work with an WPA-EAP network.

  • To enable Wifi I followed the guide Wifi on Ubuntu 18 server

  • I looked at the Netplan Examples (none with WPA-EAP )

  • I’ve read the Netplan Full Documentation.

I’ve got netplan to work with an an open network, even with a password protected network, but haven’t been able to get it to work with WPA-EAP where both an identity and password are required.

Attempted Configuration

I’ve tried this in my /etc/netplan/config.yaml file:

network:
    wifis:
      wlp1s0:
        dhcp4: yes
        access-points:
          "My-Enterprise-Network":
            auth:
              key-management: eap
              identity: johndoe1
              password: pass1234

But when I run netplan apply I get:

Error in network definition /etc/netplan/config.yaml: unknown key auth

From the Documentation

From the online netplan documentation:

 The ``auth`` block supports the following properties:

 ``key-management`` (scalar)
 :    The supported key management modes are ``none`` (no key management);
      ``psk`` (WPA with pre-shared key, common for home wifi); ``eap`` (WPA
      with EAP, common for enterprise wifi); and ``802.1x`` (used primarily
      for wired Ethernet connections).

 ``password`` (scalar)
 :    The password string for EAP, or the pre-shared key for WPA-PSK.

 The following properties can be used if ``key-management`` is ``eap``
 or ``802.1x``:

 ``method`` (scalar)
 :    The EAP method to use. The supported EAP methods are ``tls`` (TLS),
      ``peap`` (Protected EAP), and ``ttls`` (Tunneled TLS).

 ``identity`` (scalar)
 :    The identity to use for EAP.

From man netplan

access-points (mapping)
      This  provides  pre-configured connections to NetworkManager.  
      Note that users can of course select other access points/SSIDs.  
      The keys of the mapping are the SSIDs, and the values are mappings
      with the following supported properties:

      password (scalar)
             Enable WPA2 authentication and set the passphrase for it.  
             If not given, the network is assumed to be open. 
             **Other authentication  modes  are not currently supported.**

Note the last line: Other authentication modes are not currently supported.

Questions

  1. What’s the right way to use netplan with WPA-EAP?
  2. Does Ubuntu 18.04 ship with an outdated version of netplan? ( netplan --version is not supported ) Hence perhaps why the online documentation has options that the man version does not?
  3. If so, can I upgrade netplan to a more cutting edge release?
  4. Or does netplan need to be used with something like a wpa_supplicant.conf to specify additional parameters?

Понравилась статья? Поделить с друзьями:
  • Error in network definition invalid ip family 1
  • Error in network definition expected sequence addresses
  • Error in network definition expected mapping check indentation nameservers
  • Error in network definition address is missing prefixlength
  • Error in na fail default