Netcat echo mode

Peter Garrett peter.garrett at optusnet.com.au
Fri Apr 4 20:05:29 UTC 2008


On Fri, 04 Apr 2008 20:24:16 +0200
"ml at bortal.de" <ml at bortal.de> wrote:

> i would like to send some data from a netcat client to a netcat server.
> Can you set up the netcat server so that it echos what he recieves?

As I understand it, netcat acts as both a client and server, effectively,
depending on which end you look at it from ;) So I'm not sure what you mean
here. 

> Background: I would like to test my firewall setup if all my open ports
> (tcp and udp) work. So i want to send some data and check if the same
> data comes back.
> 
> Can netcat do that? (no i dont want to use nmap :) )

You can use netcat ( nc ) to "scan" ports - for example:

nc -w 2 -z name-or-IP 80

checks if the system at "name-or-IP" is listening on port 80 . The -w
option is a "timeout" in seconds. If successful, nc exits silently. If
not, you see an error message. 

For example:

$ nc -w 2 -z archive.ubuntu.com 80                     # OK - silent exit 
$ nc -w 2 -z archive.ubuntu.com.bogus 80 
archive.ubuntu.com.bogus: forward host lookup failed: Unknown host :
Connection timed out


Peter

-- 
"INX Is Not X" Live CD based on Ubuntu 7.04 : http://inx.maincontent.net
Screenshots slideshow: http://inx.maincontent.net/album/1.png.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080405/317bf3e1/attachment.sig>


More information about the ubuntu-users mailing list