Configuring an Oracle® Solaris 11.2 System as a Router or a Load Balancer

Exit Print View

Updated: September 2014
 
 

Defining Server Groups and Back-End Servers in ILB

This section describes how to create an ILB server group and add back-end servers to the server group. When a server is added by using either the create-servergroup or the add-server subcommands, server IDs are generated by the system. The server IDs are unique within the server group. For information about the ilbadm subcommands, see the ilbadm (1M) man page.

Creating an ILB Server Group

To create an ILB server group, first identify the servers that are to be included in the server group. Servers can be specified by their host name or IP addresses and optional ports. Then as an administrator, run the following command:

# ilbadm create-servergroup -s servers=server1,server2,server3 servergroup 

Unique server IDs prefixed with a leading underscore (_) are generated for each server added.


Note -  A server can have multiple server IDs if it belongs to multiple server groups.

Adding Back-End Servers to an ILB Sever Group

To add a back-end server to a server group, become an administrator and run the following command:

# ilbadm add-server -s server=server1[,server2...] servergroup

Server specifications must include a host name or IP address and can also include an optional port or a range of ports. Server entries with the same IP address are disallowed within a server group. Unique server IDs prefixed with a leading underscore (_) are generated for each server added.


Note -  IPv6 addresses must be enclosed in square brackets.
Example 6-1  Creating an ILB Server Group and Adding Back-End Servers

The following example creates a server group called webgroup with three back-end servers.

# ilbadm create-servergroup -s \
servers=192.168.89.11,192.168.89.12,192.168.89.13 webgroup
# ilbadm show-servergroup
SGNAME         SERVERID            MINPORT MAXPORT IP_ADDRESS
webgroup       _webgroup.0         --      --      192.168.89.11
webgroup       _webgroup.1         --      --      192.168.89.12
webgroup       _webgroup.2         --      --      192.168.89.13

The following example creates a server group called webgroup1 and adds three back-end servers to the server group.

# ilbadm create-servergroup webgroup1
# ilbadm add-server -s server=[2001:0db8:7::feed:6]:8080,\
[2001:0db8:7::feed:7]:8080,[2001:0db8:7::feed:8]:8080 webgroup1

Enabling or Disabling a Back-End Server in an ILB Server Group

First identify the IP address, host name, or server ID of the back-end server you want to re-enable or disable. You must associate the server group with a rule before the servers in the server group can be enabled or disabled.

A server can have multiple server IDs if it belongs to multiple server groups. You must specify a server ID to re-enable or disable the server for the specific rules that are associated with the server ID.

  • To disable an enabled server, type the following command:

    # ilbadm disable-server server1

    The selected server, which is enabled, is disabled. The kernel does not forward traffic to this server.

  • To re-enable the disabled server, type the following command:

    # ilbadm enable-server server1

    The selected server, which is disabled, is re-enabled.

  • To display the state of the server, type the following command:

    # ilbadm show-server [[-p] -o field[,field...]] [rulename]

    Note -  A server displays the state as enabled or disabled only when the server group that the server belongs to is associated with a rule.
Example 6-2  Disabling and Re-enabling a Back-End Server in an ILB Server Group

In the following example, a server with server ID _websg.1 is disabled and then re-enabled.

# ilbadm enable-server _websg.1
# ilbadm disable-server _websg.1

Deleting a Back-End Server From an ILB Server Group

You remove a back-end server from one ILB server group or from all server groups by using the ilbadm remove-server command. First, Identify the server ID of the server that you want to remove from a server group.

ilbadm show-servergroup -o all

The server ID is a unique name for the IP address that is assigned to a system when the server is added to a server group.

Then, delete the server.

# ilbadm remove-server -s server=server-ID server-group

If the server is being used by a NAT or half-NAT rule, disable the server by using the disable-server subcommand before removal. For more information, see Enabling or Disabling a Back-End Server in an ILB Server Group. When a server is disabled, it enters the connection-draining state. Periodically check the NAT table by using the ilbadm show-nat command to see whether the server still has connections. After all the connections are drained (the server is not displayed in the show-nat command output), you can remove the server by using the remove-server command.

If the conn-drain timeout value is set, the connection-draining state will be completed upon conclusion of the timeout period. The default value of conn-drain timeout is 0, which means that the connection-draining waits until a connection is gracefully shut down.

Example 6-3  Deleting a Back-End Server From an ILB Server Group

The following example removes the server with server ID _sg1.2 from server group sg1.

# ilbadm remove-server -s server=_sg1.2 sg1

Deleting ILB Server Groups

This section describes how to delete an ILB server group. You cannot delete a server group that is used by any active rule.

First, display all the available information about server groups.

# ilbadm show-servergroup -o all
sgname      serverID       minport     maxport     IP_address
specgroup   _specgroup.0   7001        7001        192.168.68.18
specgroup   _specgroup.1   7001        7001        192.168.68.19
test123     _test123.0     7002        7002        192.168.67.18
test123     _test123.1     7002        7002        192.168.67.19

Type the following command:

# ilbadm delete-servergroup servergroup

If the server group is in use by an active rule, the deletion fails.

The following example removes the server group called webgroup.

# ilbadm delete-servergroup webgroup