Sponsored Content
Special Forums IP Networking DNS problem : ping doesn't recognize hostname Post 302985265 by MadeInGermany on Monday 7th of November 2016 05:04:48 PM
Old 11-07-2016
Quote:
Originally Posted by evanbooyens
Remember that ping often uses gethostbyname system/kernel call where traceroute often uses the actual DNS lookup. You can also easily test whether the entries are indeed in DNS by using nslookup or dig
Yes, ping (and traceroute) use gethostbyname() for resolving hostnames. And gethostbyname() goes to /etc/nsswitch.conf that must have the line
Code:
hosts: files dns

to consider first /etc/hosts then DNS.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Doesn't recognize the mv command

I'm nearly finished my program i've got everything in place and than when i run it it comes back with the reply mv: command not found. This is the code that seems to be causing the problem. elif then echo "There are more than one '$1' files in the system." echo "Please... (2 Replies)
Discussion started by: zoolz
2 Replies

2. HP-UX

UX 11iV2 - No ping by hostname

Hi. I just installed the HP-UX 11i V2. I have problems with CDE - it is inoperative (after logon there is a message box: messaging system failure - or something like that, it asks to check /etc/hosts and network settings). nslookup works by hostname and IP, hostname shown the correct... (7 Replies)
Discussion started by: netwalker
7 Replies

3. HP-UX

HP-UX 11.11: X doesn't recognize mouse and keyboard

hi folks, i've got a blank hp visualize C3000 workstation and installed HP-UX 11.11. When I want to start X, I get the following error message: # X Fatal server error: Couldn't open X pointer device! Is one attached? I've connected an mouse and a keyboard with an usb/ps2 connector.... (5 Replies)
Discussion started by: grisu
5 Replies

4. Solaris

cannot ping by hostname

Hi All, My current setup is: 1x Windows Server (Windows 2000 server) 1x Unix Server 2x Windows machine 3x Unix Terminals (Hostnames = A, B and C) Problem The problem iam having is Unix terminal C cannot be ping across by Unix terminal A or B or Unix server by using the hostname. Unix... (1 Reply)
Discussion started by: tlee
1 Replies

5. Solaris

Can't ping using hostname on Solaris 10

I recently installed Solaris 10 on my Sun workstation. I cannot ping using hostname from another computer on the same network. But I can ping using the IP address. Also I can ping other systems using their hostnames. Can anyone give some information regarding how to resolve this issue. (4 Replies)
Discussion started by: alpha123
4 Replies

6. AIX

Ping by hostname

Hello everyone I have a partition with a problem with ping. If I do a ping by ip for example ping 1.1.1.1 I got no problem but If I ping by hostname for example ping partition1 take almost a minute to respond me. I have Aix 5.3 and I have another 19 partitions with no problem. The only... (5 Replies)
Discussion started by: lo-lp-kl
5 Replies

7. UNIX for Advanced & Expert Users

ping by hostname not working

anyone ever seen this problem: I can ping the server by IP address but I can't by hostname. nslookup is working and dns query is ok. # nslookup mwxnsb24 Server: 10.11.49.206 Address: 10.11.49.206#53 Name: mwxnsb24 Address: 10.10.58.175 # ping... (8 Replies)
Discussion started by: linuxgeek
8 Replies

8. Shell Programming and Scripting

Expect doesn't recognize a password prompt

Hi. Here is beginning of my script #!/usr/local/bin/expect -- set timeout 15 spawn /usr/local/account.sh -n modify expect "Password:" {send "mypassword\r"} But due to some terminal control sequences (or something else, dunno exactly) my password prompt is looking like this: and expect... (3 Replies)
Discussion started by: urello
3 Replies

9. Shell Programming and Scripting

Value of variable is NULL, but test doesn't seem to recognize

Hello, Unix-forums! My problem: read -p "Enter any number, please" number sleep 1 echo $number | tr -d 0-9 test -z $number && echo "Thank you" || echo "This is not a number"Test always displays "This is not a number". It doesn't matter if I entered a or 1. But if I order echo... (2 Replies)
Discussion started by: intelinside
2 Replies
gethostbyname(3)					     Library Functions Manual						  gethostbyname(3)

NAME
gethostbyname, gethostbyname_r - Get a network host entry by name LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <netdb.h> struct hostent *gethostbyname( const char *name); [Tru64 UNIX] The following function is supported in order to maintain backward compatibility with previous versions of the operating sys- tem. You should not use it in new designs. int gethostbyname_r( const char *name, struct hostent *hptr, struct hos- tent_data *hdptr); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: gethostbyname(): XNS4.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the official network name or alias. [Tru64 UNIX] For gethostbyname_r() only, this points to the hostent structure. The netdb.h header file defines hostent structure. [Tru64 UNIX] For gethostbyname_r() only, this is data for hosts database. The netdb.h header file defines hostent_data structure. DESCRIPTION
The gethostbyname() function returns a pointer to a structure of type hostent. Its members specify data obtained from either the local /etc/hosts file or one of the files distributed by DNS/BIND or NIS. To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. The netdb.h header file defines the hostent structure. If using DNS/BIND, the information is obtained from a name server specified in the /etc/resolv.conf file. If the name parameter does not contain a dot "." and you are using DNS/BIND, the gethostbyname() function checks whether the environment variable HOSTALIASES is set. If set, it first searches the file named by HOSTALIASES for an alias matching the name parameter. The alias file has the following format: name1 name2 The alias name. This name cannot include dots. The host name used by DNS/BIND to look up the host information. The hosts database must be distributed by DNS/BIND. NOTES
The gethostbyname() function returns a pointer to thread-specific data. Subsequent calls to this or a related function from the same thread overwrite this data. [Tru64 UNIX] The gethostbyname_r() function is an obsolete reentrant version of the gethostbyname() function. It is supported in order to maintain backward compatibility with previous versions of the operating system and should not be used in new designs. Note that you must zero-fill the hdptr structure before its first access by the gethostbyname_r() function. RETURN VALUES
Upon successful completion, the gethostbyname() function returns a pointer to a hostent structure. If it reaches the end of the network host name database, it returns a null pointer. [Tru64 UNIX] Upon successful completion, the gethostbyname_r() function stores the hostent structure in the location pointed to by hptr, and returns a value of 0 (zero). Upon failure, it returns a value of -1. ERRORS
If the gethostbyname() or gethostbyname_r() function call fails, h_errno is set to one of the following the values: Host is unknown. The server recognized the request and the name, but no address is available for the name. Another type of name server request may be success- ful. An unexpected server failure occurred. This is a nonrecoverable error. A transient error occurred, for example, the server did not respond. A retry at some later time may be successful. [Tru64 UNIX] If any of the following conditions occurs, the gethostbyaddr_r() function sets errno to the corresponding value: The name, hptr, or hdptr is invalid. FILES
The Internet network host name database. Each record in the file occupies a single line and has three fields consisting of the host address, official host name, and aliases. The resolver configuration file. The database service selection configuration file. RELATED INFORMATION
Functions: endhostent(3), gethostbyaddr(3), sethostent(3). Files: hostname(5), resolv.conf(4), svc.conf(4). Networks: bind_intro(7), nis_intro(7). Standards: standards(5) delim off gethostbyname(3)
All times are GMT -4. The time now is 07:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy