Operating System - HP-UX
1833082 Members
2915 Online
110050 Solutions
New Discussion

hang:> netstat -a | grep <service_port>

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

hang:> netstat -a | grep <service_port>

netstat -an | grep
works fine,
but
netstat -a | grep
hangs.. well, ctrl-c breaks, but the command never returns..

What have I messed up?
Later,
Bill
It works for me (tm)
29 REPLIES 29
Heiner E. Lennackers
Respected Contributor

Re: hang:> netstat -a | grep <service_port>

Hi,

the looks like a name resultion error.
Does your name server run in both direction? ip->name/ name->ip ?
Is your /etc/hosts file readable? is your /etc/services file readable?

Do you use NIS? Are the nis hosts-map and the services-map accessable?

Heiner
if this makes any sense to you, you have a BIG problem
Robin Wakefield
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Bill,

Are you sure it's not just DNS hanging. Does a

netstat -a

return quickly then?

Rgds, Robin
Dirk Wiedemann
Respected Contributor

Re: hang:> netstat -a | grep <service_port>

Hello Bill,

if your system has various lan cards try to find out if a specific interface has problems with "netstat -i"
If it is a cluster with a privat lan for heartbeat (e.g. crossover cable on build in ethernet) this could be the problem.
try the following:
in file /etc/hosts add under the localhost line a new line with the entry
0.0.0.0 none

regards
Dirk
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

in fact ping is even taking ages to return:

see attachment for various commands.

10 points for fix only!

Thanks,
Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

netstat -an returns almost immediately.
netstat -a never returns (well I never waited)
ping take 20secs before returning first reply
(even when pinging itself)
nslookups from FILES are immediate.


ll /etc/services
-r--r--r-- 1 bin bin 13018 Sep 9 11:22 /etc/services

# cat /etc/rc.config.d/netconf
HOSTNAME="test02"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=xx.29.144.167
SUBNET_MASK[0]=255.255.255.0
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0
GATED=0
GATED_ARGS=""
RDPD=0
RARP=0
ROUTE_GATEWAY[0]=xx.29.144.100
ROUTE_COUNT[0]=1
ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""

It works for me (tm)
Dietmar Konermann
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Bill,
is named running on that system? It may be be asked 1st by the resolver, even if nsswitch.conf tell another story.

If yes, you should setup test02 on that DNS server also. If you don't need it, stop it for a test.

Regards...
Dietmar
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

To note: (although I don't think it's an issue since I use files locally):

Microsoft(R) Winders NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.

C:\>nslookup test02.zko.xx.com
Server: janus.grenoble.xx.com
Address: xx.128.136.107

Non-authoritative answer:
Name: test02.zko.xx.com
Addresses: xx.29.144.71, xx.29.144.167
It works for me (tm)
Dirk Wiedemann
Respected Contributor

Re: hang:> netstat -a | grep <service_port>

After all it looks like an resolv problem. Maybe ping tries to resolv the hostname with context.
Add in the /etc/hosts file an alias systemname.domainname and ping again.
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

named wasn't running.
attached is a top list.
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

good try Dirk, but it's still the same..

Bill
It works for me (tm)
U.SivaKumar_2
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Hi,
I want debugging info more.
Does this ping problem arise when you ping to
your own network card ip address ?.
Also In addition , I request you to use traceroute utility and give me the output.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

ping xx.29.144.167

has the exact same effect, so I guess it's not name res.


Bill
It works for me (tm)
Dietmar Konermann
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Bill,

please compile and run this proggie with test02 as arg:

#include
#include
#include
#include
#include
#include
#include

#include
#include
#include

#include
#include

main(argc, argv)
int argc;
char *argv[];
{
char *name = NULL;
register struct hostent *host;

name = argv[1];

host = gethostbyname(name);

printf("XXX %x\n",host);
printf("Hostname : %s\n",host->h_name);
printf("Aliases : %s\n",*host->h_aliases);
printf("AddressType : %d\n",host->h_addrtype);
printf("AddressLength : %d\n",host->h_length);
printf("Addresslist : %x\n",*host->h_addr_list);
}

If it also hangs... please use tusc -t "" ... to trace the syscalls.

Regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Dirk Wiedemann
Respected Contributor

Re: hang:> netstat -a | grep <service_port>

Interesting problem.
Please check a nslookup to hostname.domain. Use the system in this case files or dns?
Anyway the dns tables should be updated (two ip adresses for one system with only one lancard? Is this an old entry which has not been removed after changing the ip in the past?).

Dirk
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Here you are Dieter:

test02:root # ./a.out test02
XXX 400031cc
Hostname : test02
Aliases : test02.zko.xx.com
AddressType : 2
AddressLength : 4
Addresslist : 40003afc

It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Here you are Dieter:

test02:root # ./a.out test02
XXX 400031cc
Hostname : test02
Aliases : test02.zko.xx.com
AddressType : 2
AddressLength : 4
Addresslist : 40003afc

returned immediately.
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

U.SivaKumar :
there's a traceroute in the first attachment - I see nothing wrong with this.And - yes, it happens with lan0 (netstat -i) IP as well as server hostname.

Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

from print_manifest:

System Information

The following parameters were set on the configured target:
hostname: test02
IP address: xx.29.144.167
subnet mask: 255.255.255.0
gateway IP address: xx.29.144.100
time zone: EST5EDT
DNS domain name: zko.xx.com
DNS IP address: xx.30.0.20
NIS domain name: zko.xx.com


System Hardware

Model: 9000/800/A500-7X
Main Memory: 2048 MB
Processors: 2
OS mode: 64 bit
LAN hardware ID: 0x00306E2C742E
Software ID: 802920606
Keyboard Language: Not_Applicable
It works for me (tm)
U.SivaKumar_2
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Hi,
Restart inetd and see whether the problem perisists.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

restarting inetd didn't help - but neither did rebooting the box for that matter.. uptime 1 minute.
It works for me (tm)
U.SivaKumar_2
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Hi,
Bill , I found out the culprit . /etc/resolv.conf

I simulated it in linux. Just move /etc/resolv.conf to /etc/res.conf for sometime . give netstat -a
all problems is gone.

I think the problem is because of unreachable name server in resolv.conf. Even a single server unreachable among say four servers may
cause this.


regards,
U.SivaKumar
Innovations are made when conventions are broken
U.SivaKumar_2
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Hi,
Bill , Found the real culprit.
/etc/nsswitch.conf
hosts: files dns
If the above setup is there with resolv.conf
our problem persists.
Now,
/etc/nsswitch.conf
hosts: files
Now the problem disappears.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Bill McNAMARA_1
Honored Contributor

Re: hang:> netstat -a | grep <service_port>

Okay, this is strange - it seems the problem has gone -

these are the only things I changed since the last reboot:

in /etc/hosts:
added FQDN as alias:

xx.29.144.167 test02 test02.zko.xx.com

in /etc/rc.config.d/namesvrs

NIS_CLIENT="0"


before this (after reboot) problem occurred.

So I guess Dieter get's the bunny????

Any comments?

Bill
It works for me (tm)
Dirk Wiedemann
Respected Contributor

Re: hang:> netstat -a | grep <service_port>

Hi Bill,

hmmm, don't know what's the real reason. But my suggest with FQDN couldn't be it because it works immediatly or even not. So all I can say, the bunny is not for me.
regards
Dirk