LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-15-2011, 04:40 PM   #1
sporkit
Member
 
Registered: Feb 2004
Posts: 71

Rep: Reputation: 15
Test if port is open, even if nothing there to respond?


Hi Guys,

This might be a dumb question, but is it possible to test if a remote port is open, even if there is nothing there to respond to it?

For example a command like "telnet mydomain.com 80" will usually receive a response from an Apache server. What if I shut it down? Is there a way to validate it's a least open by connecting from a remote machine?
 
Old 08-15-2011, 04:45 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
This doesn't make sense, the port is not open if there is nothing there. You'll see the same as if iptables was rejecting packets. Mind you, maybe that is enough for you if you would expect a firewall to drop silently rather than reject. The reciept of a TCP RESET packet does generally identify that the system exists.
 
Old 08-15-2011, 05:55 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
The use of the term 'open' in this scenario seems to lead to all sorts of confusion. There isn't any 'gate' or other such obstacle that stops or enables traffic. A port that is 'open' is simply a port to which a process has bound, and is listening for a connection request. No listener = not open. Simple.

--- rod.
 
Old 08-15-2011, 09:36 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
@sporkit:

The telnet(1) test is fine; there are a couple other, more refined utilities as well. nmap(1), nc(1), and hping(1) all do a great job.

Example with nmap:
Code:
$ nmap -PN foo.local -p 80
If a tcp handshake is established, nmap says "open". If a tcp RST is received, nmap says "closed". If no reply is received, nmap says "filtered".
 
Old 08-16-2011, 12:03 PM   #5
sporkit
Member
 
Registered: Feb 2004
Posts: 71

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by anomie View Post
@sporkit:

The telnet(1) test is fine; there are a couple other, more refined utilities as well. nmap(1), nc(1), and hping(1) all do a great job.

Example with nmap:
Code:
$ nmap -PN foo.local -p 80
If a tcp handshake is established, nmap says "open". If a tcp RST is received, nmap says "closed". If no reply is received, nmap says "filtered".
THANK YOU... You hit the nail on the head Anomie.

And I don't think the term "open" is a misnomer here. I'm testing connectivity to a port lying beyond several complex hardware firewalls and subnets. I would have said "accepting connections" if I was concerned with the program running underneath it.
 
Old 08-17-2011, 02:21 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
it definitely IS a misnomer. Open = accepting connections.
 
Old 08-18-2011, 02:23 PM   #7
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 876

Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by acid_kewpie View Post
it definitely IS a misnomer. Open = accepting connections.
Agree completely. An open port is one with a listening daemon that can accept connections. A closed port is one with no listening process. The connection will either be refused or if you have a decent firewall totally ignored.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Oracle scorns open source: How to respond? LXer Syndicated Linux News 0 08-18-2010 07:21 PM
Why open source people do not respond e-mails? antoniog General 14 08-05-2007 07:21 AM
Is there any way I can test a port on a remote machine to see whether its open? neocookie Linux - Networking 3 05-09-2007 05:13 PM
port is slow to respond, please be patient cccc Debian 3 01-22-2007 12:48 PM
don't respond, im just doing a test of something unimaginative LinuxQuestions.org Member Intro 2 01-08-2004 05:59 PM


All times are GMT -5. The time now is 11:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration