Currently, I'm struggling with the following scenario:
- I have a server with 2 interfaces in 2 separate LAN subnets. IF1, IF2
- I have a laptop which has an IP address from the first subnet
- When I try to connect from this particular laptop to the second IP address of the server, I don't get a response at all.
For example, when I try to ping 172.31.196.185 from the laptop with IP 172.31.190.129, I can see incoming requests in tcpdump on the ens224 interface, but there is no response request on any other interfaces after that.
Here is my network diagram:
+-------------------------+
| |
| Laptop 172.31.190.129 +---------+
| | |
+-------------------------+ |
| +-------------------------+
| | |
+-----------+---------+ | Linux Server |
+----+ | | |
| | LAN 172.31.190.0/23 +-------+ IF1 - default gw |
+------+--+ | | | 172.31.190.63 |
+----------+ | | +---------------------+ | |
| Internet +---+ Gateway | | |
+----------+ | | +---------------------+ | |
+------+--+ | | | |
| | LAN 172.31.196.0/23 +-------+ IF2 |
+----+ | | 172.31.196.185 |
+---------------------+ | |
| |
| |
+-------------------------+
Also, I have this script:
IF1=ens160
IF2=ens224
P1_NET=172.31.190.0/23
P2_NET=172.31.196.0/23
IP1=172.31.190.63
IP2=172.31.196.185
P1=172.31.190.1
P2=172.31.196.1
ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
ip rule add from $P1_NET dev $IF1 table T1
ip rule add from $P2_NET dev $IF2 table T2
Which is writted in accordance to this link: https://lartc.org/howto/lartc.rpdb.multiple-links.html
I have tried many different ways to make a policy-based routing in my case, but no one didn't succeed...