Category Archives: network

network load balancing with Solaris

I know that everybody forgot about this blog but I’ll try to liven it up.
Some days ago at Moscow OpenSolaris User Group meeting was 2 presentations about network. First one was about Crossbow and all around and second one was about network load balancing … with Linux and FreeBSD and nothing about Solaris.
So as nobody knew anything about network load balancing with Solaris i have decided to write about it.
There are some solutions for network balancing in FreeBSD and Linux and really nothing like this exists in Solaris 10.
Time stands still and Solaris 11 Express is already exists and OpenSolaris already doesn’t exists 🙂
It is in the OpenSolaris appeared support ILB ( Integrated Load Balancer ) and now it is included to Solaris 11 Express.
So let’s try to configure Solaris ILB.
First of all you need to check that ilb is installed and if no, install it.

root@solaris:~# pkg search ilbadm
basename   file   usr/sbin/ilbadm pkg:/service/network/load-balancer/ilb@0.5.11-
root@solaris:~# man pkg
root@solaris:~# pkg install pkg:/service/network/load-balancer/ilb@0.5.11-
               Packages to install:     1
           Create boot environment:    No
               Services to restart:     1
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  1/1       11/11      0.2/0.2

PHASE                                        ACTIONS
Install Phase                                  38/38 

PHASE                                          ITEMS
Package State Update Phase                       1/1 
Image State Update Phase                         2/2 

PHASE                                          ITEMS
Reading Existing Index                           8/8 
Indexing Packages                                1/1

Now ILB installed and we can configure load balancing.
First of all let’s start ilb daemon. But before this we ought to start ip forwarding. If you forget to do so ilbadm output would be really helpful.

root@solaris:~# ilbadm show-rule
ilbadm: socket() failed

So let’s start ip forwarding and ilb daemon.

 root@solaris:~# svcadm enable svc:/network/ipv4-forwarding
root@solaris:~# svcadm enable svc:/network/loadbalancer/ilb:default 

ILB supports 3 modes :
– Full NAT
– Half NAT

In the DSR ( Direct Server Return ) mode, ILB balances the incoming requests to the back-end servers, and letting the return traffic from the servers bypass the load balancer by being sent directly to the client.
NAT-based load balancing involves rewriting of IP header information,and handles both the request and the response traffic.
In Full NAT mode ILB involves rewriting of both source and destination IP fields, making it appear to the back-end servers that all connections are originating at the load balancer. Clients will also receive packets from preconfigured IP range.
In the half-NAT mode ILB rewrites only destination IP address.

I have used 3 servers to try ILB. Two of them i used as back-end servers. I have started nginx there. There IPs :, ILB was started at the third server with IP

First of all I’ve configured server group, which will process http traffic :

root@solaris:~# ilbadm create-servergroup -s servers=, websg
root@solaris:~# ilbadm show-servergroup
root@solaris:/tmp# ilbadm show-sg
websg          _websg.0            80      80
websg          _websg.1            80      80

And then I’ve configured balance rule. First of all let’s try full NAT.

root@solaris:/tmp# ilbadm create-rule -e -i vip=,port=80 -m lbalg=rr,type=NAT,proxy-src= -o servergroup=websg webrule
root@solaris:/tmp# ilbadm show-rule
webrule             E      roundrobin  NAT     TCP  80

And that’s all!
I have configured that http traffic to ( virtual IP ) will be load balanced across 2 servers using round robin algorithm. Clients will receive replies from IP
Let’s change ILB mode from full NAT to Half NAT.

ilbadm  delete-rule -a
ilbadm create-rule -e -i vip=,port=80 -m lbalg=rr,type=h -o servergroup=websg webrule
root@solaris:/tmp# ilbadm show-rule
webrule             E      roundrobin  HALF-NAT TCP  80

This is really easy to configure. Of course there are a lot of options. For example you can select load balancing algorithm Moreover, ILB offers an optional server monitoring feature that can provide server health checks. Another great options are : Session persistence and Connection draining
More details about the ILB can be read on wiki
I’m not really an expert in load balancers but ILB looks much more useful and functional than FreeBSD or Linux analogs.