iptables to DNAT to a runuobox

Discussion in 'FAQ Forum' started by Erucid, Mar 18, 2011.

  1. Erucid Sorceror

    Message Count:
    368
    I don't know where to put this so I'll just post it here. I spent some time trying to get my linux firewall DNT to my runuo box. And I finally got it to work with these iptables rules.

    NOTE: This linux firewall is a seperate box from my runuo box. This is not the firewall configuration for the runuo box its self.

    _RUNUO=YourInternalIPofTheRunuoBox
    _GATEWAY=$(ifconfig eth0 | grep -v inet6 | grep inet | cut -d : -f 2 | sed 's/Bcast//')
    iptables -t nat -A PREROUTING -p tcp --dport 2593 -j DNAT --to $_RUNUO:2593
    #iptables -t nat -A POSTROUTING -s $_RUNUO -p tcp --sport 2593 -j SNAT --to-source $_GATEWAY
    iptables -A INPUT -d $_RUNUO -p tcp --dport 2593 -j ACCEPT
    iptables -A OUTPUT -s $_RUNUO -p tcp --dport 2593 -j ACCEPT

    NOTE: commented out line above may or may not be needed. I think it may actually have cause a problem with internal clients disconnecting. 10/26/11

    WARNING: Beware of word wrapping. There should be 6 lines. We assume eth0 is the inernet interface. If not, modify line 2.

    You can read more about my linux firewall project here.
    http://blog.computerant.com/2011/03/02/rampart-router-firewall-proxy-wap/

Share This Page