NETPLAN — static route between interfaces, separate subnets --ubuntu 18.04
by jazzmice from LinuxQuestions.org on (#59FFX)
I apologize if this sounds like a network noob or linux noob situation but the new netplan /static routes is currently driving me nuts :(
(and yes i know the class172 net is normally /16 but just like to have it this way for now)
Under Ubuntu 18.04:
interface0, WAN, ens18, 192.168.3.143 DHCP given from hw router 192.168.3.1 (DNS thru upstream 192.168.1.1 (which provides other 192.168.x.x nets)), internet facing
interface1, LAN (pxe/ltsp clients), ens20, 172.32.2.x/24, set as static 172.32.2.1, intranet facing
dnsmasq set as DHCP provider to LAN (works)
HOWEVER, unable to have internet /ping/DNS at LAN client side, even though dnsmasq is providing DHCP
I have tried netplan.io/examples, including google-fu, in trying to set static route between the interfaces, but 'example' lines with (any) 'combo' of IP /subnets(x.x.x.0/24) does not work.
I have also tried "ip route add IP/subnet via Gateway dev interface" but either get 'rule already exists' or that its incorrect.
Below are the current netplan and dnsmasq configs, and the routes
Can someone please help me tell me what is wrong and what the line(s)/configs should be? thank you SOOOO MUCH !
--------------------
#/etc/netplan/50-cloud-init.yaml
network:
ethernets:
# MAIN NETWORK WAN
ens18:
dhcp4: true
# PXE NETWORK LAN
ens20:
dhcp4: false
addresses: [172.32.2.1/24]
gateway4: 192.168.3.143
nameservers:
addresses: [192.168.3.1]
routes:
- to: 192.168.3.0/24
via: 192.168.3.143
metric: 100
version: 2
--------------------
# /etc/dnsmasq.conf
# manually added file- not autoinstalled
#dnsmasq listens to:
interface=ens20
#port=0
#DHCP configuration
dhcp-range=ens20,172.32.2.100,172.32.2.120,255.255.255.0,24h
dhcp-option=ens20,3,172.32.2.1
dhcp-option=option:dns-server,192.168.3.1
dhcp-host=56:0c:e7:44:e0:23,172.32.2.1
#tftpd boot section
enable-tftp
tftp-root=/tftpboot
#dhcp-boot=
--------------------
ROUTING:
ip route show && route -n
default via 192.168.3.1 ens18 proto dhcp src 192.168.3.143 metric 100
172.32.2.0/24 dev ens20 proto kernel scope link src 172.32.2.1
192.168.3.0/24 dev ens18 proto kernel scope link src 192.168.3.143
192.168.3.1 dev ens18 proto dhcp scope link src 192.168.3.143 metric 100
Kernel IP routing table
DestinationGatewayGenmaskFlags MetricRefUseIface
0.0.0.0192.168.3.1 0.0.0.0UG10000ens18
172.32.2.00.0.0.0255.255.255.0U000ens20
192.168.3.00.0.0.0255.255.255.0U000ens18
192.168.3.10.0.0.0255.255.255.255UH10000ens18


(and yes i know the class172 net is normally /16 but just like to have it this way for now)
Under Ubuntu 18.04:
interface0, WAN, ens18, 192.168.3.143 DHCP given from hw router 192.168.3.1 (DNS thru upstream 192.168.1.1 (which provides other 192.168.x.x nets)), internet facing
interface1, LAN (pxe/ltsp clients), ens20, 172.32.2.x/24, set as static 172.32.2.1, intranet facing
dnsmasq set as DHCP provider to LAN (works)
HOWEVER, unable to have internet /ping/DNS at LAN client side, even though dnsmasq is providing DHCP
I have tried netplan.io/examples, including google-fu, in trying to set static route between the interfaces, but 'example' lines with (any) 'combo' of IP /subnets(x.x.x.0/24) does not work.
I have also tried "ip route add IP/subnet via Gateway dev interface" but either get 'rule already exists' or that its incorrect.
Below are the current netplan and dnsmasq configs, and the routes
Can someone please help me tell me what is wrong and what the line(s)/configs should be? thank you SOOOO MUCH !
--------------------
#/etc/netplan/50-cloud-init.yaml
network:
ethernets:
# MAIN NETWORK WAN
ens18:
dhcp4: true
# PXE NETWORK LAN
ens20:
dhcp4: false
addresses: [172.32.2.1/24]
gateway4: 192.168.3.143
nameservers:
addresses: [192.168.3.1]
routes:
- to: 192.168.3.0/24
via: 192.168.3.143
metric: 100
version: 2
--------------------
# /etc/dnsmasq.conf
# manually added file- not autoinstalled
#dnsmasq listens to:
interface=ens20
#port=0
#DHCP configuration
dhcp-range=ens20,172.32.2.100,172.32.2.120,255.255.255.0,24h
dhcp-option=ens20,3,172.32.2.1
dhcp-option=option:dns-server,192.168.3.1
dhcp-host=56:0c:e7:44:e0:23,172.32.2.1
#tftpd boot section
enable-tftp
tftp-root=/tftpboot
#dhcp-boot=
--------------------
ROUTING:
ip route show && route -n
default via 192.168.3.1 ens18 proto dhcp src 192.168.3.143 metric 100
172.32.2.0/24 dev ens20 proto kernel scope link src 172.32.2.1
192.168.3.0/24 dev ens18 proto kernel scope link src 192.168.3.143
192.168.3.1 dev ens18 proto dhcp scope link src 192.168.3.143 metric 100
Kernel IP routing table
DestinationGatewayGenmaskFlags MetricRefUseIface
0.0.0.0192.168.3.1 0.0.0.0UG10000ens18
172.32.2.00.0.0.0255.255.255.0U000ens20
192.168.3.00.0.0.0255.255.255.0U000ens18
192.168.3.10.0.0.0255.255.255.255UH10000ens18