Dynamic IP/NAT with 5 static IPs..

Discussion in 'Tomato Firmware' started by iransofaraway, Aug 27, 2014.

  1. iransofaraway

    iransofaraway Network Newbie Member

    I'm running TomatoUSB (shibby's latest build) on my Asus RT-N66U. My cable provider will assign me a dynamic IP, or I can also use 5 different static IPs.

    Ideally, I'd like the router to just use a dynamic IP, and "share" that to all the clients, meaning all their traffic routes through that. The dynamic IPs seem to have different IP ranges, different gateways, etc. whenever you refresh, so they pull from a pretty huge pool.

    But then I have some devices that I want to route the static IPs to static internal IPs.

    I was trying to do this by messing with the "Firewall" -> "Scripts" section-- adding the IP address to the routing table, and then forwarding all traffic to/from the internal IP to the external static IP:

    /usr/sbin/ip addr add x.x.x.123/28 dev vlan2

    /usr/sbin/iptables -t nat -I PREROUTING 1 -d x.x.x.123 -j DNAT --to
    /usr/sbin/iptables -I FORWARD -d -j ACCEPT
    /usr/sbin/iptables -t nat -I POSTROUTING 1 -s -j SNAT --to x.x.x.123

    But... these static IPs require a different gateway. So the DHCP gateway and static IP gateway are probably not going to be the same, ever. So how do I do this?

    Is there some way to achieve what I'm asking for? Or am I screwed? Thanks in advance for any help.
  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