Find the answer to your Linux question:
Results 1 to 4 of 4
I have a redhat 7.2 firewall with a redhat 8.0 pop3 email server and they are not on a local network together. I recently reset the Iptables rules on the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Posts
    4

    Iptables, email forwarding


    I have a redhat 7.2 firewall with a redhat 8.0 pop3 email server and they are not on a local network together.

    I recently reset the Iptables rules on the firewalll(big mistake) and now email is no longer being sent to the mail server. So by my master reasoning I'm guessing there was a rule forwarding email that is now lost.

    A couple of things I have tried that have not worked(though its possible I'm doing something wrong)

    1. iptables -t nat -A PREROUTING -t nat -p tcp $FireWallIP --dport 25 -j DNAT -to $EmailIP:25

    2. iptables -t nat -A PREROUTING -d $FireWallIP -p tcp --dport 25 -j DNAT --to-destination $EmailIP:25(also tried $EmailIP)

    3. iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 25 -j DNAT --to $EmailIP:25(als tried $EmailIP)

    The fireWall does have 2 ipaddresses,(external, internal) while the Mail server only has an external one. I've only tried using the firewall's external ip address. I did try the internal once, but it cut off internet for everybody on the network(the firewall also acts as the default gateway for our windows machines) Any help appreciated.

    Thanks

  2. #2
    Linux User
    Join Date
    Feb 2005
    Posts
    290
    First, do postrouting for your email server (i suppose your email server is configured to use the firewall as gateway):

    Code:
    iptables -t nat -A POSTROUTING -s $EmailIP -o eth0 -j MASQUERADE
    
    #enable port forwarding
    echo "1" > /proc/sys/net/ipv4/ip_forward
    
    iptables -t nat -A PREROUTING -t nat -p tcp -d $FireWallIP --dport 25 -j DNAT --to $EmailIP:25

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Posts
    4
    I'm not sure if the email server uses the firewall as a gateway. The firewall is used as a gateway to my LAN but the mail server is connected to the same hub that the firewall is and that our T1 line comes in on.

  4. #4
    Linux Enthusiast puntmuts's Avatar
    Join Date
    Dec 2004
    Location
    Republic Banana
    Posts
    562
    Quote Originally Posted by bsherwood
    I'm not sure if the email server uses the firewall as a gateway. The firewall is used as a gateway to my LAN but the mail server is connected to the same hub that the firewall is and that our T1 line comes in on.
    What does the command route tell ?
    I\'m so tired .....
    #200472

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •