This section describes the steps for setting up ILB to use a half-NAT topology to load balance traffic among two servers. See the NAT topology implementation in ILB Operation Modes.
Become an administrator.
For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.3.
Set up the server group in ILB.
The two servers are 192.0.2.50 and 192.0.2.60. Create a server group srvgrp1, consisting of these two servers by typing the following command. For more information about setting up a server group in ILB, see Creating an ILB Server Group.
# ilbadm create-sg -s servers=192.0.2.50,192.0.2.60 srvgrp1
Set up the back-end servers.
The back-end servers are set up to use ILB as the default router in this scenario. Run the following command on both servers:
# route add -p default 192.0.2.33
After executing this command, start the server applications on both servers. Assume that it is a TCP application listening on port 5000. For more information on setting up back-end servers, see Adding Back-End Servers to an ILB Sever Group.
Set up a simple health check called hc-srvgrp1. Create the health check by typing the following command:
# ilbadm create-hc -h hc-test=tcp,hc-timeout=3,\ hc-count=3,hc-interval=60 hc-srvgrp1
A simple TCP level health check is used to detect if the server application is reachable. This check is done every 60 seconds. The health check tries at most three times and waits for at most 3 seconds between trials to see whether a server is healthy. If all three trials fail, it marks the server as dead. For more information about monitoring and creating health checks, see Monitoring Health Checks in ILB.
Set up an ILB rule by typing the following command:
# ilbadm create-rule -e -p -i vip=203.0.113.20,port=5000 -m \ lbalg=rr,type=half-nat,pmask=27 \ -h hc-name=hc-srvgrp1 -o servergroup=srvgrp1 rule1_rr
Persistence (with 32 bits mask) is used in this rule. The load balance algorithm is round robin. For information about different ILB algorithms, see ILB Algorithms. The server group srvgrp1 is used and the health check mechanism used is hc-srvgrp1. For more information about creating ILB rules, see Creating an ILB Rule.