aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Check the connectivity from one host IP to another IP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Check the connectivity from one host IP to another IP" Watch "Check the connectivity from one host IP to another IP" New topic
Author

Check the connectivity from one host IP to another IP

Binesh Veetil
Greenhorn

Joined: Jan 21, 2012
Posts: 9
Hi,

I need to test the connectivity from a source IP to destination IP. The source IP is different from the server in which my application is running. Can you please help me understand how this can be done.
Thanks in Advance.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18829
    
  40

Binesh Veetil wrote:
I need to test the connectivity from a source IP to destination IP. The source IP is different from the server in which my application is running. Can you please help me understand how this can be done.
Thanks in Advance.


The most reliable way to do this is to have a service on the source IP, that pings the destination IP, and reports the result to you. And even in this case, it is not guaranteed, as you can lose the connection to the source IP, while the connection between the source and destination IP is fine.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Binesh Veetil
Greenhorn

Joined: Jan 21, 2012
Posts: 9
Henry Wong wrote:
Binesh Veetil wrote:
I need to test the connectivity from a source IP to destination IP. The source IP is different from the server in which my application is running. Can you please help me understand how this can be done.
Thanks in Advance.


The most reliable way to do this is to have a service on the source IP, that pings the destination IP, and reports the result to you. And even in this case, it is not guaranteed, as you can lose the connection to the source IP, while the connection between the source and destination IP is fine.

Henry


Is there a way to connect to source IP and do a telnet to destination IP and check for the connectivity? There is authentication required to login to source IP unix box which I need to bypass. I tried to use telnet java API, but all these prompts for username/pswd to login to source IP.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Binesh Veetil wrote:
Is there a way to connect to source IP and do a telnet to destination IP and check for the connectivity?


IF the source is a public IP address, or is on your LAN, AND the source is running a service such as sshd or telnetd that lets remote users log on, AND you have an account on the source AND the destination is running a service you can connect to AND the destination has a public IP address or is on the same LAN as the destination, then, yes.

There is authentication required to login to source IP unix box which I need to bypass.


Er, no. If you can bypass it, it's pretty useless authentication, isn't it?

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Binesh Veetil wrote:Hi,

I need to test the connectivity from a source IP to destination IP.


Why? Even if there's connectivity now, that doesn't mean there will be when you try to connect "for real." When you're ready to connect, do so. If it succeeds, there's connectivity, and if it fails, there's no connectivity.

What are you actually trying to accomplish? That is, what is the purpose for doing this test?
Binesh Veetil
Greenhorn

Joined: Jan 21, 2012
Posts: 9
Jeff Verdegan wrote:
Binesh Veetil wrote:Hi,

I need to test the connectivity from a source IP to destination IP.


Why? Even if there's connectivity now, that doesn't mean there will be when you try to connect "for real." When you're ready to connect, do so. If it succeeds, there's connectivity, and if it fails, there's no connectivity.

What are you actually trying to accomplish? That is, what is the purpose for doing this test?


Both the source and dest is in our LAN. I need to test the firewall between these. Both the source and dest are running ssh service(with authentication).
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Binesh Veetil wrote:Both the source and dest is in our LAN. I need to test the firewall between these. Both the source and dest are running ssh service(with authentication).


Normally you would do that by sitting down at "source", signing on, and doing the test. Once the test passes, then the firewall is okay. Having to produce an automated testing procedure would go much farther than simply testing the firewall. So I also ask you:

What are you actually trying to accomplish? That is, what is the purpose for doing this test?
Binesh Veetil
Greenhorn

Joined: Jan 21, 2012
Posts: 9
Paul Clapham wrote:What are you actually trying to accomplish? That is, what is the purpose for doing this test?


we have n number of source and dest IPs for which we need to check if the firewall is opened or not, and we are planning to do it via an appl.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Binesh Veetil wrote:
Paul Clapham wrote:What are you actually trying to accomplish? That is, what is the purpose for doing this test?


we have n number of source and dest IPs for which we need to check if the firewall is opened or not, and we are planning to do it via an appl.


Okay, so you have suggestions on how to do what you want, so you should be all set now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check the connectivity from one host IP to another IP