Find the answer to your Linux question:
Results 1 to 3 of 3
Hello everyone, I have three interfaces, eth0 - aaa.aaa.aaa.aaa - external eth1 - bbb.bbb.bbb.bbb - internal eth2 - ccc.ccc.ccc.ccc - external I want all internal traffic (from eth1) to go ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    2

    iptables forwarding from one interface to another


    Hello everyone,

    I have three interfaces,

    eth0 - aaa.aaa.aaa.aaa - external
    eth1 - bbb.bbb.bbb.bbb - internal
    eth2 - ccc.ccc.ccc.ccc - external

    I want all internal traffic (from eth1) to go out eth0, with the exception of HTTP traffic which I want to go out eth2.

    I've satisfied my major condition with my routing table, but I can't seem to implement the exception. I've tried POSTROUTING/MASQUERADE and PREROUTING/SNAT, but I can't seem to figure it out.

    My problem is that I don't know how to tell iptables which interface the packet should leave the system through. I can specify what the destination ip should be, but I'm not sure how to tell it which interface.

    Any help would be appreciated.

    Thanks in advance,

    //Rob

  2. #2
    Just Joined!
    Join Date
    Mar 2007
    Posts
    2

    ROUTE patch

    Through investigation on the web it seems that there is a ROUTE patch for iptables that allows exactly what I want. I'd really like to avoid rebuilding my kernel, does anyone know of another solution?

    //Rob

  3. #3
    Linux Newbie framp's Avatar
    Join Date
    Jul 2006
    Location
    Stuttgart, Germany
    Posts
    240
    Shouldn't be a big deal with iptables. Just use the option -i and -o for the interfaces and ! -dport in conjunction with -d. You'll get further details with 'man iptables'.
    "Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." Linus Benedict Torvalds

Posting Permissions

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