
Ich habe zwei Computer, einer läuftDebian GNU/Linux 9und der andereUbuntu 18.04.1 LTS. Ich habe OpenSSH auf beiden Computern installiert.
sudo apt install openssh-client
sudo apt install openssh-server
Jetzt kann ich per SSH eine Verbindung von Debian zu Ubuntu herstellen, aber nicht von Ubuntu zu Debian.
Auf dem Debian-Computer
nmap localhost
Ausgänge:
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
Ich habe auch versucht zu laufen
sudo ufw allow ssh
auf dem Debian-Computer.
Was muss ich tun, um von einem Computer aus auf den anderen zugreifen zu können?
Als Reaktion auf Kommentare bearbeitet
Die Ausführung netstat -l
auf dem Debian-Server gibt Folgendes aus:
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
connection timed out
Beim Verbindungsversuch erhalte ich die Meldung .
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
Läuft
b1012@debian:~$ systemctl status ssh.service
Ausgaben:
● 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
Antwort1
Sie haben eine NAT-Firewall zwischen Ihren beiden Rechnern. Sie können dies daran erkennen, dass die IP-Adresse Ihres Debian-Systems 192.168.0.24 lautet, das Ubuntu-System jedoch erkennt, dass die zugehörige eingehende Verbindung von 10.20.81.24 kommt.
Wenn Sie diese NAT-Firewall nicht kontrollieren und verwalten, ist es Ihnen nicht möglich, eine direkte Verbindung von Ihrem Ubuntu-Server zu Ihrem Debian-Server herzustellen. (Es gibt verschiedene Workarounds, darunter die Ausführung autossh
auf Ihrem Debian-System mit einem Reverse-Tunnel oder OpenVPN, das von Debian zu Ubuntu initiiert wird. Beides ermöglicht Verbindungen in die andere Richtung.)