ssh:connect to host 192.168.43.106 port 22:no route to host
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh:connect to host 192.168.43.106 port 22:no route to host相关的知识,希望对你有一定的参考价值。
Ubuntu ip 192.168.43.107;mininet ip 192.168.43.106 使用两者的root权限进行连接。ubuntuh中命令为ssh -X root@192.168.43.106 但是总显示 ssh:connect to host 192.168.43.106 port 22:no route to host 这是为什么?
参考技术A 如何实现JAVA远程操控linux服务器,代码如下:Java代码
package hb.linux;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
public class TestCtrCommond
public static void main(String[] args)
String hostname = "129.17.17.20";
String username = "weblogic";
String password = "weblogic";
//指明连接主机的IP地址
Connection conn = new Connection(hostname);
Session ssh = null;
try
//连接到主机
conn.connect();
//使用用户名和密码校验
boolean isconn = conn.authenticateWithPassword(username, password);
if(!isconn)
System.out.println("用户名称或者是密码不正确");
else
System.out.println("已经连接OK");
ssh = conn.openSession();
//使用多个命令用分号隔开
// ssh.execCommand("pwd;cd /tmp;mkdir hb;ls;ps -ef|grep weblogic");
ssh.execCommand("cd /app/weblogic/Oracle/Middleware/user_projects/domains/base_domain;./startWebLogic.sh &");
//只允许使用一行命令,即ssh对象只能使用一次execCommand这个方法,多次使用则会出现异常
// ssh.execCommand("mkdir hb");
//将屏幕上的文字全部打印出来
InputStream is = new StreamGobbler(ssh.getStdout());
BufferedReader brs = new BufferedReader(new InputStreamReader(is));
while(true)
String line = brs.readLine();
if(line==null)
break;
System.out.println(line);
//连接的Session和Connection对象都需要关闭
ssh.close();
conn.close();
catch (IOException e)
// TODO Auto-generated catch block
e.printStackTrace();
希望对你有帮助
以上是关于ssh:connect to host 192.168.43.106 port 22:no route to host的主要内容,如果未能解决你的问题,请参考以下文章
使用wifi ssh: connect to host hadoop000 port 22: No route to host
启动hadoop出现ssh: connect to host master port 22: No route to host
git clone遇到的[ssh: connect to host github.com port 22]
github默认端口22被占用,ssh: connect to host github.com port 22: Connection timed out
git上传代码报错ssh: connect to host github.com port 22: Connection timed out解决办法
服务器22端口连接超时 ssh: connect to host *** port 22: Operation timed out