
JSL-QMail at LoveSong
Oct 13, 2003, 2:28 PM
Post #1 of 3
(1390 views)
Permalink
|
|
Selection of outgoing IP address
|
|
How does the mail relay decide who it is going to be if it has a choice of IP addresses to send from? On my system, it appears to choose one at random. I'd like to have some control over this. I have been looking at the code in qmail-remote.c which appears to set up the IP connection to deliver outgoing SMTP mail and I don't fully understand enough of the Unix underpinnings yet to quite grok it. I'm running 1.03 on a Debian Linux as nearly out of the box as possible, but with a peculiar local setup. I have a small webhosting business and a bunch of virtual hosts on one server, with one IP address per customer and a variable number of web sites per IP address. These web sites are all on 20 or so externally routable IP addresses attached to a DSL line. The server has as its primary identity, however, an interface which is connected to a different ethernet port with an internal-only IP address, 192.168.1.252. The name in /etc/qmail/me is associated by my DNS with that internal address, so when it goes to look for an IP address to choose on the external interface, there is none that resolves to the name in /etc/qmail/me. This is a conjecture because I observe that all the outgoing e-mail from the server which hosts my account at pair Networks emanates from a single IP address, the one which I expect is in /etc/qmail/me. Ideally, I would like the outgoing e-mail to leave from the IP address associated with the customer whose e-mail it is associated with, which can be deduced from the IP address it arrived on, since each customer has an MX record pointing to a name on their IP address. I can see that this might be too hard, but I am stumped at figuring out where in the documentation to look for advice on this matter. One thing I really like about qmail (vs sendmail) is that it records which interface (IP address) the e-mail arrives on. Doing something with this by parsing the header is probably too hairy, but considering the tricks that can be done with RELAYCLIENT, I thought perhaps there would be a way to do this, too. -- Spencer
|