The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sending email on a different IP

Discussion in 'E-mail Discussions' started by Haloweb, May 23, 2006.

  1. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Hi Everyone

    Ok I am no genous so please bear with me :)

    I have my own box and my main hosting services site on its own dedicated IP
    however sending mail is done via the servers shared IP

    Due to some clients sending spam which has now been corrected my legit emails
    were being returned by other mail servers, to prevent this from happening in future
    I would like to send mail on a different IP .... is there anyway this can be done
    on the same box

    I know I could probably setup a hosting account somewhere else and then change
    my mx entries but is there another way

    thanks for your help in advance
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    If your IP is blocked due to spaming reason and you wish to route all the outgoing emails from a different IP, you can do so by using a Iptable rule.
    All the outgoing packets for port 25 will then have there source address changed to the new IP and emails will start working without any problems. You will have to add the rule in NAT table and under postrouting chain.
     
    #2 madaboutlinux, May 23, 2006
    Last edited: May 23, 2006
  3. tweakservers

    tweakservers Well-Known Member

    Joined:
    Mar 30, 2006
    Messages:
    379
    Likes Received:
    0
    Trophy Points:
    16
    You may edit your exim.conf under the "Transports Configuration", find the following line :

    Add in the following :

    Result will be :

    Replace xxx with one of the IP you have added to the server and restart the exim services. This will have your outgoing mails sent using the above IP instead of the share IP.
     
  4. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Thanks everyone

    tweakservers I think I will definatly be using your option

    Thanks again
     
  5. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    Here's the iptable rule if other solution won't help you :-
    iptables -t nat -A postrouting -o eth0 -p tcp -j SNAT --dport 25 --to-source xx.xx.xx.xx

    where,
    xx is the new ip on the server from where you will route your emails from.

    Then execute :-
    service iptables save
    service iptables restart

    Also you can check whether the rule is added properly or not by :-
    iptables -t nat -n -L
     
  6. RickG

    RickG Well-Known Member

    Joined:
    Feb 28, 2005
    Messages:
    238
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    North Carolina
    Is it possible to use this technique to change the sending IP for a specific domain (or account) that you host?

    For example, if one of the accounts on your server has a dedicated IP, can you change the sending IP for that one account (but have all others accounts use the default shared IP for sending mail)?
     
  7. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Rick

    How would I do this as the other solution above did not seem to work
    mails were still going out on the shared IP
     
  8. RickG

    RickG Well-Known Member

    Joined:
    Feb 28, 2005
    Messages:
    238
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    North Carolina
Loading...

Share This Page