Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-13-2008, 01:45 PM
Jack Snodgrass
 
Posts: n/a
bind outgoing mail connects to virtual ip address?

I'm pretty sure that this has been asked before... but I googled a bit
and could not find an answer....

I have a server running postfix ( don't think that the mail server
software will make a difference ) and it has a primary IP Address
and a 2nd / virtual IP Address. The 2nd / virtual IP address is
reverse mapped back to my domain so when I send mail, I want that
IP Address to be associated with the connection. Normally, the main
IP Address on the Interface is used.... this does not reverse back
to my domain so I need to use the 2nd / virtual Ip address on the
outgoing mail connects. Some mail servers do a reverse lookup on
the incoming connection and act differently if you say that you
are 'y' but your reverse lookup says that you are 'x'.

I am pretty sure that iptables is the answer... but I'm not sure
if I want to mangle or snat or what....

Thanks - jack

--
D.A.M. - Mothers Against Dyslexia

see http://www.jacksnodgrass.com for my contact info.

jack - Grapevine/Richardson
Reply With Quote
  #2 (permalink)  
Old 03-13-2008, 01:58 PM
Peter Ludikovsky
 
Posts: n/a
Re: bind outgoing mail connects to virtual ip address?

Jack Snodgrass wrote:
> I'm pretty sure that this has been asked before... but I googled a bit
> and could not find an answer....
>
> I have a server running postfix ( don't think that the mail server
> software will make a difference ) and it has a primary IP Address
> and a 2nd / virtual IP Address. The 2nd / virtual IP address is
> reverse mapped back to my domain so when I send mail, I want that
> IP Address to be associated with the connection. Normally, the main
> IP Address on the Interface is used.... this does not reverse back
> to my domain so I need to use the 2nd / virtual Ip address on the
> outgoing mail connects. Some mail servers do a reverse lookup on
> the incoming connection and act differently if you say that you
> are 'y' but your reverse lookup says that you are 'x'.
>
> I am pretty sure that iptables is the answer... but I'm not sure
> if I want to mangle or snat or what....
>
> Thanks - jack
>


In postfix main.cf set (according to man 5 postconf
[http://linux.die.net/man/5/postconf])
inet_interfaces = <virtual ip adress>

HTH
/peter
Reply With Quote
  #3 (permalink)  
Old 03-13-2008, 02:05 PM
Jack Snodgrass
 
Posts: n/a
Re: bind outgoing mail connects to virtual ip address?

On Thu, 13 Mar 2008 13:58:25 +0100, Peter Ludikovsky wrote:

> Jack Snodgrass wrote:
>> I'm pretty sure that this has been asked before... but I googled a bit
>> and could not find an answer....
>>
>> I have a server running postfix ( don't think that the mail server
>> software will make a difference ) and it has a primary IP Address
>> and a 2nd / virtual IP Address. The 2nd / virtual IP address is
>> reverse mapped back to my domain so when I send mail, I want that
>> IP Address to be associated with the connection. Normally, the main
>> IP Address on the Interface is used.... this does not reverse back
>> to my domain so I need to use the 2nd / virtual Ip address on the
>> outgoing mail connects. Some mail servers do a reverse lookup on
>> the incoming connection and act differently if you say that you
>> are 'y' but your reverse lookup says that you are 'x'.
>>
>> I am pretty sure that iptables is the answer... but I'm not sure
>> if I want to mangle or snat or what....
>>
>> Thanks - jack
>>

>
> In postfix main.cf set (according to man 5 postconf
> [http://linux.die.net/man/5/postconf])
> inet_interfaces = <virtual ip adress>
>
> HTH
> /peter


thanks... but that is for incoming mail... that tells postfix which
ip addresses you want to listen on... when it send mails, it goes
out the default iface and uses the main ip address associated with
it...

jack

--
D.A.M. - Mothers Against Dyslexia

see http://www.jacksnodgrass.com for my contact info.

jack - Grapevine/Richardson
Reply With Quote
  #4 (permalink)  
Old 03-13-2008, 04:20 PM
Pascal Hambourg
 
Posts: n/a
Re: bind outgoing mail connects to virtual ip address?

Hello,

Jack Snodgrass a écrit :
>
> I have a server running postfix ( don't think that the mail server
> software will make a difference )


The mail software does matter. I don't know about postfix, but exim has
an "interface" option which allows to specify the source adress for
outgoing SMTP connections.

> and it has a primary IP Address
> and a 2nd / virtual IP Address. The 2nd / virtual IP address is
> reverse mapped back to my domain so when I send mail, I want that
> IP Address to be associated with the connection. Normally, the main
> IP Address on the Interface is used.... this does not reverse back
> to my domain so I need to use the 2nd / virtual Ip address on the
> outgoing mail connects.


Why do you need 1) a second address and 2) that address reverse back to
your domain ?

> Some mail servers do a reverse lookup on
> the incoming connection and act differently if you say that you
> are 'y' but your reverse lookup says that you are 'x'.


Why not just set up postfix so the HELO/EHLO name matches the primary
address reverse name ?

> I am pretty sure that iptables is the answer... but I'm not sure
> if I want to mangle or snat or what....


Iptables may be one answer. First, you need to match packets sent from
postfix belonging to outgoing SMTP connections. Then you need to SNAT
those connections with the desired address.

If the postfix process runs as a specific user, you can match the user
id with the 'owner' match. You'll have to MARK the matching packets
because 'owner' is valid only in the OUTPUT chain and 'SNAT' is valid
only in the POSTROUTING chain.

iptables -t mangle -A OUTPUT -m owner --uid-owner <posfix_user_id> \
-j MARK --set-mark 0x1
iptables -t nat -A POSTROUTING -m mark --mark 0x1 \
-j SNAT --to-source <secondary_address>

You can also just match the destination port 25.

iptables -t nat -A POSTROUTING -p tcp --dport 25 \
-j SNAT --to-source <secondary_address>

Or both.

iptables -t mangle -A OUTPUT -m owner --uid-owner <posfix_user_id> \
-j MARK --set-mark 0x1
iptables -t nat -A POSTROUTING -p tcp --dport 25 -m mark --mark 0x1 \
-j SNAT --to-source <secondary_address>
Reply With Quote
  #5 (permalink)  
Old 03-13-2008, 04:52 PM
Peter Ludikovsky
 
Posts: n/a
Re: bind outgoing mail connects to virtual ip address?

Jack Snodgrass wrote:
> On Thu, 13 Mar 2008 13:58:25 +0100, Peter Ludikovsky wrote:
>
>> Jack Snodgrass wrote:
>>> I'm pretty sure that this has been asked before... but I googled a bit
>>> and could not find an answer....
>>>
>>> I have a server running postfix ( don't think that the mail server
>>> software will make a difference ) and it has a primary IP Address
>>> and a 2nd / virtual IP Address. The 2nd / virtual IP address is
>>> reverse mapped back to my domain so when I send mail, I want that
>>> IP Address to be associated with the connection. Normally, the main
>>> IP Address on the Interface is used.... this does not reverse back
>>> to my domain so I need to use the 2nd / virtual Ip address on the
>>> outgoing mail connects. Some mail servers do a reverse lookup on
>>> the incoming connection and act differently if you say that you
>>> are 'y' but your reverse lookup says that you are 'x'.
>>>
>>> I am pretty sure that iptables is the answer... but I'm not sure
>>> if I want to mangle or snat or what....
>>>
>>> Thanks - jack
>>>

>> In postfix main.cf set (according to man 5 postconf
>> [http://linux.die.net/man/5/postconf])
>> inet_interfaces = <virtual ip adress>
>>
>> HTH
>> /peter

>
> thanks... but that is for incoming mail... that tells postfix which
> ip addresses you want to listen on... when it send mails, it goes
> out the default iface and uses the main ip address associated with
> it...
>
> jack
>


Quote postconf(5), under inet_interfaces:
When inet_interfaces specifies just one IPv4 and/or IPv6 address that
is not a loopback address, the Postfix SMTP client will use this
address as the IP source address for outbound mail....
...
Setting $inet_interfaces to a single IPv4 and/or IPV6 address is
primarily useful with virtual(5,8) host- ing of domains on secondary IP
addresses

HTH
/peter
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:01 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Property in India | Mortgages | Hackers | Mortgage Calculator | Credit Card



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114