Yes, you should be able to use environment variables. This seems to work
in bash for me (stopping the single-quotes before the ENV var & re-
starting it right after):
$ ITF=ens33
$ GWY=192.168.17.253
$ netplan set network.ethernets.$ITF.routes='[{"to": "default", "via":
"'$GWY'", "metric": 200}]'
Using the commands above I'm also able to reproduce the issue of having
multiple same default routes with different gateways. Trigger:
$ GWY=192.168.17.252
$ netplan set network.ethernets.$ITF.routes='[{"to": "default", "via":
"'$GWY'", "metric": 200}]'
** (process:841): WARNING **: 11:51:04.829: Problem encountered while
validating default route consistency.Please set up multiple routing tables and
use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric:
200), first declared in ens33 but also in ens33
$ cat /etc/netplan/70-netplan-set.yaml
network:
version: 2
ethernets:
ens33:
routes:
- metric: 200
to: "default"
via: "192.168.17.253"
- metric: 200
to: "default"
via: "192.168.17.252"
Having multipe default routes (of same priority) pointing to different gateways
is obviously wrong and there's already an error message displayed. It probably
should not be written to disk either, which we can track as a (low-priority)
bug.
** Also affects: netplan.io (Ubuntu)
Importance: Undecided
Status: New
** Changed in: netplan.io (Ubuntu)
Status: New => Triaged
** Changed in: netplan.io (Ubuntu)
Importance: Undecided => Low
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2098356
Title:
command line netplan set network.ethernets.ens33.routes fails with
python errors
To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/2098356/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs