Ssh logon delay

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Ssh logon delay
# 1  
Old 05-02-2013
Ssh logon delay

OS - Oracle Linux 5.6 and 6.3 (Oracle Linux is based on Red Hat).

Background: I have several OL 5.6 virtual machines running under Virtual Box on my Win7 Pro desktop. Due to the way VBox handles networking through the network adapter it installs on the host OS, I build my vm's with 2 virtual NICs. The first is configured as NAT, becomes eth0 which is configured for DHCP. The second is configured as host-only, becomes eth1 and is configured with a fixed ip address. As soon as the vm goes through it's initial reboot, I configure a putty session on my desktop to access it, and continue my work from there, never again touching the 'console' inside the VBox window. I have done this scores of times with various updates of OL 5.x.

Now I'm trying to bring up a vm with OL 6.3, using all the same configuration. Whenever I try to log on from a putty session, it takes nearly a minute to get back the prompt for the password. This vm lives in the same network environment as any of my 5.x machines, who all behave as expected. I've been working with a friend on the Oracle OTN forum, but we're just about out of ideas. That discussion is at https://forums.oracle.com/forums/thr...7822&#10997822 if you want to see what has already been tried.

I saw another thread on this forum that looked promising, but it seemed to involve a dns cache, as it reported a delay only on the first login after a period of inactivity, whereas my problem is consistent .. on every login.

The most recent test, and possibly the most telling, is this ... notice the time difference from the start to the finish of the 'hostname' command:

Code:
[root@vblnxsrv02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@vblnxsrv02 ~]# date;hostname -f;date
Thu May  2 14:00:17 CDT 2013
hostname: Host name lookup failure
Thu May  2 14:01:13 CDT 2013
[root@vblnxsrv02 ~]#

[root@vblnxsrv02 ~]# date;dnsdomainname ;date
Thu May  2 14:05:16 CDT 2013
dnsdomainname: Host name lookup failure
Thu May  2 14:06:12 CDT 2013

# 2  
Old 05-02-2013
Please:
Code:
cat /etc/resolv.conf
route -n
ifconfig -a

# 3  
Old 05-03-2013
Quote:
Originally Posted by Corona688
Please:
Code:
cat /etc/resolv.conf
route -n
ifconfig -a

Thanks for the response. Here is the requested info. In the resolv.conf, I have masked some of the IP addresses, because they are on my organization's net. I find that surprising, actually. I didn't directly configure this .. it was done by the OS installation. And I've always believed that between the NAT and the host-only adapters, my vm was effectively isolated from any direct knowledge of the environment outside of the host OS. Maybe there's stuff about NAT I don't fully understand.

Code:
[root@vblnxsrv02 ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.56.2
nameserver ***.***.20.1
nameserver ***.***.10.9
search vbdomain


[root@vblnxsrv02 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.56.1    0.0.0.0         UG    0      0        0 eth1
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1


[root@vblnxsrv02 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:50:94:AB
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe50:94ab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1180 (1.1 KiB)  TX bytes:1346 (1.3 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:A2:45:04
          inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea2:4504/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:134 errors:0 dropped:0 overruns:0 frame:0
          TX packets:163 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12450 (12.1 KiB)  TX bytes:17707 (17.2 KiB)

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:16436  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:588 (588.0 b)  TX bytes:588 (588.0 b)

[root@vblnxsrv02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

By way of contrast, I ran the same on a OL 5.6 vm, also with no configuration beyond what is done by the installation procedure. I find the difference in the resolv.conf to be be interesting.

HTML Code:
[root@vblnxsrv03 ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search ***myorganizationdomain***
nameserver ***.***.10.3
nameserver ***.***.20.1
nameserver ***.***.10.9

[root@vblnxsrv03 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

[root@vblnxsrv03 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:75:FB:5D
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:794 (794.0 b)  TX bytes:2838 (2.7 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:94:37:86
          inet addr:192.168.56.103  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:102 errors:0 dropped:0 overruns:0 frame:0
          TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9984 (9.7 KiB)  TX bytes:12063 (11.7 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

[root@vblnxsrv03 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               vblnxsrv03.vbdomain vblnxsrv03 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
# 4  
Old 05-03-2013
Make two modification:-
(1) comment everything in /etc/resolve.conf
(2) Make UseDNS=no in /etc/sshd/sshd_config

If any of the ethernet adapter are configured to use DHCP, DNS, /etc/resolve.conf will be generated by Network Manager when you reboot the VM. In that case you need to comment everything in /etc/resolve.conf every time.
# 5  
Old 05-03-2013
Maybe you first test with nslookup or dig or host if the DNS resolving really causes the delay?
# 6  
Old 05-03-2013
Quote:
Originally Posted by hiten.r.chauhan
Make two modification:-
(1) comment everything in /etc/resolve.conf
Interesting. That change alone fixed it. So I tried copying resolv.conf from one of my OL 5.6 machines, but that did *NOT* fix it. And of course, that alone is not a viable solution because resolve.conf gets regenerated at every boot up.

Quote:
Originally Posted by hiten.r.chauhan
(2) Make UseDNS=no in /etc/sshd/sshd_config
I take it there is a typo there, as there is no file by that exact name:

HTML Code:
[root@vblnxsrv02 ~]# cd /etc
[root@vblnxsrv02 etc]# find . -name "ssh*config"
./ssh/ssh_config
./ssh/sshd_config
[root@vblnxsrv02 etc]# grep UseDNS ./ssh/ssh_config
[root@vblnxsrv02 etc]# grep UseDNS ./ssh/sshd_config
#UseDNS yes
So I went with the second, and made made this change:
HTML Code:
[root@vblnxsrv02 etc]# grep UseDNS ./ssh/sshd_config
UseDNS no
That worked *after* a reboot - which of course reset the resolv.conf. So either of the two is sufficient independent of the other, and of course the second (sshd_config) is the only one that is persistent.

Which then led me back to compare with my OL 5.6 installation. It had the same setting as we started with on the 6.3 :

Code:
[root@vblnxsrv03 etc]# grep DNS ./ssh/sshd_config
#UseDNS yes

So at this point I have a workable solution, but no explanation of why it is *different* on the 6.3 machine - why it *needs* to be different. I suspect the answer is in the output of the 'route -n' commands I posted earlier but I'm not enough of a net admin to understand what we're looking at there.


Quote:
Originally Posted by hiten.r.chauhan
If any of the ethernet adapter are configured to use DHCP, DNS, /etc/resolve.conf will be generated by Network Manager when you reboot the VM. In that case you need to comment everything in /etc/resolve.conf every time.
# 7  
Old 05-04-2013
Commenting out everything in /etc/resolv.conf will deny you access to all DNS, pretty much cutting your guest from accessing the internet outside.
Quote:
So at this point I have a workable solution, but no explanation of why it is *different* on the 6.3 machine - why it *needs* to be different. I suspect the answer is in the output of the 'route -n' commands I posted earlier but I'm not enough of a net admin to understand what we're looking at there.
It's showing what IP ranges get routed into what interfaces, and which gateway it uses as a catchall, which seems to be 192.168.56.1.

It's trying to do a DNS lookup on you when you login and failing to do so. Which are you logging into, eth0 or eth1?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

SSH and telnet long delay to recieve prompt.

Hi guys. You'd have to excuse me a bit, as I'm a noob. I really try to avoid asking questions and do research for whatever linux issues that may arise. I am experiencing a long wait for the shell to come up when I ssh or telnet into a Sunos 5.10 environment. It takes 70 seconds to give me... (12 Replies)
Discussion started by: gpenco
12 Replies

2. Solaris

Solaris 9 - SSH 40 Second Delay

I'm having an issue with SSH on a server that hasn't had any configuration changes made on it in a long time. I SSH to the server and it hangs at "debug1: SSH2_MSG_KEXINIT sent" for exactly 40 seconds then connects fine after that pause. Everything I have found points to DNS, but I use host files... (19 Replies)
Discussion started by: kingdbag
19 Replies

3. SCO

Openserver 5.0.5 - logon delay

We have an OpenServer 5.0.5 system that has worked forever, but I'm hearing complaints of logon delays for users now. Normally they would telnet in and the logon screen would pop up, but now it sometimes takes a minute or more, and the user must hit the enter key to get it to appear. Everything... (11 Replies)
Discussion started by: citygov
11 Replies

4. Shell Programming and Scripting

Logon to multiple hosts using ssh hardcode password

Hi im trying to write a script to logon to list of servers with same userID. I have no option/plan to implement ssh-keygen sharing between the systems, so i have written script creating 2 files, file1 holds list of hosts host1 host2 host3 file2 has following script for i in `cat file1`... (1 Reply)
Discussion started by: dreamaix
1 Replies

5. Solaris

Delay after invalid SSH logon?

I am trying to configure a 4 second delay between failed login attempts on SSH. (1 Reply)
Discussion started by: LittleLebowski
1 Replies

6. Linux

delay getting ssh login prompt

Hi, We currently have a problem on a centos server when i try to ssh to it there is a significant delay in getting a login prompt. What would be the steps in troubleshooting this issue? I have try to narrow down a possible network issue but cannot see anything obviously wrong in the routing table,... (4 Replies)
Discussion started by: borderblaster
4 Replies

7. Solaris

ssh logon

Hi I am envountring a problem while I login using ssh on a sun box to a remote box. I use ssh user@server and it takes long time to ask for a password.. does anyone knows the reason behind this? or is there a way that this could be solved Thanks, Antony (8 Replies)
Discussion started by: antointoronto
8 Replies

8. Shell Programming and Scripting

About Logon

hi how can I know abt the details of current user who are logged on and as well as those users who currently have an account but are not logged on? Thanks (1 Reply)
Discussion started by: nokia1100
1 Replies

9. Shell Programming and Scripting

logon to ssh

Hi, I need to run a command remotely, rsh is disabled so I'm trying to do this: ssh myserver ls -lst /work/jsf The problem is that this prompts for a password and I want to do it in a shell script. How can I pass the password without user interaction? I tried "echo mypass | ssh_command" and... (1 Reply)
Discussion started by: rocky_triton
1 Replies

10. UNIX for Dummies Questions & Answers

Can't logon

I stupidly changed the shell of the root user to one that does not exist, and now when I try to lgon it says it cannot find the path to my shell and will not let me proceed any further. Is there any way I can get round this without re-installing the OS? Thanks for any replies. (8 Replies)
Discussion started by: SRP
8 Replies
Login or Register to Ask a Question