ROS开启远程SSH

Table of Contents

一直想在外网登陆ROS管理其配置,今天折腾了大半天,请教了群里的几位兄弟,终于搞定。

具体方法:

1  修改ssh端口为45(根据需要可自行设定)以及允许网络访问,如下图

ros_ssh

2  防火墙放行ssh端口(这里是45)

winbox终端输入:ip firewall filter add chain=input action=accept protocol=tcp dst-port=45 disabled=no comment="ros-ssh" place-before=0

注意红色字体部分一定要写上,否则条目有可能失效。


 

使用tcping工具测试45端口是否打开:

C:\Users\pc\Downloads>tcping.exe -n 3 anguish.eicp.net 45

Probing 119.137.20.99:45/tcp - Port is open (16 bytes read) - time=484ms
Probing 119.137.20.99:45/tcp - Port is open (16 bytes read) - time=578ms
Probing 119.137.20.99:45/tcp - Port is open (16 bytes read) - time=562ms

Ping statistics for 119.137.20.99:45:
3 probes sent.
Approximate trip times in milli-seconds:
Minimum = 484ms, Maximum = 578ms, Average = 541ms

其他外网IP使用ssh登录ROS测试成功:

[root@li330-94 ~]# ssh -v [email protected] -p 45
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to anguish.eicp.net [119.137.20.99] port 45.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version ROSSSH
debug1: no match: ROSSSH
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: ssh_conf_0

debug1: ip_range{183.17.222.222-183.17.222.222}

debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[anguish.eicp.net]:45' is known and matches the DSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Next authentication method: password
[email protected]'s password:

按照此方法可成功开启其他端口如Telnet、web、ftp等。

 

#########################################