I need to add a second network with a second gateway to my ubnutu 20.04 server (with netplan). The setting looks like this:
Ubuntu server:
interface: ens18
IP: 192.168.20.2
gateway: 192.168.20.1
netmask: 255.255.255.0
I need to add a second network (192.168.30.2/24) with a second router (192.168.30.1) as gateway to the server. This router has different vpn connections to external networks.
I also need to ad static routes to ubuntu server in order to use the vpn connections of the second router, something like:
route XXX.YYY.0.0 MASK 255.255.0.0 via gateway 192.168.30.1
route XXX.ZZZ.0.0 MASK 255.255.0.0 via gateway 192.168.30.1
route XXX.XXX.0.0 MASK 255.255.0.0 via gateway 192.168.30.1
route WWW.XYZ.0.0 MASK 255.254.0.0 via gateway 192.168.30.1
route QQQ.PPP.RRR.0 MASK 255.255.255.0 via gateway 192.168.30.1
In windows I add the static routes with:
route add XXX.YYY.0.0 MASK 255.255.0.0 192.168.30.1 -p
...
My curent netplan YAML is:
# This is the network config written by 'subiquity'
network:
ethernets:
ens18:
addresses: [192.168.20.2/24]
dhcp4: no
gateway4: 192.168.20.1
nameservers:
addresses: [192.168.20.1, 8.8.8.8]
version: 2
# renderer: networkd
# renderer: NetworkManager
How can I realise this network?