On Mon, 20 Mar 2023, f...@dnsbed.com wrote:
Hello list,
I have a networking question that I can't understand for.
I have the Debian 11 host with two ethernet cards.
There is public IP and gateway for each ethernet card.
(they are public IPs from two different net address blocks.)
Say:
eth0 ip: 193.36.132.10 gw: 193.36.132.1
eth1 ip: 5.255.106.10 gw: 5.255.106.1
The system's default gw is the first one (eth0).
When clients from outside access eth1 ip (such as HTTP access), they can
reach there.
But, the returned packages from debian server to clients are always coming
from eth0 gw.
I expect the returned package also come from eth1 gw (since clients are
accessing eth1 address).
How can I setup this? Thanks for any hints.
regards
Corey H
I use policy based routing and tag in iptables.
firewall17:~# ip rule show
0: from all lookup local
10000: from all fwmark 0x20000/0x20000 lookup T_2_0
20000: from all fwmark 0x10000/0x10000 lookup T_1_0
32766: from all lookup main
32767: from all lookup default
firewall17:~#
firewall17:~# ip route show table T_2_0
default via 192.168.100.108 dev eth0
...
firewall17:~# ip route show table T_1_0
default via 192.168.9.2 dev tun2
...
firewall17:~# ip route show table main
default dev isp scope link
default via 192.168.9.2 dev tun2 metric 2048
...
firewall17:~#