SSH para o alias de rede ssh_exchange_identification: read: Conexão redefinida pelo peer

1

Nova instalação: Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-45-generic x86_64)

Eu não tenho nenhum problema com o SSH para o endereço DHCP .22 , mas quando eu tento o endereço de alias .80 a conexão é redefinida pelo peer. Não fiz outra configuração além de uma nova instalação e configuração do alias da rede. ufw não está ativado e não há nada no hosts.deny ou hosts.allow . Eu tentei excluir o known_hosts , nenhum dos quais alterou o resultado. Eu habilitei sshd_config LogLevel DEBUG , mas /var/log/auth.log não fornece nenhuma informação sobre a tentativa de conexão que foi redefinida.

/etc/dhcp/dhclient.conf

alias {
  interface "eth0";
  fixed-address 10.1.10.80;
}

ifconfig

eth0      Link encap:Ethernet  HWaddr c8:60:00:a6:02:9e  
          inet addr:10.1.10.22  Bcast:10.1.10.255  Mask:255.255.255.0
          inet6 addr: fe80::ca60:ff:fea6:29e/64 Scope:Link
          inet6 addr: 2601:484:c301:c400:ca60:ff:fea6:29e/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6358 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1465 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:551715 (551.7 KB)  TX bytes:260772 (260.7 KB)
          Interrupt:18 Memory:fb700000-fb720000 

eth0:0    Link encap:Ethernet  HWaddr c8:60:00:a6:02:9e  
          inet addr:10.1.10.80  Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:18 Memory:fb700000-fb720000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1184 (1.1 KB)  TX bytes:1184 (1.1 KB)

Sucesso no SSH para 22

kross$ ssh -v 10.1.10.22
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/kross/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: Connecting to 10.1.10.22 [10.1.10.22] port 22.
debug1: Connection established.
debug1: identity file /Users/kross/.ssh/id_rsa type 1
debug1: identity file /Users/kross/.ssh/id_rsa-cert type -1
debug1: identity file /Users/kross/.ssh/id_dsa type -1
debug1: identity file /Users/kross/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] 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: Server host key: RSA be:5f:04:6c:62:a6:bd:28:57:ec:63:43:c0:9c:eb:b9
debug1: Host '10.1.10.22' is known and matches the RSA host key.
debug1: Found key in /Users/kross/.ssh/known_hosts:28
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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: Offering RSA public key: /Users/kross/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/kross/.ssh/id_dsa
debug1: Next authentication method: password

Falha ao tentar o SSH para o IP fixo do alias

kross$ ssh -v 10.1.10.80
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/kross/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: Connecting to 10.1.10.80 [10.1.10.80] port 22.
debug1: Connection established.
debug1: identity file /Users/kross/.ssh/id_rsa type 1
debug1: identity file /Users/kross/.ssh/id_rsa-cert type -1
debug1: identity file /Users/kross/.ssh/id_dsa type -1
debug1: identity file /Users/kross/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
ssh_exchange_identification: read: Connection reset by peer

Máscara de sub-rede

Portanto, com base em uma edição semelhante , Percebi que a máscara de alias é .255 em vez de .0 . Tentei definir opções para ver se isso mudou alguma coisa, mas o valor não mudaria. Eu tenho outra configuração do servidor Ubuntu da mesma forma, e parece o mesmo (a máscara de alias também é .255 , então talvez isso não seja um problema.

ListenAddress

Eu tentei alterar o ListenAddress no sshd_config, sem nada mudar. Parece que essa configuração é para restringir o acesso, em vez do padrão que escuta em todos os endereços.

netstat

# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.1.10.1       0.0.0.0         UG        0 0          0 eth0
10.1.10.0       0.0.0.0         255.255.255.0   U         0 0          0 eth0
10.1.10.80      0.0.0.0         255.255.255.255 UH        0 0          0 eth0
    
por kross 28.07.2015 / 17:49

3 respostas

1

Portanto, o passo 1 para definir um endereço IP fixo deve ser para garantir que outro dispositivo ainda não esteja conectado a esse ip! No momento em que mudei o ip para algo que não foi reivindicado, tudo funcionou bem.

    
por kross 29.07.2015 / 20:40
0

Verifique em man sshd_conf , em parte:

 ListenAddress
         Specifies the local addresses sshd(8) should listen on.  The following forms may be used:

               ListenAddress host|IPv4_addr|IPv6_addr
               ListenAddress host|IPv4_addr:port
               ListenAddress [host|IPv6_addr]:port

         If port is not specified, sshd will listen on the address and all prior Port options specified.  The default is to listen on all local addresses.  Multi‐
         ple ListenAddress options are permitted.  Additionally, any Port options must precede this option for non-port qualified addresses.  

Por isso, sugiro que você adicione ListenAddress 10.1.10.80 a /etc/ssh/sshd_config .

sshd no segundo caso, não está "ouvindo" esse endereço IP, por isso nega a conexão.

    
por waltinator 29.07.2015 / 06:45
0

Para referência isso funcionou para mim.

Em /etc/hosts.allow add sshd :ALL

    
por dev93 26.02.2017 / 17:15