1. I installed Db2 v11.5.7.0 on Linux/x86_64 inside my virtual PC using VirtualBox on Windows 10.
  2. I created database with name TEST1
  3. I connected to database using Unix socket: db2 connect to TEST1 and connection successfully completed.
  4. Check for DB2COMM setting: db2set DB2COMM and output is DB2COMM=TCPIP
  5. Just to make sure TCP/IP connection works to Db2 I created local node and catalog database:
db2 catalog tcpip node loctcp remote localhost server 50000
db2 catalog database test1 as tcptest1 at node loctcp
db2 terminate
db2 connect to tcptest1 user db2inst1 using <password>

and connection successfully completed.

  1. Now on my PC VirtualBox Windows 10 host I set port forwarding Host Port: 60127 and Guest Port: 50000.
  2. On my Windows PC: netstat -an -p tcp | find ":60127" I can see connection is in LISTENING state.
  3. On my Windows PC:
db2 catalog tcpip node remtcp remote localhost server 60127
db2 catalog database test1 as tcptest1 at node remtcp
db2 terminate
  1. On my Windows PC connect to database

db2 connect to tcptest1 user db2inst1 using <password>

PROBLEM: It looks like connection hangs. After few minutes I get error in Db2 client:

SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "". Communication function detecting the error: "recv". Protocol specific error code(s): "10054", "*", "0". SQLSTATE=08001

  1. Trying to understand the problem. On Linux server: a) I have checked for firewall and it is disabled. b) IPv6 is disabled c) Db2 is listening on 50000 port using IPv4
  2. Wireshark on Windows listening to 60127 port. a) TCP connection is established b) Db2 DRDA connection never appears.
  3. Tcpdump on Linux server capturing 50000 port network traffic. a) TCP connection is established b) Db2 DRDA connection never appears.

It appears something is wrong inside Linux virtual machine, but steps 4 and 5 everything should be fine with Db2 TCP/IP connection.

Any idea what else to check why Db2 client connection does not work?

P.S. I have exact same installation with Db2 v11.1 and Db2 connection from my PC is working fine.

  • How did you configure the VBox virtual network for the guest in question?
    – mustaccio
    Commented Apr 1, 2022 at 11:39
  • Guest is configured of using NAT network and Port Forwarding in it. I have two port forwardings SSH and Db2. Settings for SSH: HostPort: 60027 GuestPort: 22 and settings for Db2: HostPort: 60127 GuestPort:50000 and SSH connection works fine, but for some reason Db2 connection doesn't.
    – folow
    Commented Apr 1, 2022 at 11:41
  • I'd avoid using localhost as the target on the host side; use the actual host name or IP address.
    – mustaccio
    Commented Apr 1, 2022 at 11:48
  • I have now changed for step 8 instead of localhost I have changed to my Windows IP address and the problem is the same. By the way I have been using localhost for years without a problem.
    – folow
    Commented Apr 1, 2022 at 13:10
  • @follow Add an IP trace inside the linux container, and test if anything is coming through from the Win10 host on connect. If no TCP traffic is coming though from the host into the container, your problem lies in the virtual-box config or port-forwarding (assuming you've configured Win10 to allow TCP inbound/outbound traffic on the relevant port). On the other hand, if TCP traffic is detected inside the container coming from the host when the host attempts to connect to the database, then your problem lies inside the container, so check db2diag.log (if necessary with DIAGLEVEL 4).
    – mao
    Commented Apr 2, 2022 at 16:17

1 Answer 1


I have solved the problem. It was firewall problem.

My assumption on step 10 was wrong. I only checked the iptables rules:

sudo iptables -nvL

which having ALLOWED for all of the policies, so I assumed firewall is disabled (or has no effect).

But there was another firewall firewalld service enabled and running:

sudo systemctl status firewalld

I have stopped and disabled it:

sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl mask firewalld

Or instead of above three commands I could add firewall exception to allow 50000 port of my Db2 service:

firewall-cmd --add-port=50000/tcp

Note: My steps 11 and 12 were wrong assumption. I have analyzed network packets in more detail. I see only TCP SYN packet was received from Db2 Windows client and there was no TCP SYN/ACK response from Db2 server machine back to client. There was no TCP connection established (because it was blocked by firewall), obviously there could not be any DRDA protocol established, because of dependency on TCP connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.