Aliasing the network interface card or loopback device

About this task

The cluster address should not be aliased to the loopback interface if the server is defined for NAT (Network Address Translation) forwarding.

To alias the loopback device on servers that are being load-balanced, you must use the operating system's adapter configure commands. For the load-balanced server machines to work, you must set, or preferably alias, the loopback device, which is often called lo0, to the cluster address. By setting or aliasing the loopback device to the cluster address, the load balanced server machines will accept a packet that was addressed to the cluster address.

If you have an operating system that supports network interface aliasing (such as AIX, HP-UX, Linux, Solaris, or Windows systems), you should alias the loopback device to the cluster address. The benefit of using an operating system that supports aliases is that you have the ability to configure the load-balanced server machines to serve multiple cluster addresses.
[Linux]Note: See Configuring loopbacks with alternative methods. If you have a server with an operating system that does not support aliases you must set the loopback device to the cluster address.

Procedure

  • [AIX] Use the following commands to alias the network interface and the loopback device (interface_name) for AIX systems :
    • For IPv4 addresses:
      ifconfig lo0 alias cluster_address netmask 255.255.255.255
    • For IPv6 addresses:
      ifconfig interface_name inet6 cluster_address/prefix_length alias
      For example, to alias the loopback device on servers that are being load-balanced:
      ifconfig lo0 inet6 2002:4a::541:56/128 alias
  • [HP-UX] Use these commands to alias the network interface and the loopback device (interface_name) for HP-UX systems:
    • For IPv4 addresses:
      ifconfig lo0:1 cluster_address up
    • For IPv6 addresses:
      ifconfig interface_name:alias inet6 cluster_address up prefix prefix_length
      For example, to alias the loopback device on servers that are being load-balanced:
      ifconfig lo0:1 inet6 3ffe:34::24:45 up prefix 128
    Avoid trouble: When using bind-specific server applications that bind to a list of IP addresses that do not contain the server's IP, use the arp publish command instead of ifconfig to dynamically set an IP address on the Load Balancer machine. For example:
    arp -s <cluster> <Load Balancer's MAC address> pub
  • [Linux] Use these commands to alias the network interface and the loopback device (interface_name) for Linux systems:
    • For IPv6 or IPv4 addresses:
      ip -version addr add cluster_address/prefix_length dev lo
      For example, to alias the loopback device on servers that are being load-balanced:
      ip -6 addr add 3ffe:34::24:45/128 dev lo
      ip -4 addr add 12.42.38.125/32 dev lo
      Note: You can also use the ifconfig command. See the following example to alias the loopback device using the ifconfig command. Once you issue one of the configuration commands on your machine, it is important to consistently use the same configuration command (ip or ifconfig), or unexpected results can occur.
    • Using the ifconfig command:
      ifconfig lo:1 cluster_address netmask 255.255.255.255 up
  • [Solaris] Use the following commands to alias the network interface and the loopback device (interface_name) for Solaris systems.
    • For IPv4 addresses:
      ifconfig lo0:1 plumb cluster_address netmask netmask up
    • For IPv6 addresses:
      ifconfig interface_name inet6 addif cluster_address/prefix_length up
      For example, to alias the loopback device on servers that are being load-balanced:
       ifconfig lo0 inet6 addif 3ffe:34::24:45/128 up
    Avoid trouble: When using bind-specific server applications that bind to a list of IP addresses that do not contain the server's IP, use the arp publish command instead of ifconfig to dynamically set an IP address on the Load Balancer machine. For example:
    arp -s <cluster> <Load Balancer's MAC address> pub
  • [Windows] Use these commands to alias the network interface and the loopback device for Windows operating systems.
    1. Use the ipconfig /all command to determine the interface name for the loopback device.

      This command locates the connection with a description of the Microsoft Loopback Adapter. The following example is the output from the ipconfig /all command, where the Microsoft Loopback Adapter is Ethernet adapter Local Area Connection 2, so the connection is Local Area Connection 2:

      Windows IP Configuration
      
       Host Name . . . . . . . . . . . . : ndserv10
       Primary Dns Suffix . . . . . . .  : rtp.raleigh.ibm.com
       Node Type . . . . . . . . . . . . : Unknown
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
       DNS Suffix Search List. . . . . . : rtp.raleigh.ibm.com
      
      Ethernet adapter Local Area Connection 2:
      
       Connection-specific DNS Suffix . :
       Description . . . . . . . . . . . : Microsoft Loopback Adapter
       Physical Address. . . . . . . . . : 02-00-4C-4F-4F-50
       DHCP Enabled. . . . . . . . . . . : No
       IP Address. . . . . . . . . . . . : 9.42.92.158
       Subnet Mask . . . . . . . . . . . : 255.255.255.255
       IP Address. . . . . . . . . . . . : 9.42.92.159
       Subnet Mask . . . . . . . . . . . : 255.255.255.255
       IP Address. . . . . . . . . . . . : 2002:92a:8f7a:162:9:42:92:160
       IP Address. . . . . . . . . . . . : 2002:92a:8f7a:162:9:42:92:159
       IP Address. . . . . . . . . . . . : fe80::4cff:fe4f:4f50%4
       Default Gateway . . . . . . . . . :
       DNS Servers . . . . . . . . . . . : 127.0.0.1
                                           fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
      
      Note: If the loopback interface is not shown in the ipconfig output, it might need to be installed. For basic loopback installation instructions, see the Microsoft documentation on how to Install a Microsoft loop adapter. Consult Microsoft documentation for detailed instructions for specific operation system levels.
    2. Add the cluster address to the loopback using the netsh command.

      For example:

      netsh interface ipv4 add address "Local Area Connection 2" address=9.42.92.160 mask=255.255.255.255 store=persistent
      netsh interface ipv6 add address "Local Area Connection 2" 2002:92a:8f7a:162:9:42:92:161/128 store=persistent
      Note: If ipv6 is not enabled, an error that indicates Element not found is displayed when netsh interface ipv6 commands are issued.
    3. Issue the following ipconfig /all command again, and you should see the address added on the loopback adapter.

      For example, issue the following command:

      ipconfig /all
      You should see output that is similar to the following:
      Ethernet adapter Local Area Connection 2:
      
       Connection-specific DNS Suffix . :
       Description . . . . . . . . . . . : Microsoft Loopback Adapter
       Physical Address. . . . . . . . . : 02-00-4C-4F-4F-50
       DHCP Enabled. . . . . . . . . . . : No
       IP Address. . . . . . . . . . . . : 9.42.92.158
       Subnet Mask . . . . . . . . . . . : 255.255.255.255
       IP Address. . . . . . . . . . . . : 9.42.92.160
       Subnet Mask . . . . . . . . . . . : 255.255.255.255
       IP Address. . . . . . . . . . . . : 2002:92a:8f7a:162:9:42:92:161 
       IP Address. . . . . . . . . . . . : 2002:92a:8f7a:162:9:42:92:160
       IP Address. . . . . . . . . . . . : 2002:92a:8f7a:162:9:42:92:159
       IP Address. . . . . . . . . . . . : fe80::4cff:fe4f:4f50%4
       Default Gateway . . . . . . . . . :
       DNS Servers . . . . . . . . . . . : 127.0.0.1
                                           fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
    4. Enable forwarding, weakhostreceive, and weakhostsend options for all the ethernet interfaces in the machine.

      Any interfaces listed with a name of Local Area Connection must have IP forwarding enabled. For example:

      netsh interface ipv6 set interface "Local Area Connection" forwarding=enabled weakhostsend=enabled weakhostreceive=enabled store=persistent
      netsh interface ipv6 set interface "Local Area Connection 2" forwarding=enabled weakhostsend=enabled weakhostreceive=enabled store=persistent
      netsh interface ipv4 set interface "Local Area Connection" forwarding=enabled weakhostsend=enabled weakhostreceive=enabled store=persistent
      netsh interface ipv4 set interface "Local Area Connection 2" forwarding=enabled weakhostsend=enabled weakhostreceive=enabled store=persistent
    5. Verify that the settings for each Local Area Connection. Use the following commands:
      netsh interface ipv4 show interface "Local Area Connection"
      netsh interface ipv4 show interface "Local Area Connection 2"
      netsh interface ipv6 show interface "Local Area Connection"
      netsh interface ipv6 show interface "Local Area Connection 2"