
Tengo dos computadoras, una está funcionando.Debian GNU/Linux 9y el otroUbuntu 18.04.1 LTS. He instalado openssh en ambas computadoras.
sudo apt install openssh-client
sudo apt install openssh-server
Ahora puedo usar ssh para conectarme de Debian a Ubuntu, pero no de Ubuntu a Debian.
En la computadora Debian
nmap localhost
salidas:
Starting Nmap 7.40 ( https://nmap.org ) at 2019-01-24 14:39 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00010s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 999 closed ports
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
También he intentado ejecutar
sudo ufw allow ssh
en la computadora Debian.
¿Qué debo hacer para poder acceder a cualquiera de las computadoras desde la otra?
Editado en respuesta a los comentarios.
Ejecutándose netstat -l
en las salidas del servidor Debian:
b1012@debian:~$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:5939 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 0.0.0.0:mdns 0.0.0.0:*
udp 0 0 0.0.0.0:40272 0.0.0.0:*
udp 0 0 0.0.0.0:57967 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp6 0 0 [::]:mdns [::]:*
udp6 0 0 [::]:41052 [::]:*
raw6 0 0 [::]:ipv6-icmp [::]:* 7
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 19723 /run/user/1000/pulse/native
unix 2 [ ACC ] STREAM LISTENING 15627 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 15630 /var/run/avahi-daemon/socket
unix 2 [ ACC ] STREAM LISTENING 15633 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 16129 /tmp/ssh-AYHltf8zzAuv/agent.600
unix 2 [ ACC ] STREAM LISTENING 16960 /tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 18495 /tmp/.ICE-unix/600
unix 2 [ ACC ] STREAM LISTENING 17542 @/tmp/dbus-0nAe1Vft
unix 2 [ ACC ] STREAM LISTENING 16959 @/tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 14138 @/tmp/dbus-kLaALJuH
unix 2 [ ACC ] STREAM LISTENING 18494 @/tmp/.ICE-unix/600
unix 2 [ ACC ] STREAM LISTENING 14179 /run/user/1000/systemd/private
unix 2 [ ACC ] STREAM LISTENING 14184 /run/user/1000/gnupg/S.gpg-agent.browser
unix 2 [ ACC ] STREAM LISTENING 14187 /run/user/1000/bus
unix 2 [ ACC ] STREAM LISTENING 14189 /run/user/1000/gnupg/S.gpg-agent
unix 2 [ ACC ] STREAM LISTENING 14191 /run/user/1000/gnupg/S.gpg-agent.extra
unix 2 [ ACC ] STREAM LISTENING 14193 /run/user/1000/gnupg/S.gpg-agent.ssh
unix 2 [ ACC ] STREAM LISTENING 17539 /run/user/1000/keyring/control
unix 2 [ ACC ] SEQPACKET LISTENING 1427 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 14139 @/tmp/dbus-kLVeQt6a
unix 2 [ ACC ] STREAM LISTENING 17311 /run/user/1000/keyring/ssh
unix 2 [ ACC ] STREAM LISTENING 17313 /run/user/1000/keyring/pkcs11
unix 2 [ ACC ] STREAM LISTENING 9634 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 9648 /run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 9653 /run/systemd/fsck.progress
unix 2 [ ACC ] STREAM LISTENING 17541 @/tmp/dbus-yMrL8O3f
unix 2 [ ACC ] STREAM LISTENING 18465 @/tmp/dbus-stZvWk5V9a
unix 2 [ ACC ] STREAM LISTENING 17404 /var/run/NetworkManager/private-dhcp
Me sale connection timed out
, cuando intento conectarme.
ssh [email protected] -vvv
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/optoscale/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "192.168.0.104" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.0.104 [192.168.0.104] port 22.
debug1: connect to address 192.168.0.104 port 22: Connection timed out
ssh: connect to host 192.168.0.104 port 22: Connection timed out
Correr
b1012@debian:~$ systemctl status ssh.service
Salidas:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Thu 2019-01-24 13:42:23 CET; 2h 0min ago
Process: 3594 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
Process: 3589 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 2332 (sshd)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/ssh.service
└─2332 /usr/sbin/sshd -D
Respuesta1
Tiene un firewall NAT entre sus dos máquinas. Puede ver esto porque la dirección IP de su sistema Debian es 192.168.0.24 pero el sistema Ubuntu ve la conexión entrante asociada proveniente de 10.20.81.24.
A menos que controle y administre este firewall NAT, le resultará imposible conectarse directamente desde su servidor Ubuntu a su servidor Debian. (Existen varias soluciones, incluida la ejecución autossh
en su sistema Debian con un túnel inverso o OpenVPN iniciado desde Debian a Ubuntu. Cualquiera de las dos puede permitir que las conexiones se realicen en sentido contrario).