I have server ubuntu whit 2 network card and i want output 1 lan for postfix and dns, other lan for http ,dns, ftp etc. My configuracion is :
uname -a
Linux mail.domain.com 5.15.0-72-generic #79-Ubuntu SMP Wed Apr 19 08:22:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.18.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth1
0.0.0.0 192.168.18.1 0.0.0.0 UG 100 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth1
192.168.1.1 0.0.0.0 255.255.255.255 UH 100 0 0 eth1
192.168.18.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
192.168.18.1 0.0.0.0 255.255.255.255 UH 100 0 0 eth0
Now send mail only from eth0 and I need exit only from eth1 because have reverse from this. if bind postfix in eth1 not send and in log see not conected timed out. If change default route to eth1 work send mail and dns but not work http dns ftp in eth0 , i think problem is from route but is is newbie in Linux.