In general, what you want here is:
Set up a single default gateway (with
gateway4), on the interface that goes to the Internet. If you set default gateways on both, then half the packets will be routed to your Intranet and won't be able to reach their desintation.
If your Intranet has multiple subnets, then you need static routes to reach those through the interface connected to your Intranet. (One example might be routing any RFC1918 subnets to that interface, which would probably be a good idea.)
Now, in your specific example, you didn't describe your Intranet completely, but let's assume your Intranet is made of the 10.185.x.y network, in other words, 10.185.0.0/16.
Let's also assume your enp3s0 interface giving you access to the intranet will receive an IP in the 10.185.0.z subnet, in other words, 10.185.0.0/24 subnet, and that the gateway in that subnet is 10.185.0.1.
So you need a static route to reach the remaining of the 10.185.x.y subnets where x is not 0.
You can use a configuration such as the one below to set this up:
addresses: [10.185.x.x, y.y.y.y]
- to: 10.185.0.0/16
In this edited configuration, notice that:
There is no
gateway4 in enp3s0 configuration, since you don't want traffic to go to that interface by default, only when it's traffic destined to your Intranet, which is set up through the static route.
Conversely, the wlp2s0 doesn't need any static routes, since it has a default gateway attached to it, which is enough.
There's no need for routing tables and routing policies, all you need to do is set up a static route (or a few static routes) to cover the internal addresses in your Intranet and route them through the IP of the gateway in that network that can route you to the other subnets you're not directly connected to.
Please note that this setup actually depends on some of what your DHCP server in the internal network is provisioning for you, such as your interface being in the 10.185.0/24 network and that 10.185.0.1 is the gateway you can use in that interface... For that reason, perhaps a better setup would be to have the DHCP server in your Intranet push the static routes (instead of configuring them in netplan.) That way if the Intranet is reconfigured, perhaps to change the IP of the gateway, or perhaps extended to include other RFC1819 private ranges, only the DHCP server needs to be reconfigured and not everything else...
But if the DHCP server is out of your control, then this setup might be acceptable, assuming the internal network is not reconfigured too often so that the gateway IP would change. You might want to consider adding static routes to all the RFC1918 ranges, since those will be invalid in the Internet, so they might only be made valid in the Intranet:
- to: 10.0.0.0/8
- to: 172.16.0.0/12
- to: 192.168.0.0/16
I hope you find this helpful!