On 01/04/15 15:27, waben...@gmail.com wrote:
Am Sonntag, 04.01.2015 um 14:06
schrieb Urs Schütz <u.sch...@bluewin.ch>:

Hi list

While hunting down slow startx times (12-16s instead the usual 2-5s)
I found that "hostname -f" tries to resolve the hostname. This is a
slow process (timeout?):

Normally this is a fast process. See my results below.

urs@cadd ~ $ time hostname -v
gethostname()=`cadd'
cadd

real    0m0.001s
user    0m0.000s
sys     0m0.001s

user@puter ~ $ time hostname -v
gethostname()=`puter'
puter

real    0m0.003s
user    0m0.000s
sys     0m0.000s

urs@cadd ~ $ time hostname -v -f
gethostname()=`cadd'
Resolving `cadd' ...
Result: h_name=`cadd'
Result: h_addr_list=`127.0.0.1'
                        ^^^^^^^^^
Does your computer only have an IP address for your localhost?

cadd

real    0m10.011s
user    0m0.000s
sys     0m0.001s

user@puter ~ $ time hostname -v -f
gethostname()=`puter'
Resolving `puter' ...
Result: h_name=`puter.local'
Result: h_aliases=`puter'
Result: h_addr_list=`192.168.44.32'
puter.local

real    0m0.005s
user    0m0.003s
sys     0m0.003s

What is the recommended way for /etc/hosts? I'm at a simple home
network, behind a NAT cable modem, and do not have a dns domain name.

What is the content of your /etc/hosts file?
This is my hostfile:

127.0.0.1       localhost
::1             localhost
192.168.44.32   puter.local     puter

Regards
wabe



Hi Wabe

IP changes dynamically, is assigned by Networkmanager with dhclient use flag. I changed /etc/hosts as Mick/Michael pointed out in an other reply, and this solved the slow response. Here the relevant part of the corrected, working /etc/hosts:

# IPv4 and IPv6 localhost aliases
127.0.0.1       cadd.homeLAN localhost
::1             cadd.homeLAN localhost cadd

Thanks for your time looking into it and the hints.
Urs

Reply via email to