ubuntuusers.de

SSH und IPv6

Status: Gelöst | Ubuntu-Version: Kein Ubuntu
Antworten |

Knobibrot

Anmeldungsdatum:
12. April 2008

Beiträge: 95

Hallo zusammen,

ich hab mich jetzt durch einige Anleitungen und Tutorials gegraben, doch keins will mir wirklich erklären wie ich folgendes hinbekomme:

Ich hab einen Ubuntu-Server (bei Host Europe) der auf DualStack läuft, also eine IPv4 und IPv6 Adresse hat. Zu Hause habe ich IPv4 NUR über DualStack-Lite, das heißt meine Fritzbox ist über die IPv4 Adresse nicht erreichbar, wohl aber über IPv6 Ich habe hinter der Fritzbox einen Raspberry Pi, auf den ich gerne von meinem Ubuntu-Server aus über SSH zugreifen will, was logischerweise aber nur über IPv6 funktioniert.

Port 22 ist auf der FritzBox auch für IPv6 freigeschaltet und leitet auf die IPv6 Adresse des Raspberry Pi. Ich kann den Pi vom Ubuntu-Server aus auch über ping6 pingen.

Aber wie öffne ich jetzt eine Verbindung über ssh zu dem Pi?

Versucht habe ich bisher folgendes:

ssh -6 root@<IP>

ssh: connect to host <IP> port 22: Connection refused

und

ssh -6 root@<IP>%eth0

ssh: Could not resolve hostname <IP>%eth0: Name or service not known

Was genau mache ich falsch?

Bearbeitet von Antiqua:

IP anonymisiert

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

Aber wie öffne ich jetzt eine Verbindung über ssh zu dem Pi?

Versucht habe ich bisher folgendes:

ssh -6 root@<IP>
ssh: connect to host <IP> port 22: Connection refused

Lauscht der Pi auf dem tcp6-Port 22?

sudo netstat -lntpe | grep :22

Bearbeitet von Antiqua:

IP anonymisiert

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

root@xbian:~# netstat -lntpe | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          2495        870/inetd       

mhhh sieht nur nach IPv4 aus... richtig? wie kriege ich es hin, dass er auch auf IPv6 lauscht?

@Antiquia: Die IP oben war frei erfunden 😉 aber trotzdem danke fürs anonymisieren

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

root@xbian:~# netstat -lntpe | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          2495        870/inetd       

mhhh sieht nur nach IPv4 aus... richtig?

Ja, richtig.

Knobibrot schrieb:

wie kriege ich es hin, dass er auch auf IPv6 lauscht?

Wie sind auf dem Pi, die Ausgaben für:

cat /etc/modules
lsmod | grep -i ipv6
cat /etc/sysctl.conf | grep -i ipv6
ifconfig -a

?

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

root@xbian:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

ipv6
root@xbian:~# lsmod | grep -i ipv6
ipv6                  219188  23 
root@xbian:~# cat /etc/sysctl.conf | grep -i ipv6
# Note: This may impact IPv6 TCP sessions too
# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.all.forwarding=1
#net.ipv6.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_source_route = 0
root@xbian:~# ifconfig -a
eth0      Link encap:Ethernet  Hardware Adresse [MAC-ADRESSE]  
          inet Adresse:192.168.0.34  Bcast:192.168.0.255  Maske:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metrik:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
          UP LOOPBACK RUNNING  MTU:65536  Metrik:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenl?nge:0 
          RX bytes:909 (909.0 B)  TX bytes:909 (909.0 B)

wlan0     Link encap:Ethernet  Hardware Adresse [MAC-ADRESSE]  
          inet Adresse:192.168.0.35  Bcast:192.168.0.255  Maske:255.255.255.0
          inet6-Adresse: [IPV6-ADRESSE]/64 G?ltigkeitsbereich:Global
          inet6-Adresse: fe80::[TEIL_DER_IPv6-ADRESSE]/64 G?ltigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:706 errors:0 dropped:823 overruns:0 frame:0
          TX packets:475 errors:0 dropped:1 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenl?nge:1000 
          RX bytes:153828 (150.2 KiB)  TX bytes:82975 (81.0 KiB)

Ich benutze am Pi übrigens wlan0 um ins Netz zu gehen. An eth0 hängt kein Kabel.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

Ich benutze am Pi übrigens wlan0 um ins Netz zu gehen. An eth0 hängt kein Kabel.

Hast Du in der sshd_config des Pi, auch inet6 oder any konfiguriert?

AddressFamily
             Specifies which address family should be used by sshd(8).  Valid arguments are ``any'', ``inet'' (use IPv4 only), or
             ``inet6'' (use IPv6 only).  The default is ``any''.

EDIT:

Kann/darf dein ssh-Client, inet6 benutzen?

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

lubux schrieb:

Hast Du in der sshd_config des Pi, auch inet6 oder any konfiguriert?

Nope, da stand "inet" als Wert.. habe es jetzt auf "any" gesetzt.

Wenn ich jetzt vom Laptop aus versuche über SSH zu verbinden, dann kommt:

ssh -6 root@[IPv6-Adresse]
ssh: connect to host [IPv6-Adresse] port 22: No route to host

und beim Host-Europe Server kommt nach wie vor:

ssh -6 [IPv6-Adresse]
ssh: connect to host [IPv6-Adresse] port 22: Connection refused

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

lubux schrieb:

Hast Du in der sshd_config des Pi, auch inet6 oder any konfiguriert?

Nope, da stand "inet" als Wert.. habe es jetzt auf "any" gesetzt.

Wie ist jetzt die Ausgabe für:

sudo netstat -lntpe | grep :22

auf dem Pi?

EDIT:

Welche FritzBox hast Du? Bei welchem Provider hast Du DS-Lite?

EDIT 2:

Knobibrot schrieb:

Ich kann den Pi vom Ubuntu-Server aus auch über ping6 pingen.

Bist Du sicher, dass Du auch den Pi mit ping6 erreicht hast? Wie hast Du das überprüft?

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

unverändert

root@xbian:~# netstat -lntpe | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          2414        793/inetd 

hier mal die sshd_config

root@xbian:~# cat /etc/ssh/sshd_config 
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::0
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
AddressFamily any
UseDNS no

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

... habe es jetzt auf "any" gesetzt.

Hast Du danach, den sshd auf dem Pi, auch neu gestartet?

EDIT:

Versuch auch mit:

ListenAddress ::
ListenAddress 0.0.0.0

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

ja, ich hab gleich den ganzen Pi neu gestartet... Änderungen stehen auch immer noch in der sshd_config. Beim booten wurde also nix überschrieben.

Zur Not muss ich ins Raspberry Pi Forum weiter ziehen und dort fragen.. ist vielleicht eine eigenart von Xbian/Raspbian

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

Zur Not muss ich ins Raspberry Pi Forum weiter ziehen und dort fragen..

Ja. Versuch mal auch mit:

ListenAddress ::
ListenAddress 0.0.0.0

Welche FritzBox hast Du? Bei welchem Provider hast Du DS-Lite? Wie hast Du den Ping6 auf den Pi überprüft? Bist Du sicher, dass Du evtl. nur die FritzBox, mit ping6 erreicht hast?

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

nach den Änderungen mit ListenAddress komme ich nicht mehr über SSH auf den Pi

ssh root@192.168.0.35
ssh_exchange_identification: Connection closed by remote host

Fritzbox 6320 von Unitymedia Die Fritzbox hat einen extra Punkt ob sie PING6 Anfragen an das Netzwerkgerät weiterleiten soll. Der Haken dort ist gesetzt. Ich komme auch von außen über Port 80 auf den Pi drauf. Ich hab die Fritzbox so eingestellt, dass der komplette Traffic der an der IPv6 des Pi ankommt ungefiltert an den Pi weitergeleitet wird.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14318

Knobibrot schrieb:

nach den Änderungen mit ListenAddress komme ich nicht mehr über SSH auf den Pi

ssh root@192.168.0.35
ssh_exchange_identification: Connection closed by remote host

Evtl. die Eintragungen in der sshd_config, auf der SD-Karte des Pi, mit einem Linux-PC ändern.

EDIT:

Knobibrot schrieb:

root@xbian:~# netstat -lntpe | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          2495        870/inetd       

Versuch mal den sshd, ohne inetd (d. h. standalone) zu benutzen.

Wie ist auf deinem Pi, die Ausgabe für:

cat /etc/inetd.conf

und

cat /etc/hosts.allow

?

EDIT 2:

Wenn Du auf deinem Pi, inetd mit ipv6 benutzen willst, dann musst Du diesen auch entsprechend konfigurieren.

Knobibrot

(Themenstarter)

Anmeldungsdatum:
12. April 2008

Beiträge: 95

root@xbian:~# cat /etc/inetd.conf
# /etc/inetd.conf:  see inetd(8) for further informations.
#
# Internet superserver configuration database
#
#
# Lines starting with "#:LABEL:" or "#<off>#" should not
# be changed unless you know what you are doing!
#
# If you want to disable an entry so it isn't touched during
# package updates just comment it out with a single '#' character.
#
# Packages should modify this file by using update-inetd(8)
#
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
#
#:INTERNAL: Internal services
#discard		stream	tcp	nowait	root	internal
#discard		dgram	udp	wait	root	internal
#daytime		stream	tcp	nowait	root	internal
#time		stream	tcp	nowait	root	internal

#:STANDARD: These are standard services.
#<off># ftp	stream	tcp	nowait	root	/usr/sbin/tcpd /usr/sbin/proftpd

#:BSD: Shell, login, exec and talk are BSD protocols.

#:MAIL: Mail, news and uucp services.

#:INFO: Info services

#:BOOT: TFTP service is provided primarily for booting.  Most sites
#       run this only on machines acting as "boot servers."

#:RPC: RPC based services

#:HAM-RADIO: amateur-radio services

#:OTHER: Other services

# SAMBA NetBIOS services (for PC file and print sharing)
netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd

microsoft-ds stream tcp nowait root /usr/sbin/smbd smbd

ssh  stream  tcp  nowait  root   /usr/sbin/tcpd /usr/sbin/sshd -i

die Datei /etc/hosts.allow ist bis auf den Standard-Text leer

EDIT:

Es geht!!! Vielen Dank lubux!!!

Was hab ich gemacht? Der /etc/inetd.conf folgenden Eintrag hinzugefügt:

ssh  stream  tcp6  nowait  root   /usr/sbin/tcpd /usr/sbin/sshd -i

und der hosts.allow habe ich ein

sshd: ALL

hinzugefügt..

Jetzt komme ich von außen über SSH auf den Pi!

Noch mal viele Dank für die Hilfe!!

Antworten |