I cant find a working guide to make work the following scenario:
Need to configure a server to be capable of working with 2 routers at same time. Its a virtual machine.
Network 1 192.168.1.0/24 Router 1 with ip 192.168.1.1
Network 2 192.168.2.0/24 Router 2 with ip 192.168.2.1
I have 2 lan adapters "ens160" primary, and "ens192" secondary. If i active only one adapter i can access from vpn clients to server, doing a ping or ssh. If i put 2 adapters on i cant access from vpn clients from "ens192" the default adapter.
I looking for server works with Network 1 and 2, not need to make network 1 can see network 2 and viceversa. I want my server attend petitions from router 1 responding to router 1 and petitions from router 2 responding to router 2
I review a few guides talking about add routes, but no one works and all are for more old versions of Ubuntu. May be i loosing some detail, but i cant find it.
Some one can point a guide for ubuntu 16.04 working with 2 gateways at same time.
Edit to add more info to Alvaro:
Thansk for your help.
oscar@LinuxTest:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 ens192
192.168.1.0 192.168.1.1 255.255.255.0 UG 0 0 0 ens160
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ens160
192.168.2.0 192.168.2.1 255.255.255.0 UG 0 0 0 ens192
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 ens192
Whit this i only got working the petitions from router 2 from 192.168.2.1, if i delete the default Gateway no one works.
The theory is If petition comes from 192.168.1.1 respond to 192.168.1.1 by ens160. If petition comes from 192.168.2.1 respond to 192.168.2.1 by ens192