I'm using Ubuntu 18.04 bionic.
when I try to configure GRE Tunnel in the netcfg.yaml file I encounter an error:
Error in network definition //etc/netplan/01-netcfg.yaml line x column x: unknown key tunnels.
The configuration looks like this:
network: version: 2 renderer: networkd ethernets: ens01: addresses : [ gateway4: 10.201.x.254 nameservers: addresses: [10.200.nn.tt] dhcp4: no ens02: dhcp4: no addresses : [ routes: - to: 10.200.hh.0/24 via: 10.200.aa.254 tunnels: gre1: mode: gre local: 10.200.aa.dd remote: 10.200.hh.cc addresses: - 172.26.jj.14/32 gateway4: 172.26.jj.13What is the right way to configure GRE Tunnel on Ubuntu ?
A similar configuration, but still got the same error:Yaml configuration-2 screenshotThe error is: Error in network definition line 3 column 2: unknown key tunnels
The netplan version is:Netplan version
32 Answers
The correct .yaml needs to look EXACTLY like this... exact spacing, indentation, no trailing spaces, and no tabs... suggest copy/paste, then edit addresses... (redacting the addresses is unnecessary and creates errors)...
network: version: 2 renderer: networkd ethernets: ens01: addresses: [ gateway4: 10.201.x.254 nameservers: addresses: [10.200.nn.tt] optional: true ens02: addresses: [ routes: - to: 10.200.hh.0/24 via: 10.200.aa.254 optional: true tunnels: gre1: mode: gre local: 10.200.aa.dd remote: 10.200.hh.cc addresses: - 172.26.jj.14/32 gateway4: 172.26.jj.13sudo netplan generate
sudo netplan apply
reboot
Update #1:
You have a very old version of netplan installed, and it may not support tunnels. Update netplan, or update your OS.
8In yaml, indentation matters. The config you've pasted in your question shows two spaces of indentation for ethernets: and three spaces for tunnels:, which means this is treated as a child of ethernets instead of as a sibling, and there is no known key tunnels which is valid under ethernets. Correct this so that they both have the same level of indentation, and this should work.