Updating hosts and services files for TCP/IP connections

This task explains when and how to update the hosts file and services file on the client with communication parameter values for the remote database server. This task is optional for connections using TCP/IP and does not apply to connections using Named Pipes. This task is part of the larger task of configuring client-to-server connection using the CLP.

About this task

You need to update the hosts file if you want to establish a connection to the remote database server using its hostname and your network does not contain a DNS (domain name server) that can be used to resolve that hostname to an IP address. This step is not required if you want to refer to the remote database server using its IP address.

You need to update the services file if you want to specify a connection service name when establishing a connection to the remote database server. A connection service is an arbitrary name that represents the connection port number. This step is not required if you want to refer to the remote database server's port number.

Procedure

  • To update the hosts file on the client to resolve the remote server's hostname to its IP address:
    1. Use a text editor to add an entry to the hosts file for the server's IP address.
      For example:
      9.26.13.107                            myserver   # IPv4 address for myserver
      2002:91a:519:13:210:83ff:feff:ca71     myserver   # IPv6 address for myserver
      where:
      9.26.13.107
      represents the IPv4 ip_address
      2002:91a:519:13:210:83ff:feff:ca71
      represents the IPv6 ip_address
      myserver
      represents the hostname
      #
      represents a comment describing the entry
      Note: Note that IPv6 entries are not needed if your host does not belong on an IPv6 network. For hosts in mixed IPv4 and IPv6 networks, an alternate method is to assign different host names for IPv4 and IPv6 addresses. For example:
      9.26.13.107                        myserver    	# IPv4 address for myserver
      9.26.13.107                        myserveripv4 # IPv4 address for myserver
      2002:91a:519:13:210:83ff:feff:ca71	myserveripv6	# IPv6 address for myserver
      

      If the server is not in the same domain as the IBM® data server client, you must provide a fully qualified domain name such as myserver.spifnet.ibm.com, where spifnet.ibm.com represents the domain name.

  • To update the services file on the client to resolve a service name to the remote server's port number:
    1. Using a text editor, add the Connection Service name and port number to the services file.
      For example:
      server1  50000/tcp  # Db2 connection service port
      where:
      server1
      represents the Connection Service name
      50000
      represents the connection port number (50000 is the default)
      tcp
      represents the communication protocol that you are using
      #
      represents the beginning of a comment that describes the entry

Example

The following table lists the location of the hosts file and services file referred to in the preceding procedures.

Table 1. Location of the hosts file and services file
Operating System Directory
Windows Server 2003 %SystemRoot%\system32\drivers\etc where %SystemRoot% is an environment variable defined on the system.
Linux® or UNIX /etc