Postfix - how to set the IP address used to send mail on a multi-IP server.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Postfix - how to set the IP address used to send mail on a multi-IP server.
I have having mail rDNS issues with certain servers e.g. Craigslist, b/c my postfix server sends the mail through a different IP address than the one associated with $mydomain.
I use my server as a virtual web/mail server for 5 or so domains, which are associated with an ip address. i.e. 10.0.0.3 on eth0:1
The network card also has the main ip address on eth0:0 i.e. 10.0.0.1.
This is the address that has the rdns set up, as well as the subdomains for the server dns1.domain.tld, mail.domain.tld.
$mydomain is set as domain.tld
$myhostname is set to mail.domain.tld.
interfaces = all;
Virtual domains are done through a mysql server.
But, when I send a mail from me@domain.tld, it sends through otherdomain.tld on 10.0.0.3 instead of mail.mydomain.tld at 10.0.0.1
How do I force postfix to send through my default ip and domain? Is there a setting min master.cf?
I tried the smtp_bind_address, and postfix would not send out any of my test messages. I could ping the address using the ip, and using the host name from another computer, so the adapter and networking were active. Postfix, just wouldn't send.
My network is set up with 5 static IPs, and then some internal network IPs as follows.
Internet > DSL router > Server eth0 - Internal eth0 10.0.0.1
- External eth1 65.xxx.xxx.1
- External eth1: 65.xxx.xxx.2
In main.cf
myhostname = mail.mydomain.com
mydomain = mydomain.com (I actually list this line even though postfix should default to it by stripping the subdomain)
inet_interfaces = all
But, when I send mail to an external account, the mail is received from 65.xxx.xxx.2 virtualdomain1.com.
I can't figure out why. I tried to change inet_interfaces = 65.xxx.xxx.1, 127.0.0.1 but postfix could not successfully send mail.
route >
65.xxx.xxx.0 * 255.255.255.248 U 0 0 0 eth1
10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
default mail.mydomain.com 0.0.0.0 UG 100 0 0 eth1
default mail.mydomain.com 0.0.0.0 UG 100 0 0 eth1
default home 0.0.0.0 UG 100 0 0 eth0
Any recommendation to change my network setup and/or routing table that might make this work?
If you change something like smtp_bind_address and it doesn't work, we really can't help if you don't at least show a log of the attempt (no logging is information as well). Would you be able to try again and see what pops up?
Apr 20 14:13:42 office amavis[23449]: (23449-03) (!)DENIED ACCESS from IP 65.101.xxx.xxx, policy bank ''
mailq =
5E6D74EC076 479 Mon Apr 20 14:13:42 me@mydomain.com
(lost connection with 127.0.0.1[127.0.0.1] while receiving the initial server greeting) me@sendtoaddress.com
I think you nailed it with the routing table problem.
I changed my ipconfig for the network adapter, and checked my bind files. But now, instead of sending from the aliased IP on the NIC, it appears to send from the gateway IP.
contents of interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary NS/MX internet network interface
auto eth1
iface eth1 inet static
address 65.101.xxx.1
netmask 255.255.255.248
network 66.101.xxx.0
broadcast 65.101.xxx.7
gateway 65.101.xxx.6
# The aliased IP for virtual hosts on NIC 1 - external interface
auto eth1:1
iface eth1:1 inet static
address 65.101.xxx.2
netmask 255.255.255.248
network 66.101.xxx.0
broadcast 65.101.xxx.7
gateway 65.101.xxx.6
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.