Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to check whether there is a route between two hosts for a particular port (e.g. 1433).

share|improve this question
3  
If there is a route for one port there is a route for every port. Routing happens on a network layer without ports. –  Christopher Perrin Aug 7 '13 at 4:20
    
What if there is a firewall between the two hosts and filter ports? –  ohho Aug 7 '13 at 4:24
1  
@ohho: it doesn't matter. If there is a route - then it is there regardless of firewall settings. You probably need to rephrase your question. –  zerkms Aug 7 '13 at 4:25
1  
Firewalls operate at a different level. @ChristopherPerrin is correct, routing occurs at the IP level, not the port level. –  EEAA Aug 7 '13 at 4:26
    
So is there any command line tool (CentOS) I can use to check the hosts are connectable via a particular port? –  ohho Aug 7 '13 at 4:28

3 Answers 3

up vote 2 down vote accepted

with 'ip route get ADDRESS' you can check the route configured in your system, that is, the first hop:

$ ip route get 192.168.10.10
192.168.10.10 via 192.168.10.1 dev eth0  src 192.168.10.11 
    cache 

to check the port connectivity, a simple telnet should do:

$ telnet 192.168.10.10 1433
...

good luck!

share|improve this answer

Fisrt, you must know that, the route action occurs at Network Layer, while port is defined at Transport Layer. So If there is a route exists between two host doesn't mean you can reach a port in a host.

Imagining two host is two house, port is gate of the house, route is road. You can build many roads between houses. But when you reach a house, if the house's gate is closed, you can not come in.

UPDATE

For you comment question, you could use some command like:

To check route exists:

  • route
  • traceroute

To check open port:

  • telnet
  • netcat

Read it manpage and try using.

share|improve this answer
    
What (command line) tools are available to check the route existence, and the port connectivity? –  ohho Aug 7 '13 at 4:49
    
If you can find a route between the hosts with the tools then there IS a route. If there is a route you can check if the port is open with the other tools. –  Christopher Perrin Aug 7 '13 at 5:08
    
telnet dst_host dst_port is the standard invocation. –  dmourati Aug 7 '13 at 6:42

I really like mtr http://www.bitwizard.nl/mtr/. There is also a windows version at http://winmtr.net/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.