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) in linux/AIX, for windows you can find in the C:\ProgramData\IBM\DB2\DB2COPY1\DB2\cfg directory. 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
- For each Db2 member that is intended to service remote client or driver traffic, ensure that there is at least one NIC that can be used for client/server traffic on the host where the Db2 member resides.
- For a single-member Db2 instance, you can specify at most one IP address or host name that represents one or more NICs. If the member ID is 0, you can specify the IP address or host name without the member ID, because the member ID defaults to 0 in this case.
- For a multi-member Db2 instance, you can specify at most one IP address or host name that represents one or more NICs for each member.
Procedure
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).
You can use the static IP address 9.2.5.6 in place of host77e3 for member 6.0 host67m1 3 host68m1 6 host77e3
- 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).
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.0 9.2.3.3 1 host68e2 2 host77e1
What to do next
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).