How to change IP for outgoing mails.

12 posts / 0 new
Last post
#1 Fri, 11/17/2006 - 16:15
Blueforce

How to change IP for outgoing mails.

Hi

When we are sendings mails from our server the wrong IP is picked up as outgoing server IP. This worked fine before but when we added more IP's to the server the default server IP is no longer used. As it is now it picks up an ip that is added to eth0 as a alias (eth0:1, eth0:2 ....) the IP that is uses is an IP that is registred in the server and is an alias interface(eth0:1). All outgoing mails from postfix is now sent from that IP (eth0:1) and that IP in't yet used by any domain. Our defalt IP (eth0) is now longer registred as sent or recieved from x.x.x.x in outgoing mail.

How do I change this, I suppose it's in Postfix settings the changes should be done. In General Options there are some setting for network but I don't know if it's there the changes should go. I only want to use one IP(server defalt IP) for outgoing mails.

Regards, Leif

Thu, 11/23/2006 - 20:06
Blueforce

Hi Joe,

Any ideas about this, our costomer mails start to get rejected by some recipients mail servers. The IP for the hostname is not picked up right, the IP reported is not assigned to any domain. The user that sent this mail uses the default server IP.

It's not good that mails get rejected due to this.
I really need some advice about this.

Regards,
Leif

Nov 24 00:41:01 server postfix/smtp[[25517]]: B171D270065: to=< username@domain.tld], relay=mail.domain.tld[[000.000.000.000]], delay=187860, status=deferred (host mail.domain.tld[[000.000.000.000]] said: 450 Client host rejected: cannot find your hostname, [[000.000.000.000]] (in reply to RCPT TO command))
Nov 24 00:41:01 server postfix/smtp[[25518]]: C3B08270063: to=< username@domain.tld], relay=mail.domain.tld[[000.000.000.000]], delay=188094, status=deferred (host mail.domain.tld[[000.000.000.000]] said: 450 Client host rejected: cannot find your hostname, [[000.000.000.000]] (in reply to RCPT TO command))

Fri, 11/24/2006 - 00:16
Joe
Joe's picture

Hey Leif,

Postfix works on all IP addresses, but will send out of the one attached to your the hostname of the system in DNS (I think). I don't think you don't need to modify the postfix configuration--you need to get DNS working for the hostname your box has and reverse resolution for the IP.

Though I can't be sure from the scrubbed IP/address data you've given, it looks like you need to make reverse lookups work for the IP address. It doesn't have to reverse resolve to your mail.domain.tld address...it just has to reverse resolve to <i>something</i>.

--

Check out the forum guidelines!

Fri, 11/24/2006 - 00:27 (Reply to #3)
Blueforce

Hi Joe,

I don't understand why it dont use the default ip that the server use, it did untill I added the new ip's, and this was the reason I tried to remove those ip's not yet in use some days ago... the time when I totally did break the network.

I can send you a mail where you could look at the raw data if you want.

Regards,
Leif

Fri, 11/24/2006 - 00:47 (Reply to #4)
Blueforce

One more thing, If I have users that have their own ip, could the other users that use the shared ip, when sending mails be using one of the customers that have their own ip.

Is it possible to tell Postfix to use just one ip, as it does pick wich ever as it sound to me.

Regards,
Leif

Fri, 11/24/2006 - 02:34 (Reply to #5)
Joe
Joe's picture

Hey Leif,

<i>One more thing, If I have users that have their own ip, could the other users that use the shared ip, when sending mails be using one of the customers that have their own ip.

Is it possible to tell Postfix to use just one ip, as it does pick wich ever as it sound to me.</i>

No, you don't want what you think you want. ;-)

Postfix can be configured to <i>listen</i> on only one address, but you don't want that.

It cannot be configured explicitly to use some address for outgoing connections (almost no software can be configured in that way, as it requires network layer information that the standard libraries do not provide). Your problem is at the network layer, and can probably be fixed by making the outgoing address reverse resolve properly. (i.e. when you lookup the hostname of the IP address, it returns something--that's the error you're seeing...reverse resolution is not working for the address being used)

As mentioned in the previous message, you can alter that by making sure your default route is on the same network as the primary interface. But, that almost certainly is not the problem here. The problem, from what little I can see, is that the IP address that is being used does not resolve to a name.

--

Check out the forum guidelines!

Fri, 11/24/2006 - 03:13 (Reply to #6)
Blueforce

Of cource you right... have done some reading to :-)

Can I post the response on route -n here so you can take look, because I don't know what to make of it.

Sun, 06/07/2009 - 07:01 (Reply to #7)
Blueforce

Hi Joe,

I still don't know how to &quot;fix&quot; this. My problem is when customers that use the server default ip for their domains sends mail, the mail is not sent from the server default ip, instead it use another ip that will be assigned to new customer in just a few days. I don't think the customer want to have all other domains sending mails from their ip.

I can't understand why the default server ip no longer is used when sending mails. I probably have made something wrong when adding the other ip's to the server but I don't know where to look for it.

Regards,
Leif

Sun, 06/07/2009 - 07:01 (Reply to #8)
Blueforce

Hi Joe,

I still don't know how to &quot;fix&quot; this. My problem is when customers that use the server default ip for their domains sends mail, the mail is not sent from the server default ip, instead it use another ip that will be assigned to new customer in just a few days. I don't think the customer want to have all other domains sending mails from their ip.

I can't understand why the default server ip no longer is used when sending mails. I probably have made something wrong when adding the other ip's to the server but I don't know where to look for it.

Regards,
Leif

Fri, 11/24/2006 - 02:29 (Reply to #9)
Joe
Joe's picture

Hey Leif,

Ok, I've done a bit of reading, and for sending mail, Postfix uses the default route interface. There's not way to change this in the Postfix configuration. It is a network level detail. I'm having a hard time imagining a situation where a virtual interface (eth0:1) would be the default route interface, if all of your virtual interfaces are on the same network. If they are on different networks, you'll need to make sure your default route is on the network of your primary interface.

To see all of this:

route -n

You need for the default (0.0.0.0) router address to be on the same network as your primary interface.

And, of course, your primary interface address needs to reverse resolve to a name (any name will do).

If you'd like to send me specific details, I can probably be a bit more specific in guiding you on how to get the behavior you're after.

--

Check out the forum guidelines!

Fri, 12/01/2006 - 20:54
Joe
Joe's picture

Hey Leif,

I'll be happy to login and straighten it out. Send over your server details to joe@virtualmin.com.

--

Check out the forum guidelines!

Fri, 12/01/2006 - 21:26 (Reply to #11)
Blueforce

Thanks Joe,

I would like to send you a mail with the info.
I may have found the problem. (I think) the mail gets sent from server default ip now but I hade to remove the &quot;new ip range&quot; gateway from eth0.

I think the &quot;new ip range&quot; network(destination) should not use the default(0.0.0.0), I think it should use the assigned gateway for the network.

Regards,
Leif

Topic locked