IP rotation with postfix mail server

Here are the tips for how to configure IP rotation with postfix MTA.

Here is the first perl program for implementing IP rotation.






Make it Executable:

  # chmod 755 random.pl 

open vi /etc/postfix/master.cf

Run the scripts via postfix spawn daemon service.

# 127.0.0.1:2527   inet   n     n     n      -       0      spawn
             user=nobody argv=/etc/postfix/random.pl

add 5 smtp client services called rotate1, rotate2, rotate3, rotate4, rotate5, that bind to its own ip
address and has uniq syslog/helo name.


# random smtp
02rotate1  unix -       -       n       -       -       smtp
03          -o syslog_name=postfix-rotate1
04          -o smtp_helo_name=smtp1.example.com
05          -o smtp_bind_address=1.2.3.1
06
07rotate2  unix -       -       n       -       -       smtp
08          -o syslog_name=postfix-rotate2
09          -o smtp_helo_name=smtp2.example.com
10          -o smtp_bind_address=1.2.3.2
11
12rotate3  unix -       -       n       -       -       smtp
13          -o syslog_name=postfix-rotate3
14          -o smtp_helo_name=smtp3.example.com
15          -o smtp_bind_address=1.2.3.3
16
17rotate4  unix -       -       n       -       -       smtp
18          -o syslog_name=postfix-rotate4
19          -o smtp_helo_name=smtp4.example.com
20          -o smtp_bind_address=1.2.3.4
21
22rotate5  unix -       -       n       -       -       smtp
23          -o syslog_name=postfix-rotate5
24          -o smtp_helo_name=smtp5.example.com
25          -o smtp_bind_address=1.2.3.5


Before we actually implement our randomize transport, let’s make sure that the setting actually work.
Reload postfix
# service postfix reload
  Run this query fiew times, and you’ll see the perl script will return “random answer” transport
 
    postmap -q "whatever" tcp:127.0.0.1:2527

rotate1:
# postmap -q "whatever" tcp:127.0.0.1:2527

rotate4:

And so on..
Note on “whatever”, since the script acted in “catch-all” mode as i’ve mentioned earlier, what ever postfix transport_maps client asked. it will be answered with random values such as rotate1, rotate2, rotate3, rotate4, rotate5 in randomized fashion.
main.cf parts
Add these lines
transport_maps = tcp:[127.0.0.1]:2527
2127.0.0.1:2527_time_limit = 3600s

Reload postfix. that is. Test your log file is Ip rotation is ready or not.



Comments

  1. we will always appreciate all you have done here because I know you are very concerned with our.
    Host bar job listing website

    ReplyDelete
  2. postmap -q "whatever" tcp:127.0.0.1:2527
    postmap: warning: /etc/postfix/main.cf, line 373: overriding earlier entry: transport_maps=proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf proxy:mysql:/etc/postfix/mysql/transport_maps_maillist.cf proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf

    rotate work but I have this problem I but not received, only received if delete on main.cf but dont work rotation
    transport_maps = tcp:[127.0.0.1]:2527
    127.0.0.1:2527_time_limit = 3600s

    ReplyDelete

Post a Comment