Workaround for Ubuntu to ping IP but not to ping host domain name

Source: Internet
Author: User
Tags naming convention domain name server nslookup

-------------------------------------------------------------------------------

-------------------------------------------------------------------------------

Vi/etc/nsswitch.conf

Hosts:files DNS

Networks:files

Change to:

Hosts:files DNS wins

Networks:files

If not the same, in the hosts: the original line after the addition of a wins on the line.

-------------------------------------------------------------------------------

-------------------------------------------------------------------------------

Recently encountered a problem: Ping a domain name domain_name when prompted "Ping:unknown host Domain_Name", but the ping domain corresponding IP address (using host or nslookup get) But no problem.

So-name, Real-name && linker-name
The Real-name naming convention for the Linux shared object is: libname.so.x.y.z . where x represents the primary (Major) version number, the libraries of different major version numbers are incompatible, and Y represents the secondary (Minor) version number, which represents the library's incremental upgrade, the library with the higher minor version number of the Libraries backward compatible (backwards Compatible), and the lower minor version number of the libraries; Z means the publication ( Release) version number, indicating some of the library corrections, performance improvements, and so on.

The so-name of the shared library is the minor version number and the release version number on the basis of the real-name. So-name files are generally a soft link to a corresponding real-name file.

The linker-name of a shared library is the search name for the application link, usually a soft link to the so-name.

When you run Ldconfig, all soft links are updated so that they point to the latest version of the shared library.

LIBC && glibc
The standard C library, which implements the ISO C standard, contains a set of functions that all C programs can use. LIBC are often used as shorthand for the standard C library.

LIBC is also used as the implementation name for a standard C library. In the early the 1890s, developers of the Linux kernel isolated glibc 1.x (forked glibc) and called it "Linux libc", or libc. Linux libc mainly released 2, 3, 4, 54 versions.

In 1997, the FSF released GLIBC 2.0, which has better support for POSIX standards and better code portability. As a result, all major Linux distributions are now using GLIBC.

The last so-name of Linux libc is libc.so.5. So later the GLIBC 2.x used the so-name is libc.so.6.

Web Information Service (Network Information Service, NIS)
NIS, also known as YP (Yellow Pages), is a client/server system based on RPC (Remote Procedure call Protocol) that allows a set of machines in an NIS domain to share a range of configuration files. In an NIS environment, there are three types of hosts for the primary server, the slave server, and the client. The role of the server is to act as a central database for host configuration information. The authoritative copy of this information is kept on the primary server, and the slave server is a redundant copy of the information. Clients rely on the server to provide this information to them.

DNS Resolver
A domain name consists of one or more tags (label), separated by dots. The right-most label represents the top-level domain (top-level domain,tld). DNS (domain Name System) is a core service of the Internet, a distributed hierarchical system that maps domain names and IP addresses to each other. DNS implements a hierarchical domain name space by allowing a domain name server to delegate a subset of its domain name resolution services to a child server. DNS consists of the parser (Resolver) and the domain name server two parts.

The client for the DNS system is known as the DNS resolver (DNS Resolver). On a Linux system, the parser is not referring to an application, but rather to the parser library. This library contains a series of functions in the standard C library, the main two functions are the gethostbyname() and gethostbyaddr() . DNS parsers can be configured to find /etc/hosts information in, query DNS servers, or use configuration information from a network information services system. libc use /etc/host.conf configuration files; glibc use /etc/nsswitch.conf configuration files.

  /etc/host.confThe main options are: (1) Order Specifies the lookup order for domain name resolution, where hosts represents a /etc/hosts configuration file, bind represents a query DNS server, and NIS represents the configuration information for querying NIS systems. (2) Multi [on|off] specifies /etc/hosts whether the host can have more than one IP address.

  /etc/nsswitch.confIs the configuration file for the name Services switch (Name Service switch), where the database name corresponding to the DNS resolver is the hosts:. Its main options are: (1) DNS representation using DNS resolution address (2) files represents the use /etc/hosts and /etc/network configuration file (3) NIS or nisplus.

The DNS server is configured in/etc/resolv.conf.

Ping
The ping command is used to test whether a host on the network can connect. The ping command sends an ICMP (Internet Control message Protocol) Echo request message to the target host and then waits for the target host to respond, while calculating the round trip time (round-trip Time,rtt) of the message from the source host to the destination host.

Problem solving
First, you can ping the IP address of the domain name, it is obviously impossible for the server to disable the ping service (using firewalls, etc.). Host and Nslookup can return the IP address corresponding to the domain name, then /etc/resolv.conf the DNS setting in is also no problem.

In fact, when using the ping command to process a domain name, the gethostbyname() corresponding host information (participating in the source code) is returned using the function, while host and nslookup are directly used /etc/resolv.conf DNS servers. Therefore, you need to review /etc/nsswitch.conf the hosts in: whether the database has the DNS option turned on.

Workaround for Ubuntu to ping IP but not to ping host domain name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.