Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   Netcat echo mode (http://www.linux-archive.org/ubuntu-user/64230-netcat-echo-mode.html)

"ml@bortal.de" 04-04-2008 06:24 PM

Netcat echo mode
 
Hello,

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?

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 :) )

Thanks, Mario


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Peter Garrett 04-04-2008 08:05 PM

Netcat echo mode
 
On Fri, 04 Apr 2008 20:24:16 +0200
"ml@bortal.de" <ml@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
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

"ml@bortal.de" 04-04-2008 11:45 PM

Netcat echo mode
 
Hi Peter,



Peter Garrett schrieb:

On Fri, 04 Apr 2008 20:24:16 +0200
"ml@bortal.de" <ml@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:


I actually do not want to find open port, but test if my open ports can
be reached (UDP and TCP).



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



A UDP Port never replies by default. Thats why i need some
client/server setup to check if the udp port is really open (or better:
if the udp port is allowed by the firewall inbetween!)



Thanks, Mario



Peter








--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


All times are GMT. The time now is 01:00 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.