-2

I'm having trouble using my nc command. Everytime I enter any parameter, even using -h, linux just prints:

*BusyBox v1.20.2 (2014-05-14 13:19:21 EDT) multi-call binary.

Usage: nc [IPADDR PORT]*

I am able to type nc localhost 22 which produces

*SSH-2.0-OpenSSH_6.6*

Not to sure what's going on...

Jakuje
  • 9,715
  • 2
  • 42
  • 45
sphchow
  • 101
  • 5
  • 1
    It seems to be working. What is the problem you are having? – Michael Hampton Oct 26 '15 at 19:04
  • What do you expect it should output? – Jakuje Oct 26 '15 at 19:16
  • I want to be able to use options such as -l listen and -D for debug etc... But everytime i feed in a option it won't allow it. Because it says Usage: nc [IPADDR PORT] I essentially want to be able to use parameters with nc. Do I have to install additional packages? or change a configuration file for this? – sphchow Oct 26 '15 at 19:17
  • I'm trying to set up udp in a ssh tunnel using this tutorial: [link](http://zarb.org/~gc/html/udp-in-ssh-tunneling.html) At one point i need to use the nc command in such a way as: local# sudo nc -l -u -p 53 < /tmp/fifo | nc localhost 6667 > /tmp/fifo but my nc doesn't allow parameters... – sphchow Oct 26 '15 at 19:18

2 Answers2

2

You are most likely working on an embedded system where many tools are only available in a limited form in the form of busybox. This tool collection only offer the most essential features, and it's entirely possible the nc features you want are not available.

Modern OpenSSH versions don't need nc for a tunnel. Look into the -W parameter.

Adapted from my ~/.ssh/config files:

Host  *.example.com !gateway.example.com
   ProxyCommand ssh -q -A  -x gateway.example.com -W %h:%p
   IdentityFile ~/.ssh/id_rsa

Not sure if this works for your specific case though.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • Is there a way to include more features to a tool in this case? – sphchow Oct 26 '15 at 19:23
  • @sphchow: Depends on your environment. See my edit for a better way to create a tunnel. – Sven Oct 26 '15 at 19:26
  • The reason I need to do it with nc is because it lets me setup TCP to UDP forward on my server. So I don't think your way to create a tunnel will work for my purpose? I'm not an expert so I definitely could be missing something. – sphchow Oct 26 '15 at 19:30
  • Sorry, I didn't saw the UDP part and I am not sure it will work right, I use this for a SSH gateway host. – Sven Oct 26 '15 at 19:31
  • @sphchow Why are you trying to do any of this at all? – Michael Hampton Oct 26 '15 at 19:32
  • No need to be sorry! Your comments helped me out. Hopefully I can give @Iain answer a try and that will enable all the capabilities I need. – sphchow Oct 26 '15 at 19:33
  • The reason I'm trying to do this in short is... I have one program on my localhost and another program on Lets say Host B communicating to each other. Host A is in between, therefore I need to create a tunnel from local to B. The data is in UDP so I need to foward the SSH Port to a UDP port so the programs can process it on the local side and host B side. Hopefully that makes sense? (Sorry I don't know how to tag you Michael) – sphchow Oct 26 '15 at 19:38
  • If you know a better way to do this, that'd be awesome. So far the only way I could find was using this: http://zarb.org/~gc/html/udp-in-ssh-tunneling.html – sphchow Oct 26 '15 at 19:48
  • @sphchow Eh? What's wrong with using a VPN like everyone else? – Michael Hampton Oct 26 '15 at 20:01
  • @MichaelHampton I'm pretty new at this... what are the benefits of using VPN instead of the method I'm trying to implement right now? I'm not to familar with VPN so I wouldn't know how to implement it. Giving it a quick read it seems I have to install additional packages and do a bit of configuring. Also apparantly using UDP for VPN for long distances is a bad idea? – sphchow Oct 26 '15 at 20:14
  • @sphchow You still haven't explained why you are trying to do this. – Michael Hampton Oct 26 '15 at 20:16
  • I guess I'm confused to what you refer to when you are saying what I'm trying to do. Why I need more nc options or why do I need UDP two way tunneling? I need nc options to have the ability to forward data entering a TCP port to a UDP port. And I need UDP two way tunneling because the two programs that talk to each other do so in UDP. – sphchow Oct 26 '15 at 20:25
1

It appears that your version of busybox nc has been compiled without listening capability. There is a compile time option NC_SERVER that has to be set to get the capabilities you want. The messages and functionality ou are seeing are entirely consistent with this being not set.

user9517
  • 115,471
  • 20
  • 215
  • 297