Load balancing with Tomato by port forwarding to a list of IPs randomly?

Discussion in 'Tomato Firmware' started by WindSlash, Feb 6, 2009.

  1. WindSlash

    WindSlash Addicted to LI Member

    Is it possible to forward a single port to one of the IPs in a list randomly to achieve a rough load balancing with Tomato or iptables?


    Ideally I'd like to be able to do this in Tomato's basic port forwarding page:

    Code:
    Port 80 forwards to port 80 on x.x.x.10, x.x.x.11, x.x.x.12
    or as 3 separate entries

    Code:
    Port 80 forwards to port 80 on x.x.x.10
    Port 80 forwards to port 80 on x.x.x.11
    Port 80 forwards to port 80 on x.x.x.12
    When a user connects to port 80, s/he gets randomly forwarded to one of the IPs listed.
     
  2. Planiwa

    Planiwa Network Guru Member

    Possibly?:

    Code:
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to x.y.z.10 --to y.y.z.11 --to x.y.z.12
     
  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