First of all, the fact that you cannot ping the server and nmap
doesn't see the open ports means your problem, at least at this point, lies outside DB2. Once you fix your network issues, here's the procedure you can follow to set up remote connectivity to a DB2 database via TCP/IP.
1) Optional. You can use either a service name or a port number to configure the DB2 instance. If you want to use the service name, on the server add a line to /etc/services
similar to db2c_db2inst1 50000/tcp
, which assigns the service name "db2c_db2inst1" to the port 50000.
2) On the server update the DB2 instance configuration: db2 update dbm cfg using svcename db2c_db2inst1
(or db2 update dbm cfg using svcename 50000
if not using the service name). To verify: db2 get dbm cfg | grep SVCENAME
.
3) On the server update the DB2 registry variable: db2set DB2COMM=TCPIP
. To verify: db2set DB2COMM
.
4) On the server restart the instance: issue db2stop force
, then db2start
.
5) On the remote client, assuming the DB2 client software is installed, issue db2 catalog tcpip node whatever remote <your server IP address> service <your DB2 port number>
. Note that the node name ("whatever" in this example) is limited to 8 ASCII characters.
6) On the remote client issue db2 catalog database <your database name> at node whatever
, referring to the node name ("whatever") that you defined in step 5.
7) On the remote client verify connectivity: db2 connect to <your database name> user <user name> using <password>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…