Redirect All Traffic from one LAN IP to another LAN IP/Port. IPTABLES rule?

Discussion in 'Networking Issues' started by ndoggac, Mar 12, 2010.

  1. ndoggac

    ndoggac Network Guru Member

    I'm running a Linksys WRT54GL with the latest Tomato firmware.

    I have a specific network device on my LAN with a static IP address. I would like to redirect all traffic from this device back to an internal static IP address and port on my LAN. Is this possible with an IPTABLES rule? The network device does not have the capability to input proxy information, so I want to use the Tomato router to redirect all traffic from only that device back to a Linux server I have running privoxy and tor. Everything else on the LAN should continue accessing the internet as it did before.

    Thanks in advance for any help you can provide.
  2. ndoggac

    ndoggac Network Guru Member

    Tried this with no luck. I think I'm on the right track, just can't quite get it exactly.

    Device IP I want forwarded:

    IP Address of server with privoxy/tor listening on port 8118:

    iptables -t nat -A PREROUTING -s -p tcp -j DNAT -i eth1 --to-destination
  3. mstombs

    mstombs Network Guru Member

    probably selects only the wireless interface, suggest you try
    -i br0
    for the lan bridge
  4. ndoggac

    ndoggac Network Guru Member

    Tried it with br0 instead of eth1, still didn't work...should I be using the "OUTPUT" switch in my IPTABLES command? I'm only worried about outbound traffic, the device will only be downloading, nothing will have to access it from the WAN side.

    iptables -t nat -A OUTPUT -p tcp -d -j REDIRECT --to-ports 8118


    iptables -t nat -A OUTPUT -p tcp -d -j REDIRECT --to-destination
  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