netcat replacement Ncat time unit

English
,

Hi,

It’s common to use netcat utility to work with SSH ProxyCommand, which allows to use a bridge server, very useful when you need to connect directly to a host behind a firewall. Example:

1
2
3
4
5
6
7
# File: ~/.ssh/config

Host workbox
  HostName 192.168.1.92 # The ip address that the bridge server can see
  User anotherusername
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand ssh myusername@firewall.company.com nc -w 120 %h %p

I was using netcat until a couple of days, and works very smooth. Then I’ve setup a new server on another private network, behind a CentOS 7 firewall, and when I’ve tried the configuration above, I got this:

1
Ncat: Since April 2010, the default unit for -w is seconds, so your time of "120" is 2.0 minutes. Use "120ms" for 120 milliseconds. QUITTING.

I didn’t know, but I’m using Ncat instead of the old Netcat. I got not time to learn the differences, but I already found one. Every parameter that receives a time needs the unit. From ncat --help:

1
2
3
4
5
6
$ nc --help
Ncat 6.40 ( http://nmap.org/ncat )
Usage: ncat [options] [hostname] [port]

Options taking a time assume seconds. Append 'ms' for milliseconds,
's' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).

Then, in my SSH configuration I had to change the -w param to add the time unit (ms, s, m, h, etc):

1
  ProxyCommand ssh myusername@firewall.company.com nc -w 120m %h %p

Bye.