DB2 10.5 for Linux, UNIX, and Windows

Specifying the NIC through which a DB2 member can acquire exclusive access to a port

You can specify one or more network interface cards (NICs) through which a DB2® member can acquire exclusive access to a specific port to service remote clients or drivers. You can specify a particular NIC by its IP address or by the host name that maps to that address in the nicbinding.cfg file.

Before you begin

Because fully qualified host names are derived from the host names or IP addresses that you specify for the NICs, ensure that the remote client or driver can use the specified values to uniquely identify the correct NICs. The remote client or driver must be able to resolve the fully qualified host names through the DNS or the /etc/hosts file.

A value from the nicbinding.cfg file can be returned by a member to the remote client or driver either as the specified IP address or as a fully qualified host name (regardless of whether an IP address or host name is specified), depending on the DB2 server configuration. By mapping the returned value to the correct location for the member, the remote client or driver can access the database.

About this task

When a DB2 member starts, it attempts to acquire exclusive access to a specific port on one or more NICs on the host where it resides. If a DB2 member is successful in gaining exclusive access to a specific port on all NICs on the host, any other DB2 instance on the same host must be configured to use a different port to service remote clients or drivers. Starting in Version 10.5 Fix Pack 5, you can specify one or more NICs through which a DB2 member can acquire exclusive access to a specific port, thereby avoiding contention for the same port number. You can enable this feature for a subset of DB2 members or all members in the instance.

You can specify a particular NIC by its IP address or by the host name that maps to that address in the nicbinding.cfg file, which you can find in the ~/sqllib/cfg directory (or the ~/sqllib_shared/cfg directory in DB2 pureScale® environments). To specify multiple NICs, use a multihomed host name that maps to the IP addresses for those NICs. A multihomed host is a host whose host name maps (through the DNS) to multiple NIC IP addresses.

If the specified port on a specified NIC is already owned by another DB2 instance, or the specified host name or IP address does not represent any valid NIC on the host, the pairing is considered invalid, and SQL5043N is returned when the DB2 member starts.

Restrictions

Procedure

Using a text editor, add binding information to the nicbinding.cfg file. Each line in the configuration file represents a binding between a single DB2 member and its NIC. In the following example, the configuration file defines bindings for all three members (0, 1, and 2) in a DB2 instance.
0 9.1.2.1
1 9.1.2.2
2 host1.newyork.mycompany.com
If a particular member has no entry in the file, that member is bound to all NICs on the host where it resides. In the following example, the configuration file defines bindings for three members (0, 1, and 3) in a four-member DB2 instance:
0 host1
1 host2.chicago.mycompany.com
3 9.1.2.4
Member 2 is not specified in the file, so it is bound to all NICs on the host where it resides.

Examples

Virtual IP (VIP) addresses
You can identify a NIC by using a virtual IP (VIP) address, or map a host name to the VIP. You can map a VIP to any NIC IP address on the host. If a network failure occurs, the VIP can map to an IP address for a different NIC on the same host or on a different host. In the following example, any one of three pairings can be used to bind this DB2 instance to the NIC:
0 9.2.3.2 -> static IP address of the NIC
0 9.2.3.9 -> virtual IP address (VIP) associated with another NIC on the same system
0 host3   -> network interface host name mapped to the VIP
Partitioned database instances
  • Members 0, 3, and 6 of a partitioned database instance reside on host67, host68, and host77. All three members have logical port number 0, which means that they can all be set up with a TCP/IP or SSL listener for handling remote client or driver traffic.
  • On host67, NIC4, NIC5, and NIC6 map to member 0. Host name host67m1 maps to the IP addresses for these three NICs.
  • On host68, NIC5 and NIC6 map to member 3. Host name host68m1 maps to the IP addresses for these two NICs.
  • On host77, NIC6 maps to member 6. Host name host77e3 maps to the IP address for NIC6 (9.2.5.6).
Because multiple NICs are being used by members 0 and 3 on host67 and host68 for remote client/server traffic, the binding of members to their NICs must be established by using multihomed host names, as shown in the following example:
0 host67m1
3 host68m1
6 host77e3
You can use the static IP address 9.2.5.6 in place of host77e3 for member 6.
DB2 pureScale instances
  • Members 0, 1, and 2 of a DB2 pureScale instance reside on host67, host68, and host77. All three members can be set up to handle remote client or driver traffic.
  • On host67, NIC3 maps to member 0. The IP address for NIC3 is 9.2.3.3.
  • On host68, the NIC is also named NIC3 and maps to member 1. Host name host68e2 maps to the IP address for NIC3 (9.2.4.3).
  • On host77, NIC2 maps to member 2. Host name host77e1 maps to the IP address for NIC2 (9.2.5.2).
The following example shows how to bind members 0, 1, and 2 of this DB2 pureScale instance to their NICs:
0 9.2.3.3
1 host68e2
2 host77e1
You can use the static IP address 9.2.4.3 in place of host68e2 for member 1, and the static IP address 9.2.5.2 in place of host77e1 for member 2.

What to do next

You can use the MON_GET_INSTANCE table function to retrieve NIC binding information for specific members. The following example query returns the DB2 member ID and host name or IP address that was specified in the nicbinding.cfg file:
db2
  "select MEMBER,
     substr(NETWORK_INTERFACE_BOUND,1,16)
       as NETWORK_INTERFACE_ID
     from table(MON_GET_INSTANCE(-2))"

MEMBER NETWORK_INTERFACE_ID
------ --------------------
     1 host67e1  
     0 9.2.3.3           

2 record(s) selected.
You can also use operating system commands to monitor NIC binding and port use. For more information, see Who's using my port? (AIX®, Linux, Windows example).