IPTABLES POSTROUTING Load balancing help

Hi there,
I have an interface with 5 IP addresses assigned to it (as virtual adapters) let's call them x1,x2,x3,x4 and x5.
Currently I have SNAT POSTROUTING forwarding rules from local source range to specific public ip address. Below is an example for the current rule
-A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source x1.x1.x1.x1
What I would like to achieve is that new established local connections will be postrouted and assigned to one of the IPs above (x1/x2/x3/x4/x5) randomly / round robin. I tired to look for a solution online but I didn't find any information for how to do so. I almost sure its feasible.
Many thanks for your help guys!
Amit

fukawi2 wrote:
I haven't tested, but this should do it:
Alternatively, but this may lead to bias towards x5:
I understand it differently: iptable rules are independent and traversed in order, so the unbiased chain should be
iptables -t nat -N OUTPUT_LB
iptables -t nat -A OUTPUT_LB -m statistic --mode nth --every 5 --packet 0 -j SNAT --to x1
iptables -t nat -A OUTPUT_LB -m statistic --mode nth --every 4 --packet 0 -j SNAT --to x2
iptables -t nat -A OUTPUT_LB -m statistic --mode nth --every 3 --packet 0 -j SNAT --to x3
iptables -t nat -A OUTPUT_LB -m statistic --mode nth --every 2 --packet 0 -j SNAT --to x4
iptables -t nat -A OUTPUT_LB -j SNAT --to x5
iptables -t nat -A OUTPUT -m state --state NEW -j OUTPUT_LB
iptables -t nat -N OUTPUT_LB
iptables -t nat -A OUTPUT_LB -m statistic --mode random --probability 0.20000 -j SNAT --to x1
iptables -t nat -A OUTPUT_LB -m statistic --mode random --probability 0.25000 -j SNAT --to x2
iptables -t nat -A OUTPUT_LB -m statistic --mode random --probability 0.33333 -j SNAT --to x3
iptables -t nat -A OUTPUT_LB -m statistic --mode random --probability 0.50000 -j SNAT --to x4
iptables -t nat -A OUTPUT_LB -j SNAT --to x5
iptables -t nat -A OUTPUT -m state --state NEW -j OUTPUT_LB

Similar Messages

  • Load Balancing help needed...

    I've been asked to research/implement load balancing on our Java only NW2004s EP (Unix) installation.
    I've read the help files here, but not sure I understand what I'm supposed to do, if anything at this point.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d3/e12840d89d185de10000000a1550b0/frameset.htm
    Right now we have only one system, so from what I can tell, implementing the SAP Web Dispatcher for load balancing isn't an option.
    I see there is also load balancing from the Java dispatcher. This I think is our only option at this point until we move to a production scenario with some other systems clustered.
    Nonetheless, I don't really see any implementation details on configuring the java dispatcher. Which gives me the impression that it's job is automatic.
    Could someone point me in the right direction so that we might might get some kind of load balancing implemented, or atleast get us moving in the right direction?
    Thanks alot.
    Beau

    I've been asked to research/implement load balancing on our Java only NW2004s EP (Unix) installation.
    I've read the help files here, but not sure I understand what I'm supposed to do, if anything at this point.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d3/e12840d89d185de10000000a1550b0/frameset.htm
    Right now we have only one system, so from what I can tell, implementing the SAP Web Dispatcher for load balancing isn't an option.
    I see there is also load balancing from the Java dispatcher. This I think is our only option at this point until we move to a production scenario with some other systems clustered.
    Nonetheless, I don't really see any implementation details on configuring the java dispatcher. Which gives me the impression that it's job is automatic.
    Could someone point me in the right direction so that we might might get some kind of load balancing implemented, or atleast get us moving in the right direction?
    Thanks alot.
    Beau

  • CSM Load Balancer Help

    Hey,
    Just a quick question....
    Does anyone know a) if it's possible and b) how to have two servers off the CSM but instead of load-balancing between them make them a failover pair i.e. if server A goes down server B will take over - done using the same VIP?? It's needed because the application on the servers can't do load-balancing yet but can work in a failover way.
    I'm reading the book trying to work it out but if someone has done this before that would be great!
    Thanks
    Anthony

    Thanks for the responses.
    I'm using CSM 4.6(6) and have given what you suggested a go but have run into problems.
    When I disconnect the primary server I see that go out of service but that also knocks out the VIP and it never fails over to the second server. Am I missing something? I've attached the relevant parts of the config and would be greatful for any advice.
    serverfarm FARM1
    nat server
    nat client WEB
    real 10.2.250.10
    inservice
    probe HTTP
    serverfarm FARM2
    nat server
    nat client WEB
    real 10.2.250.11
    inservice
    probe HTTP
    vserver WEBTRAFFIC
    virtual 10.2.250.100 tcp www
    vlan 250
    serverfarm FARM1 backup FARM2
    persistent rebalance
    inservice
    I also had a go at creating that variable but it wouldn't let me...just said variable not configurable - but I'll play with that and see if I can work it out...I'm not so bothered as long as the backup part works.
    Thanks guys...
    Anthony

  • CSS Load Balance Help

    Hi there,
    I need a help, and I have this following situation:
    *My Service is web and its listen TCP ports - 443 Https and 80 http
    *The port 443 is only used to login and after its login all web requisitions are by port 80 www
    *We have 02 services running and we want a VIP in order to serve the 02 ports mentioned.
    *The access persistency must occurs in the CSS. A same client requisition on port 80 or 443 must redirect the user to the same server already answered the login requisition in the https login
    Is tehre any configuration possible to do in order to accomplish that?
    Any help is welcome.
    Regards

    Message Addendum: Any cisco web site reference will be appreciated.
    CSS model and OS version:
    CSS_01# show ver
    Version: sg0730106 (07.30.1.06)
    Flash (Locked): 07.30.1.06
    Flash (Operational): 07.30.1.06
    Type: PRIMARY
    Licensed Cmd Set(s): Standard Feature Set
    CSS_01# show chassis
    Configuration for CSS11503-AC E0:
    Product Name: CSS11503-AC E0 SW Version: 07.30.1.06
    Serial Number: JAB0831L01G Base Mac Address: 00-11-92-d1-60-9f
    Slot Number Module Name Status
    1 CSS5-SCM-2GE primary
    2 CSS5-IOM-2GE primary
    3 empty slot
    4 CSS503-SM-INT powered-on
    Slot / Port Name Status
    1/1 SCM-2GE online
    1/2 SCM-2GE online
    2/1 IOM-2GE online
    2/2 IOM-2GE online
    CSS_01#

  • Linksys RV042 Dual Wan with Load Balancing Help?

    Good day,
    I'm a newbie to routers.  I have purchased a Linksys RV042 hoping I could connect my two modem and provide internet to my collegues in the camp.  My internet connection is running under EAP-TLS using a Motorola modem from Go Telecom here in Saudi Arabia.  Need help to configure the router to accept the two modem.
    Thanks for the reply.....

    Hello David,
    Glad you could spend some time with my problem.  Tried the solution you sent but still unsuccesful to connect to internet.  Is there something wrong with the WAN credentials I'm using?  Do I have to switch the mode from Gateway to Router?  Please take a look at my WAN1 values that I wrote in the RV042
    I am using a Motorola CPE outdoor Wimax modem from GO Telacom here in Saudi Arabia...

  • RDS 2008 R2 / Load Balancing, My 1st Setup. Help.

    I currently have a 2008 R2 RDS server setup with around 100 people accessing, unfortunately we're starting to see 100% CPU spikes which are lasting for long periods of time making the whole RD experience painful for the end users.  I've pinpointed the
    extra CPU usage to a specific program developed internally making changes to this program is not an option.
    My solution is to introduce a 2nd RDS server and load balance the users between them.  My original thought was to setup a Session Broker (VM) to handle the initial connection and then that would load balance between the two physical servers.
    Reading a bit more into it this is not looking like the way to go.  My best route would be to setup NLB on the two Sessions Hosts as the front end which are then connected to the Session Broker (VM).  This way after the initial connection the Sessions
    Hosts should check with the Session Broker for existing connections before deciding which physical server the end users end up on.
    Am I at least heading in the right direction with this setup or should I do it another way?  I also need to setup Web Access , can this be loaded on the Session Broker or do I need to do it on the physical Session Hosts and mirror the setup between
    the two?  And the same for the RD Gateway or can I do this on the Session Broker as well?
    Thanks for any advice given.

    Hi,
    Thank you for posting in Windows Server Forum.
    As you have commented that you are planning to load balance the RDSH server with RDCB, you can do the required steps for your environment. For this you need to check the following steps.
    - Install the RD Connection Broker role service on the server that you want to use to track user sessions for a farm.
    - Add the RD Session Host servers in the farm to the Session Broker Computers local group on the RD Connection Broker server.
    - Configure the RD Session Host servers in the farm to join a farm in RD Connection Broker, and to participate in RD Connection Broker Load Balancing.
    - Configure DNS round robin entries for RD Session Host servers in the farm.
    More information:
    Checklist: Create a Load-Balanced RD Session Host Server Farm by Using RD Connection Broker
    For more information, you can go through following links.
    1. Remote Desktop Server farms explained (Part 1)
    2. Building a 2008 R2 RDS Load Balanced Farm with RD Connection Broker
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Load Balancing Issues SOMEBODY HELP ME!!

    Good Morning.
    A few days ago we implemented Load Balancing in our company, I printed a step by step procedure from MS and just follow it thinking that once I did that everything was going to be ok, but I am some issues that I managed to fix, but now I am stock in one
    that I just can't figure it out, here I go.
    When regular users try to connect to the Farm using the external IP they can't connect, we checked firewall seems to be ok, we check the configuration we did and we didn't miss any step, NOW here is the crazy part, when we use our Admin ID we can connect,
    so I thought maybe is an Active Directory thing, but I don't know where to look or what to do so my questions are,
    Can this be a licensing issue?
    Do I have to have my TSBroker as part of my group of PC in the firewall?
    Can it be a certificate issue? (not too sure because I can connect as an admin)
    Can it be permissions to log in to the servers?
    My co-worked is telling me now that if TS Broker sent them to TS1 they can connect but if TSBroker send them to the other two members of the farms they can't connect, TS1 is the original TS before this whole Load Balancing thing.
    we tried so many solutions that we can find online and come up with and nothing seems to be working, so what do I do? What did I do wrong when I configure the Load balancing? is there any step beside what MS told me that I am missing...
    PLEASE HELP!!
    Thank you..

    Hi Rodrigo,
    Thank you for posting in Windows Server Forum.
    What’s your server OS in your environment?
    Firstly see that, if you have not set up RD Licensing server and don’t have RDS CAL then your administrator can only get access for RDP connection (only 2 connection for Admin purpose). Now if you want more than 2 connection you need to setup RD Licensing server,
    activate it, purchase RDS CAL and install it. After installing, you need to see that your user have enough permission to access RDS server and your user must be added under “Remote Desktop User” local group under RDS Server. 
    As you have commented that your admin can able to connect so I think you must have the issue with user permission, please go through above points and check the result.
    Please check below article for more details.
    1. TS Session Broker Load Balancing Step-by-Step Guide (Server 2008)
    2. Checklist: Create a Load-Balanced RD Session Host Server Farm by Using RD Connection Broker (Server 2008 R2)
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Bind Load balancing problem..expert help required

    Hi there.
    My RV042 has 2 WAN connections. One is connected to a Public Internet (WAN1) and the DMZ/Internet to my VPN router (WAN2)
    Behind the VPN router connected t my WAN2 is  the finance servers at network 10.36.88.0
    Both users local and those who connects using PPTP VPN clients can access resources in the LAN
    My problem is that due the round robin of load balancing sometimes they cannot reach the finance server
    I tried playing bind the HTTP port and creating some rules with no luck
    We want our users to use the WAN1 for all the web pages except those behind the VPN
    Is there a way i can make that if my users access my finance server they go trough the WAN2?
    Could you please provide me some guidance? (Rules, binds. etc)
    in thi case woul be
    An access rule or bind that all the WEB traffic for 10.36.88.0 flows to WAN2.

    If you type "show real" you will probably see the column for "Data In" rising. This column is all the way on the right side of the display. This indicates that the server has received requests that it has not responded to.
    By default, the LD does not use the Data value to fail a server. So by default, the data threshold for all the real servers is "0". If you set it to a non-zero number, the LD will start to use it.
    http://www/univercd/cc/td/doc/product/iaabu/localdir/ldv42/421guide/42ch05.htm#xtocid856528
    localdirector(config)# data 192.168.1.1:0:0:tcp 30
    Hope this helps,
    Steve Hall
    Cisco TAC

  • Help: AM Agent working with load balancing AM Server

    Hi,
    We are trying to set up the policy agent to work with two AM Servers behind a load balancer.
    The agent deployment document said that in the AMAgent.properties we must set
    com.sun.am.loadBalancer_enable=true
    According to the AM deployment guide(http://docs.sun.com/source/817-7644/appE_loadbalancerconfig.html),
    we also set in the AMConfig.properties something like
    com.iplanet.am.lbcookie.name=server1
    com.iplanet.am.lbcookie.value=server1
    The loading balancing just does not work. Can anyone explain how AM agent works under such an deployment
    environment? Some people say the agent can find the real server using the naming service, but the not
    much explanation can be found.
    More info on our two machines:
    The two AM servers are named server1.domain and server2.domain. The virtual LB name is server.domain.
    The two AM servers were installed using the host name server.domain. We added the servers' real name
    in the AM's fqdnMap. At the agent config file, the name service is pointing to the LB.
    Really appreciated any advices.
    Regards,
    Henry

    Thanks for your reply.
    We figured it out lately thanks to help from Bernhard.
    1) use each machine's name to install the AM servers using the same LDAP server.
    2) In AmAgent.propeties, set com.sun.am.loadBalancer_enable=true
    3) In AM server platform, add in all machine's names
    4) In Organization alias, add in two machines' name
    5) In fqdnMap, add in load balancer's name
    6) In LB, set cookie stickiness based on cookie JSESSIONID

  • Need help with ACE Load Balancing Base on URL pattern

    This is the first time for me trying to configure something like this on the ACE load balancer.  I need help configuring a load balancing policy base on URL pattern.  URL https://ineedhelp.com base on /willuhelpme and /imlost
    Key: ineedhelp_key
    cert:  ineedhelp_cert
    serverfarmA
    serverA 10.1.1.1 443
    serverfarmB
    serverB 10.1.1.2 443
    ineedhelp.com/willuhelpme-------serverfarmA
    ineedhelp.ocm/imlost---------------serverfarmB

    This is the first time for me trying to configure something like this on the ACE load balancer.  I need help configuring a load balancing policy base on URL pattern.  URL https://ineedhelp.com base on /willuhelpme and /imlost
    Key: ineedhelp_key
    cert:  ineedhelp_cert
    serverfarmA
    serverA 10.1.1.1 443
    serverfarmB
    serverB 10.1.1.2 443
    ineedhelp.com/willuhelpme-------serverfarmA
    ineedhelp.ocm/imlost---------------serverfarmB

  • Need help with load balancing and DNS proxy

    Hi,
    I need help on how to configure my router so it will work with my DNS proxy and load balancing.
    I have a Linksys LRT224 router. I have two broadband connections from two separate ISPs,500Mbps each (WAN1 & WAN2). WAN1 has a static IP and WAN2 is dynamic assigned. I use Unlocator (www.unlocator.com) so I can access geographically restricted sites (Pandora, Netflix, etc.).
    The problem I have is that unlocator registers only one IP address (WAN1 address) and since I am doing load balancing I have no way of knowing if the DNS request will go through the registered IP (WAN1) or through the other (WAN2). I am not an expert in routing or networking but I'm guessing I have a way of configuring the router so all the DNS requests go out through WAN1, right?
    In the router's Dual WAN config page there is a section for Protocol Binding. I tried to configure but only managed to screw up the internet at home. I used:
    DNS[UDP/53-53]->192.168.1.1-192.168.1.254(0.0.0.0-0.0.0.0)WAN2
    Any help or suggestions are appreciated.
    Alex

    Good solution though. That's probably the only way you could do true Load Balancing anyway.
    Please remember to Kudo those that help you.
    Linksys
    Communities Technical Support

  • Need help with load balancing and DNS proxy -Repost

    Hi,
    I need help on how to configure my router so it will work with my DNS proxy and load balancing.
    I have a Linksys LRT224 router. I have two broadband connections from two separate ISPs,500Mbps each (WAN1 & WAN2). WAN1 has a static IP and WAN2 is dynamic assigned. I use Unlocator (www.unlocator.com) so I can access geographically restricted sites (Pandora, Netflix, etc.).
    The problem I have is that unlocator registers only one IP address (WAN1 address) and since I am doing load balancing I have no way of knowing if the DNS request will go through the registered IP (WAN1) or through the other (WAN2). I am not an expert in routing or networking but I'm guessing I have a way of configuring the router so all the DNS requests go out through WAN1, right?
    In the router's Dual WAN config page there is a section for Protocol Binding. I tried to configure but only managed to screw up the internet at home. I used:
    DNS[UDP/53-53]->192.168.1.1-192.168.1.254(0.0.0.0-​0.0.0.0)WAN2
    Any help or suggestions are appreciated.
    Alex

    Good solution though. That's probably the only way you could do true Load Balancing anyway.
    Please remember to Kudo those that help you.
    Linksys
    Communities Technical Support

  • Help: newbie of iplanet clustering & loading balancing

    As l went through the sample app, "bank" coming along with iplanet. l have a few questions in mind. It is highly appreciated somebody can give a helping hand to me by answering below questions
    1) In ias-web.xml and web.xml, the app is set as "distributable" and session is synchronized by "dsync". Also, all servlets are set "sticky". My question is why the JSP don't need to be set as "sticky". If l have a web site made up of serveral ten of thousand of JSP pages, it will be a big trouble
    2) Let's say, if the sample include a stateful session bean, do l have to set that stateful session bean to "sticky". If so,
    does it mean the invocation from servlet to stateful session bean will take place in same JVM process.
    3) Is there any latency if session is synchronized by "dsync" process. If the application is set as "distributable" (support load-balancing), but the servlet is NOT set as sticky. Will it cause any trouble due to latency of synchronization of session among iplanet server
    regards
    Danny

    Hi
    Firstly, Thanks for your reply. it would very thankful if you can provide me more detailed information on below questions
    1) As a stateful session bean is set sticky. Does it mean all requests from same session will be directed from web-tier to the same jvm initializing that stateful session bean. Also, all invocation to entity bean/other sesson beans from that sticky stateful session bean will take place within same jvm as this stateful session bean is, am l correct ?
    2) Is there a latency for "dsync" to do replication of state of HTTPsession and stateful session bean ? If so, there is chance that state of HTTPSession / stateful session bean will be lost if the crash of jvm happen in-between the replication, am l correct ? Is there any way to avoid it ?
    regards
    Danny

  • Re : Help!! Load Balancing feature of Net8

    Hi,
    Not too sure if this is the right place to ask this question. Please kindly bear with me if its not.
    The Net8 documentation stated that its client load balancing uses a random algorithm. Does anybody have info on the randomness and performance of this algo? What kinda of distribution does the random number generator follows and does it still performs well under extreme light/heavy load?
    Any input or feedback from the experts there are greatly appreciated!
    Thanks a miilion!
    Sincerely,
    WT

    Hi Pradeep,
    SAP Web Dispatcher  uses the weighted round robin method for load distribution. This means that the request will automatically go to the instance that has the most free  resources. So, if your app server 3 has the most free resources then the user requests will go to this app server. this is normally, the good way to go to avoid stress for a app server if resources are free on another instance in the cluster?
    you can try the simple round robin method(as hinted by the below post) , but I am not sure, if this means it will be according to server nodes and how it will be based on CPU resources. One way you can do this is to add more server nodes in the higher capacity app server.
    Take a look at SAP Help document site . Also, maybe you can think of a hardware load balancer, which can implement this feature.
    cheers,
    Shantanu

  • Help! Azure Cloud Services and Virtual Machine Web Servers Load Balancing

    I have a cloud service. I have two virtual machines setup as web servers each with IIS installed. I have configured my domain registrar to point my domain name to the cloud service IP address. I also went into the endpoints of each virtual machine and verified
    that I have http port 80 setup on both in a load balanced set. 
    I am unable to access websites on either server at this point. DNS propogation site shows "error: token mismatch"...this has been setup since yesterday and still error.
    Can anyone assist me in where I went wrong? Am I confused to how the cloud service should work? I am assuming it will allow me to load balance the two virtual machines in the way I have configured above. Please help!!!!

    Hi,
    Thank you for posting in here.
    We are checking on this issue and will get back at earliest.
    Regards,
    Manu Rekhar

Maybe you are looking for

  • No longer able to pin web pages to firefox in taskbar

    I used to be able to pin pages into the taskbar icon but nothing sticks any more. Used to be that one could grab the icon of a webpage in the address bar onto the firefox icon on the taskbar.

  • Purging application logs automatically in Hyperion 9.3.1 products

    Hi, I am trying to explore purging options in Weblogic server. Could someone help me in finding a setting(if there is one) under Weblogic properties files, which will purge Application logs automatically after 'n' number of days. for example in D:\Hy

  • Line-in Jack

    I have been using an amplified "line-in" mic headset for weeks on my G4 iMac. I use it for both gaming and speech commands. I have always used the escape key as my push-to-talk key. Today I could not get the computer to register the mic. No matter wh

  • Dynamic Time Series in Essbase

    Hello All, I am new to Hyperion planning and Essbase development. I would like to implement Dynamic Time Series in Essbase. I could not find any materials where I can understand the concepts of DTS. So I know I have an Essbase application created in

  • PO account assignment

    Hi guys, Can we restrict a particular type of PO document type to only one particular account assignment category?  Our requirement is that, for one particular type of PO, it should allow only account assignment "K".  Other options should not be allo