Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

IP rotation

Discussion in 'E-mail Discussion' started by imran_k, Mar 10, 2014.

  1. imran_k

    imran_k Registered

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    I want to rotate IP Address every two hours to send mail from the WHM/cPanel server.
    My WHM/cPanel version is 11.42 and exim version is 4.82. Please provide me the step by step procedure to do this automatically.

    Thanks,
    Imran Khan.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Could you elaborate on the purpose of alternating your IP address? For instance, do you mean you want to send from a different IP address every two hours? Is your server's IP becoming blocked by spam lists?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. imran_k

    imran_k Registered

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes I want to send mails from different IP Address every hours. I want to maintain reputation of all the IP address which are in the servers.

    Thanks,
    Imran Khan.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    I'm not sure I understand how changing the IP addresses is going to make a difference. If SPAM is sent out, it could still result in an IP address getting added to a blacklist. However, by changing the IP address, you ensure the domain name that did not send out the SPAM is blacklisted instead of the domain name that sent it out.

    I recommend taking steps to prevent email abuse on your server. The following document is a good place to start:

    cPanel - Prevent Email Abuse

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. imran_k

    imran_k Registered

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes I want to send mails from different IP Address every hours. How to do this?

    Thanks,
    Imran Khan.
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,478
    Likes Received:
    421
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Did you lose the login details to your other forum account? If yes, I can help. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    There are no native features that would allow you to rotate the IP addresses used for sending out email. The options included with cPanel/WHM only allow for the permanent change of the IP addresses used for sending. You would have to develop a script that makes the changes listed here automatically. That being said, please see my previous response on this thread, as it seems like this type of setup might not be a good idea.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    834
    Likes Received:
    29
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    I wrote this a while back for someone else, maybe it can help you. It's intended to run via cron. Just put your IPs in /etc/mailipaddrpool, one on each line.

    Code:
    #!/bin/bash
    # Exim Outgoing IP address rotator
    # The cPanel Admin 5/9/11
    # Files: /etc/mailipaddrpool : list of IP addresses to use for mail
    
    ipfile=/etc/mailipaddrpool
    curip=$(grep "*:" /etc/mailips |awk '{print $2}')
    
    if [[ "$curip" == "" ]] || ! grep $curip $ipfile >/dev/null ; then
    	curip=$(tail -1 $ipfile)
    fi
    
    nextipct=$(cat $ipfile |grep -A 1 $curip |wc -l)
    
    if [ "$nextipct" == "1" ];then
    	nextip=$(head -1 $ipfile)
    else
    	nextip=$(cat $ipfile |grep -A 1 $curip | tail -1)
    fi
    
    sed '/*:/d' -i /etc/mailips
    sed '/^$/d' -i /etc/mailips
    echo "*: $nextip" >> /etc/mailips
    
    It's not the prettiest, but it does the job. To add on to cPanelMichael's point, you may want to add measures to limit how many rotations are done within a certain period of time. If someone is spamming from your server and you're changing the IP, every IP you change to will get blacklisted.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. TeqExperts

    TeqExperts Registered

    Joined:
    May 11, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have found script do Ip rotation but, need someone explain step by step cause i need it too

    /http://jackal777.wordpress.com/2012/08/26/script-to-rotate-ip-of-a-cpanel-domain/
    Script to rotate IP of a cpanel domain
     
  10. slideloft

    slideloft Member

    Joined:
    May 8, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    this is what i found from the link
    should i add like this
    # Files: /etc/mailipaddrpool : 1.0.02,1.0.03,1.0.0.4
    Assuming the ip are 1.0.02,1.0.03,1.0.0.4

    #!/bin/bash
    # Exim Outgoing IP address rotator
    # The cPanel Admin 5/9/11
    # Files: /etc/mailipaddrpool : list of IP addresses to use for mail

    ipfile=/etc/mailipaddrpool
    curip=$(grep "*:" /etc/mailips |awk '{print $2}')

    if [[ "$curip" == "" ]] || ! grep $curip $ipfile >/dev/null ; then
    curip=$(tail -1 $ipfile)
    fi

    nextipct=$(cat $ipfile |grep -A 1 $curip |wc -l)

    if [ "$nextipct" == "1" ];then
    nextip=$(head -1 $ipfile)
    else
    nextip=$(cat $ipfile |grep -A 1 $curip | tail -1)
    fi

    sed '/*:/d' -i /etc/mailips
    sed '/^$/d' -i /etc/mailips
    echo "*: $nextip" >> /etc/mailips
     
  11. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Yes, however ensure the IP addresses are on separate lines in the /etc/mailipaddrpool file. EX:

    Code:
    1.1.1.1
    2.2.2.2
    3.3.3.3
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. 24x7ss

    24x7ss Well-Known Member

    Joined:
    Sep 30, 2014
    Messages:
    271
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Or you can simply create a bash script to replace the IP for *: <ip> in /etc/mailips and run it every 2 hr in root cron.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice