0

I'm trying to establish a simple TCP connection between two machines in the same subnet (wireless network). The tool used is netcat.

On machine A, I start a listener:

nc -l -p 4506

On machine B, I fire up the request:

nc -vv <machine_A_ip> 4506

While the output on machine A stays untouched, the output from netcat on machine B prints the following error:

<machine_A> [<machine_A_ip>] 4506 (?) : Connection refused
 sent 0, rcvd 0

Since machine B is headless, I have access only to tshark as a debugging tool. To debug this issue, I have tried to set the capture filter like this:

tshark -i wlan0 -f 'port 4506'

But tshark won't capture any packages. What am I missing? How do I properly debug the point of failure?

  • 1
    Ignoring tshark for the moment, two things to check: first, run netstat -an | grep 4506 on machine A to make sure netcat is actually listening on that port. Certain versions of netcat want the port to be an argument to the -l option. Second, look at the iptables/firewall configuration on machine A to make sure port 4506 is not blocked. – Jeremy Dover Jul 24 '16 at 22:13
  • @JeremyDover just checked that machine A is indeed listening in the 4506 port. Firewall is disabled in machine A. Gonna check machine B as well – ivarec Jul 24 '16 at 22:52
  • Glad you figured it out! – Jeremy Dover Jul 25 '16 at 0:46
0

I was making a basic and bizarre mistake: I was swapping the IP addresses of both machines, so I was listening on machine A and making a request from machine B to machine B. Since this was using B's lo interface, I couldn't capture the packages in the wlan0 interface.

Oops! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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