skip to Main Content

I want to build a TCP connection with my master and slave (Both CentOS 7). For example, my nodes’ IPs are IP1 and IP2. I can ping each other successfully. But I cannot establish the TCP connection. So I used ncat to test. What I did is as follows

[Node1] ncat -v -u IP2 Port2
Ncat: Connected to IP2:Port2

[Node2] ncat IP2 Port2
Ncat: No route to host

I have no idea whether my operation is correct to test TCP and UDP. If my operation is correct, why I cannot establish a TCP connection. Could you please tell me why?

Thanks.

2

Answers


  1. It seems IP2 drop SYN packet and return ICMP message to IP1 – you should configure firewall. Similar question – https://unix.stackexchange.com/questions/353452/no-route-to-host-with-nc-but-can-ping

    Login or Signup to reply.
  2. It is not clear that there is even a TCP listener on IP2 Port2 and that this listener is reachable from your machine (i.e. no firewalls restricting access). If no listener exists or the connection is somehow blocked, the initial TCP handshake will fail already, i.e. even before any data were sent.

    With UDP this is different: the initial “connect” does no communication to the target at all but just sets the target address on the local socket. If the connection works will only be seen later, i.e. if data sent from the client will actually arrive at the server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search