Load balancer configuration

This procedure outlines the steps to configure a load-balancer for an existing tenant in MidoNet. In the example, we will use:

  • VIP:
  • Pool Members:,

Let’s start by determining the list of routers we have available in our MidoNet deployment:

midonet> list router
router router0 name Edge Router state up
router router1 name Tenant Router state up infilter chain0 outfilter chain1

As you can see, your Tenant Router where you are going to create a load balancer is router1.


In MidoNet, routers have inbound and outbound filters. If the load balancer on a router balances traffic, these filters will be skipped. When using MidoNet with OpenStack, these filters usually only contain NAT rules that are irrelevant to load-balanced traffic, but this is worth taking into account if you are adding custom rules to the router’s filters.

  1. Create a load balancer and assign it to the Tenant Router.

    midonet> load-balancer create
    midonet> router router1 set load-balancer lb0

    The load balancer assigned to the router will act on traffic flowing through that router.

  2. Create a pool to which target back-end servers will be assigned.

    midonet> load-balancer lb0 create pool lb-method ROUND_ROBIN
    midonet> load-balancer lb0 pool pool0 show
    pool pool0 load-balancer lb0 lb-method ROUND_ROBIN state up
  3. Next, add target back-end servers to the pool you just created.

    midonet> load-balancer lb0 pool pool0 create member address protocol-port 80
    midonet> load-balancer lb0 pool pool0 create member address protocol-port 80
    midonet> load-balancer lb0 pool pool0 member pm0 show
    pm pm0 address protocol-port 80 weight 0 state up

    For each back-end server you must add its IP address and port to the pool.

  4. Create a virtual IP address (VIP) and port, then assign it to the pool against which load balancing will be performed (lb0:pool0). Typically, a VIP is an IP address from the public IP space.

    midonet> load-balancer lb0 pool pool0 list vip
    midonet> load-balancer lb0 pool pool0 create vip address persistence SOURCE_IP protocol-port 8080
    midonet> load-balancer lb0 pool pool0 vip vip0 show
    vip vip0 load-balancer lb0 address protocol-port 8080 persistence SOURCE_IP state up

    Above example uses sticky source IP address persistence, read more about it in the section called “Sticky Source IP”.

  5. Lastly, you must add a routing rule on the Edge Router (router0) so that a packet sent to the VIP is able to find its way to the Tenant Router where the LB is defined.

    1. First, identify the ports on the Edge Router, using the router router0 list port command, like so:

      midonet> router router0 list port
      port port0 device router0 state up mac 02:c2:0f:b0:f2:68 addresses
      port port1 device router0 state up mac 02:cb:3d:85:89:2a addresses
      port port2 device router0 state up mac 02:46:87:89:49:41 addresses peer bridge0:port0
      port port3 device router0 state up mac 02:6b:9f:0d:c4:a8 addresses peer router1:port0

      Identify the port on the Edge Router that is used to route traffic to the Tenant Router (router1). In this example, we see port3 on device router0 is peered to the Tenant Router port (router1:port0).

    2. Next, add the route to the Edge Router to send traffic to router0:port3 (local port on Edge Router).

      midonet> router router0 add route dst src type normal port router0:port3

      This rule matches any incoming traffic (src to the Edge Router that is sent to the VIP (dst and sends it out the desired Edge Router port (router0:port3).

To delete an existing load balancer, run the following command:

midonet> load-balancer list
lb lb0 state up
midonet> load-balancer lb0 delete
Questions? Discuss on Mailing Lists or Chat.
Found an error? Report a bug.

loading table of contents...