SSH: Can connect locally but not "remotely"

Gab*_*bzo 5 server ssh remote-access

A bit of background: I'm a ubuntu user for almost a year now. I had an old box lying around and decided to put it to some use. The first thing I wanted to do was set up SSH so that I can place it in a seperate location and connect to it via my laptop running ubuntu.

OS of Server: Ubuntu 12.04.3 LTS

OS of laptop: Ubuntu 12.04 LTS (the one trying to connect to the server with)

Router: I'm actually not sure. I have the Bell Canada router.

So I try to login SSH using the internal IP success. Great now I can see if it works with it's public ip. I then try with the public ip and I get:

ssh: connect to host [something].[something] port [something]: Connection refused
Run Code Online (Sandbox Code Playgroud)

(I tried changing the default port using mapping to map a port I chose to port 22 on my local network)

SO I tried reading but apart from making port forwarding I haven't found very helpeful articles.

I have not set up a firewall (Yet)

I also tried doing vvv and all I get is

    [user]@[computer]:~$ ssh -vvv -p [customPort] [user]@[host]                       OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to [host] [ipAdress] port [customPort].
    debug1: connect to address [ipAdress] port [customPort]: Connection refused
    ssh: connect to host [host] port [customPort]: Connection refused
Run Code Online (Sandbox Code Playgroud)

Thanks in adance for any help you can give. Please specify what information you need, if you need any more information

fal*_*ner 4

也许您的 ssh 守护进程设置为仅侦听本地 IP。检查netstat -tupan监听地址是否为 0.0.0.0,或者/etc/ssh/sshd_configListenAddress 行是否被注释掉。


小智 0

就我而言,配置没问题,但我的互联网提供商有问题。在连接到另一个互联网时,我立即连接

记住端口转发,并在端口 22 上启用防火墙例外 我还推荐这个网站 https://www.yougetsignal.com/tools/open-ports/