No address associated with hostname linux

Server error (-5 — No address associated with hostname)

This seems to be a common problem with 12.04. I’ve done the searches and found various and sundry replies, but I’ve yet to find a solution to my situation. I’ve installed 12.04 32bit on a server box I have in my office, and am using it to get used to Joomla CMS, but I cannot seem to do updates, upgrades with it, nor can I use Aptitude to get new software. The machine will not authenticate against the repos is what I’m thinking. It works fine as long as I have DHCP set up, but when I go to a static IP situation it falls flat. I have networking working perfectly other than this. As far as I can tell, it’s in the nameservers from my ISP not propogating into resolv.conf. Here is my /etc/network/interfaces file contents: :~$ cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).

# The loopback network interface auto lo iface lo inet loopback # The primary network interface \ these stanzas are kept in order #auto eth0 \ for me to easily switch between dhcp #iface eth0 inet dhcp / and static addresses so I can update # / the system from time to time auto eth0 iface eth0 inet static address 192.168.1.130 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-namservers 75.75.75.75 75.75.76.76 192.168.1.1 dns-search hsd1.wa.comcast.net #nameserver 75.75.75.75 \ this data is taken #nameserver 75.75.76.76 \ from resolve.conf #nameserver 192.168.1.1 / while networking with #search hsd1.wa.comcast.net / dhcp instead of static ip 

For the life of me I cannot figure out why this is not working. I’m totally missing something fundamental here I think. The Search stanza is working, and shows up properly inside resolv.conf:

Источник

CentOS 6.7: ‘No address associated with name’ as ‘hostname —fqdn’ output

I have CentOS 6.7 x64 (Final) Desktop standard installation, on a dedicated pc (not on a VM), Linux version 2.6.32-573.el6.x86_64 (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ). I’ve configured my /etc/sysconfig/network-scripts/ifcfg-eth0 file as follow:

DEVICE=eth0 HWADDR=A4:5D:36:66:39:82 TYPE=Ethernet UUID=36d492f3-cf76-4472-b8f1-b855d4af724d ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none IPADDR=192.168.1.2 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=8.8.8.8 DNS2=8.8.4.4 , 
chkconfig network on service network start 
192.168.1.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.2 srvr1.cloud.priv , 

As result, I’ve got that I can go on the web (I’m on with this configuration by now), but when I run:

hostname: No address associated with name 

instead of a correct FQDN response. I would need to know how to solve this situation and get the right output. PS: I don’t know if it has something to do with this problem, but my modem-router has the DHCP activated and the provider does not allow to disable it (or better, it can not be disabled by the user with official versions of the firmware).

Читайте также:  Hp laserjet m1132 mfp драйвер линукс

2 Answers 2

You can set the hostname using hostname command hostname man page

From the man page, «Hostname is the program that is used to either set or display the current host, domain or node name of the system. These names are used by many of the networking programs to identify the machine. The domain name is also used by NIS/YP.

You can’t change the FQDN (as returned by hostname —fqdn) or the DNS domain name (as returned by dnsdomainname) with this command. The FQDN of the system is the name that the resolver(3) returns for the host name. Technically: The FQDN is the name gethostbyname(2) returns for the host name returned by gethostname(2). The DNS domain name is the part after the first dot.

Therefore it depends on the configuration (usually in /etc/host.conf) how you can change it. Usually (if the hosts file is parsed before DNS or NIS) you can change it in /etc/hosts.

If a machine has multiple network interfaces/addresses or is used in a mobile environment, then it may either have multiple FQDNs/domain names or none at all. Therefore avoid using hostname —fqdn, hostname —domain and dnsdomainname. hostname —ip-address is subject to the same limitations so it should be avoided as well.»

Add to your /etc/hosts a reference to 127.0.0.1 with the fqdn as first row, and it should work.

EDIT: I noticed you changed the 127.0.0.1 with the IP of the machine. You always must have 127.0.0.1 in your /etc/hosts, as this indicates the loopback interface which is used by different applications and services.

Источник

How to change hostname with domainname on Debian/Ubuntu

Although it seems to be an FAQ, but I had never been able find a proper way to change hostname with domainname on Debian/Ubuntu. First of all, many «answers» or writings are just wrong by putting hostname with domainname (FQDN) into /etc/hostname , like this, this and this, because The Debian reference says the hostname should not use the FQDN:

3.5.5. The hostname The kernel maintains the system hostname. The init script in runlevel S which is symlinked to «/etc/init.d/hostname.sh» sets the system hostname at boot time (using the hostname command) to the name stored in «/etc/hostname«. This file should contain only the system hostname, not a fully qualified domain name.

» /etc/hosts Usually, this is where one sets the domain name by aliasing the host name to the FQDN.» and «A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file.»

$ cat /etc/hostname coral $ head -1 /etc/hosts 127.0.0.1 coral.my.domain.org localhost $ dnsdomainname ht.home $ cat /etc/resolv.conf domain ht.home search ht.home nameserver 192.168.0.1 # after I change it to -- $ cat /etc/resolv.conf # Fixed resolv.conf file domain my.domain.org search my.domain.org nameserver 192.168.0.1 # everything just gone wrong -- $ dnsdomainname dnsdomainname: No address associated with hostname $ hostname -f hostname: No address associated with hostname $ hostname -d hostname: No address associated with hostname 

Update I did a trace on hostname -f , and it seems the «No address associated with hostname» error comes from libresolv.so :

$ strace -o /tmp/strace.log hostname -f hostname: No address associated with hostname $ grep -E 'openat|close|No address' /tmp/strace.log openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 close(3) = 0 close(3) = 0 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 close(3) = 0 close(3) = 0 close(3) = 0 write(2, "No address associated with hostn". 35) = 35 
$ uname -rm 5.10.0-6-amd64 x86_64 $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux bullseye/sid Release: testing Codename: bullseye 

Источник

Читайте также:  Linux mint zen kernel

How to fix «-5 No address associated with hostname error» while updating?

I recently encountered this issue on my Pi (running headless — no GUI easily available to configure it) — it turned out that I had mucked up editing the /etc/netowrk/interfaces file (based on this). So others encountering similar issue may want to check their network configuration.

5 Answers 5

This has been a long term problem with apt, and Ubuntu has never fixed it. Apt doesn’t seem to use the same DNS servers that the internal system does — ‘ping ‘ returns a correct IP address. Apt-get claims that the hostname isn’t found.

«Something wicked happened resolving ‘extras.ubuntu.com:http» (Which sounds, somewhat, like it’s trying to resolve a .com:http domain, which isn’t a valid TLD)

To modify /etc/hosts, use the following:

Ping each of the names that are failing to resolve — PING extras.ubuntu.com (91.189.88.33) 56(84) bytes of data.

Use your favourite editor, such as vi — ‘sudo vi /etc/hosts’.

Scroll down to the end, and add a line such as the following

91.189.88.33 extras.ubuntu.com (with the appropriate name and IP address. IP is first) 

Save the file, then re-run apt-get. Once you’ve run apt-get, edit /etc/hosts again, and comment out the line with a hash mark — #. (or delete it entirely)

#91.189.88.33 extras.ubuntu.com 

The reason to comment out/delete the line is that Ubuntu apparently shuffles their servers around randomly, and that might not be the correct IP the next time.

http://archive.scrapy.org/ seems like a perfectly working Ubuntu mirror, so while I’d usually ask you to provide information about what Software Sources are configured, it looks like this problem is either specific to your Ubuntu system, or was a short-lived problem with (or accessing) your DNS server. (The problem is not actually with the server at http://archive.scrapy.org/ itself, though it may have been due to a configuration problem for that server’s DNS record.)

Читайте также:  Проверить аппаратное ускорение linux

This is, of course, assuming that you have Internet access on the affected machine. If you don’t, then you need to connect to the Internet before updating. It’s quite normal to see errors like that if you don’t have Internet access, or if your Internet connection itself is interrupted.

The problem may have gone away by itself. If not, you can try a different DNS server ( 8.8.8.8 and 8.8.4.4 are good public DNS servers operated by Google), and/or try a different mirror for updating Ubuntu.

it’s a short-lived problem when I update with apt-get update the error goes away. Will try google dns server.

When I got this error, I put the IP address of the Ubuntu mirror in /etc/hosts. No more error. (When I queried the mirror in DNS there was never a problem or delay in response, so I’m not sure of the root cause of the error.)

That hostname resolves to an Amazon EC2 instance. It’s possible there was some transient issue which is now solved as it resolves fine here. Does it now work for you?

I got the «No address associated with hostname» message with Centos 6.5 when I said yes to IPv6 and apparently the ISP DHCP didn’t have it. It solved the problem when I commented out the line in /etc/hosts :

# ::1 localhost6.localdomain6 localhost6 

Источник

Оцените статью
Adblock
detector