Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, i have something quite simple: I have one host with an ipaddress and one NIC. now I would like that certain ports of that machine (25/80/110/143/443) would be redirected ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    2

    iptables redirection


    Hi,

    i have something quite simple: I have one host with an ipaddress and one NIC.
    now I would like that certain ports of that machine (25/80/110/143/443)
    would be redirected to some other machine, because that one is replacing
    the other, and I do not wish that there is any interruption in traffic.

    so machine A has: 212.0.1.1 and one NIC
    and machine B has: 121.0.2.2 and one NIC.

    now i'm reading things like:
    iptables -t nat -A PREROUTING -d 212.0.1.1 -p tcp \
    --dport 80 -j DNAT --to-destination 121.0.2.2

    which doesn't work.

    what does work is something like:
    iptables -t nat -A OUTPUT -d 212.0.1.1 -j DNAT --to \
    121.0.2.2

    but thats only for traffic which comes from the host itself, not for
    foreign traffic that is going to the host.

    hope someone can help.

  2. #2
    Just Joined!
    Join Date
    Jun 2007
    Posts
    12
    Perhaps you should add a rule in FORWARD chain...

Posting Permissions

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