I'm trying to install 2nd and 3rd NICs on a Ubunutu 22 VM running on VMWare. At first setup new VM with 1 NIC - that was successful and able to go out to internet:
network
ethernets:
ens160:
addresses:
- 192.168.50.231/24
nameservers:
addresses:
- 192.168.50.1
search:
- domain.com
routes:
- to: default
via: 192.168.50.254
Version: 2
Next, added the VM with a 2nd interface in VMware, and configured Netplan accordingly:
network
ethernets:
ens160:
addresses:
- 192.168.50.231/24
nameservers:
addresses:
- 192.168.50.1
search:
- domain.com
routes:
- to: default
via: 192.168.50.254
ens192:
addresses:
- 192.168.252.231/24
nameservers:
addresses:
- 192.168.252.1
search:
- domain.com
routes:
- to: default
via: 192.168.252.254
Version: 2
Running 'netplan apply' returns this:
'problem encountered while validating default route consistency.Please set up multiple routing tables and use
routing-policyinstead. Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160'
I understand I should use 1 default gateway, but can't seem to find the proper way to write this file.