nc missing option -z

Ed Greshko Ed.Greshko at greshko.com
Wed Feb 13 15:14:45 UTC 2013


On 02/13/2013 10:43 PM, inode0 wrote:
> On Wed, Feb 13, 2013 at 7:57 AM, Ed Greshko <Ed.Greshko at greshko.com> wrote:
>> One thing of interest to note but which may not affect what the OP is doing....
>>
>> If the port being tested is listed as "filtered" by nmap
>>
>> [egreshko at meimei ~]$ nmap -Pn -p143 imap.gmail.com
>>
>> Starting Nmap 6.01 ( http://nmap.org ) at 2013-02-13 21:53 CST
>> Nmap scan report for imap.gmail.com (173.194.64.108)
>> Host is up.
>> Other addresses for imap.gmail.com (not scanned): 173.194.64.109
>> rDNS record for 173.194.64.108: oa-in-f108.1e100.net
>> PORT    STATE    SERVICE
>> 143/tcp filtered imap
>>
>> the command
>>
>> 2>/dev/null >/dev/tcp/imap.gmail.com/143 && echo "yes"
>>
>> will hang for quite some time....
> I don't think this is related to the port being filtered as other
> sites with filtered ports return quickly (same is true of down hosts).
> Perhaps it is some other rude firewall behavior that causes the
> delay?!
>

Well, basically, what the command is doing is causing a SYN packet to be sent out.  If the host is down or the firewall doesn't send an RST,ACK it will "hang" until it times out.

So, since the OP is using to test if a system is "alive" a "dead" system will cause a substantial delay before timing out.

-- 
Don't be bullied by the judgmental grammar and spelling police.


More information about the users mailing list