1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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: 192.168.2.244

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

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

    mstombs Network Guru Member

    probably selects only the wireless interface, suggest you try
    Code:
    -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 192.168.2.244 -j REDIRECT --to-ports 8118

    or

    iptables -t nat -A OUTPUT -p tcp -d 192.168.2.244 -j REDIRECT --to-destination 192.168.2.111:8118
     

Share This Page