Use a different IP for sending mail

If you find yourself in a pinch and you need a temporary fix when your primary IP is blacklisted, use the following iptables rule:

/sbin/iptables -t nat -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source [desired outgoing ip]

Keep in mind, however, that you will need to adjust any applicable SPF records for your domains since your e-mail will appear to be leaving via one of the secondary IP's on your server. Also, remember that this is only a temporary fix - you should find out why you were blacklisted and eliminate that problem as soon as possible. :-)

Printed from: http://rackerhacker.com/2007/08/27/use-a-different-ip-for-sending-mail/ .
© Major Hayden 2012.

1 Comment   »

  • Ashutosh says:

    Hello sir,
    I want to use a different IP for sending mail. But i don't know where and how to use that code (/sbin/iptables -t nat -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source [desired outgoing ip]) in asp.net.

    Please HELP !!!

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this