Skip to content

Instantly share code, notes, and snippets.

@taufiqibrahim
Last active March 8, 2018 03:21
Show Gist options
  • Save taufiqibrahim/97be83446cb12f41aaf99ed74916aaf4 to your computer and use it in GitHub Desktop.
Save taufiqibrahim/97be83446cb12f41aaf99ed74916aaf4 to your computer and use it in GitHub Desktop.
Database server slow PostgreSQL connection establishment (20 seconds) & slow SSH establishment

/etc/ssh/sshd_config

Problem

SSH establishment takes a long time, with ssh -v result:

debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

Solution

Set GSSAPIAuthentication to yes

Before:

...
# GSSAPI options
GSSAPIAuthentication yes
...

After:

...
# GSSAPI options
GSSAPIAuthentication no
...

Then restart SSHD by

service sshd restart

Result

The SSH connection establishment is faster, but now hanging around 10 seconds on debug1: SSH2_MSG_SERVICE_ACCEPT received

Cause

Hanging around ~10 seconds on: debug1: SSH2_MSG_SERVICE_ACCEPT received

Solution

Change UseDNS to no.

Then restart SSHD by

service sshd restart

Now SSH connection is fast.

/etc/sysconfig/network-scripts/ifcfg-{your_interface_port}

Previously this file contain line for DNS like:

...
DNS1=8.8.8.8
...

It is Google's DNS address. Since the servers were located on customer's premise without any outside internet connection, we decided to comment that line

...
# DNS1=8.8.8.8
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment