Score:0

postfix send for one lan onlyif have 2 eth

bs flag

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.

in flag
Does this answer your question? [Does inet\_interfaces bind outgoing mail when more than one address is specified?](https://serverfault.com/questions/688810/does-inet-interfaces-bind-outgoing-mail-when-more-than-one-address-is-specified)
cianyika avatar
bs flag
i rezolved whit this : ip route add 192.168.1.0/24 dev eth1 table rt2 ip route add default via 192.168.1.1 dev eth1 table rt2 ip rule add from 192.168.1.0/24 table rt2 ip rule add to 192.168.1.0/24 table rt2 and add 2 line in postfix config : inet_interfaces = 192.168.1.254, 127.0.0.1 smtp_bind_address = 192.168.1.254 this is and working , tnx all
in flag
Please post your solution as an answer and accept it, otherwise the question will stay in the system as unsolved forever
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.