Ubuntu – SSH to network alias ssh_exchange_identification: read: Connection reset by peer

networkingssh

New install: Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-45-generic x86_64)

I have no problem with SSH to the DHCP address .22, but when I try the alias address .80 the connection is reset by peer. I've done no other setup other than a new installation and setup of the network alias. ufw is not enabled and there is nothing in the hosts.deny or hosts.allow. I have tried deleting the known_hosts, none of which changed the result. I have enabled sshd_config LogLevel DEBUG, but /var/log/auth.log doesn't provide any information about the connection attempt that is reset.

/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)

Success on SSH to 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 hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com 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

Failure when trying to SSH to the alias fixed IP

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

Subnet mask

So based on a similar issue, I noticed the alias mask is .255 instead of .0. I tried setting options to see if that changed anything, but the value would not change. I have another ubuntu server setup the same way, and it looks the same (the alias mask also is .255, so perhaps this isn't a problem.


ListenAddress

I tried changing the ListenAddress in sshd_config, with nothing changing. It seems as though this config is for restricting access, instead of the default which listens on all addresses.


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

Best Answer

So, step 1 to setting a fixed ip address should be to make sure another device isn't already connected to that ip! The moment I changed the ip to something that wasn't already claimed, everything worked fine.