Sample Header Ad - 728x90

Convert unusual Netplan config to avoid deprecated Gateway4 field

1 vote
1 answer
970 views
I have an existing 01-netcfg.yaml file from documentation which is supposed to have worked previously.
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      addresses: []212.80.140.1/32]
      gateway4: 62.210.0.1
      nameservers:
        addresses: [62.210.16.6, 62.210.16.7]
      routes:
      - to: 62.210.0.1/32
        via: 212.80.140.1
        scope: link
This config is for a secondary or failover IP4 in a Virtual Machine inside a hypervisor (Proxmox PVE) on the Scaleway network . I cannot any longer use the Gateway4 field in Netplan on Ubuntu 22.04. Running netplan apply fails with the error:
gateway4 has been deprecated, use default routes instead
I believe I must update the syntax to use the routes field instead of gateway4 but I cannot get the syntax right. The default gateway is outside of the subnet of the main address so it needs additional configuration. Maybe onlink, source routing, routing tables etc. I don't know. http://people.ubuntu.com/~slyon/netplan-docs/examples/#reaching-a-directly-connected-gateway Can anyone convert the given config to use routes etc. instead of gateway4?
Asked by Adam G. (11 rep)
Mar 22, 2024, 02:53 PM
Last activity: Apr 5, 2024, 10:59 AM