Questions tagged [hosts]

An /etc/ file that lists the hosts on a network (/etc/hosts ).

The file; /etc/hosts

Static hostnames are locally defined hostname-to-IP mappings located in this file, and takes precedence over DNS.

related files;

  1. /etc/hosts.allow
  2. /etc/hosts.deny
  3. /etc/resolve.conf (the local dns file)

Recommended reading; https://help.ubuntu.com/10.04/serverguide/C/network-configuration.html - near the bottom, under Name Resolution

210 questions
162
votes
9 answers

After modifying /etc/hosts which service needs to be restarted?

After modifying /etc/hosts, which service(s) need(s) to be restarted for the change to take effect?
Ashish Karpe
  • 2,557
  • 3
  • 20
  • 24
43
votes
11 answers

Why is the /etc/hosts file not working?

I have been having problems with this for a while and have tried everything I know, so I figured it was finally time to ask for some help. Any edit I make to /etc/hosts just doesn't work. Example: julian@ifrit:~$ cat /etc/hosts 127.0.0.1 …
31
votes
3 answers

Why is my /etc/hosts file not queried when nslookup tries to resolve an address?

I have a couple of local domains resolved to 127.0.0.1 in my /etc/hosts file. And it was all alright for a period of time but now when I run: nslookup test.local It results in: Server: 192.168.1.3 Address: 192.168.1.3#53 ** server can't…
Mehran
  • 1,827
26
votes
3 answers

Changing System name

I am given an old Ubuntu working system and the previous user had everything on his name so started turning it to my name as typing his name everywhere was bugging me. I tried: $ usermod -l hussain darhamid This turned the darhamid@darhamid:$ into…
19
votes
6 answers

How to SCP a file from Mac -> Ubuntu VirtualBox?

I have a Mac (OS X) and a VirtualBox running Ubuntu. I want to SCP a 500mb file from the Mac to the VirtualBox. How do I do this? (Probably something to do with /etc/hosts?)
19
votes
3 answers

How to edit hosts.deny and hosts.allow?

I want to block some hosts in Ubuntu, so how could I edit hosts.deny file to block some hosts like example.com. And one more thing I have installed dnsmasq in Ubuntu, so can I check the entries of the dns's cached by dnsmasq? If yes then how? Thanks…
19
votes
3 answers

how to block specific domains in hosts file?

I know hot to block single tumblr blog with 127.0.1.1 something.tumblr.com but I want to block entire tumblr. I tried 127.0.1.1 tumblr.com but it's not working. Is there a way to do this?
18
votes
1 answer

Why does my name resolution hit the DNS even with a hosts file entry?

I'm running Ubuntu 10.04.2 LTS Desktop. Being a web developer, naturally I created a "me.com" in my /etc/hosts file. Unfortunately, my name resolution is going out to the DNS before first checking my local hosts entry and I can't figure out why. The…
Volomike
  • 2,305
18
votes
3 answers

ubuntu server not resolving LAN hostnames

Bit stuck here. I have 2 machines that cannot resolve LAN hostsnames, unless there are specific entries in /etc/hosts But other machines on the LAN can resolves hostnames. My LAN: 1 x Cisco router runnning DD-WRT v24-sp2 with DNSMasq enabled.…
teracow
  • 283
16
votes
2 answers

/etc/hosts not working

I populated /etc/hosts with device names and IP addresses. For example: chassisOne 10.0.0.1 chassisTwo 10.0.0.2 . . . etcetera. I am able to ping the IP address of both chassisOne and chassisTwo. Pinging the hostname returns: ping:…
15
votes
7 answers

/etc/hosts modification does not work properly. What to do?

I have added these lines to the hosts file: 127.0.0.1 localhost adobe.com 127.0.0.1 adobe.com It works perfectly on windows. But in Ubuntu 11.10 when I try to access it using Firefox the website is opening. Google chrome though supporting…
14
votes
0 answers

sudo: unable to resolve host (name already added to /etc/hosts)

Whenever I use sudo, I get this: sudo: unable to resolve host dave00-G31M-ES2L Here is my /etc/hosts: dave00@dave00-G31M-ES2L:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 dave00-G31M-ES2 # The following lines are desirable for IPv6 capable…
13
votes
1 answer

What are the default settings for '/etc/hosts' and '/etc/hostname'?

I'm using Ubuntu 16.04. I recently started learning DevOps and got a bit crazy with my /etc/hosts and /etc/hostname files. In my frantic attempt to spin up a couple of servers from my local machine I lost track of the default settings, and was just…
user598599
13
votes
5 answers

Permanently store addresses when using SSH

I have a few remote servers which I connect to through the terminal. The servers don't have a domain, only an IP address which is hard to remember when I got a few of them. Is there a way to permanently store values in the terminal, so that I can do…
theusual
  • 133
13
votes
7 answers

Is there a GUI for /etc/hosts that I can use?

I want to be able to easily and frequently edit my hosts file from a quick GUI. Any one know of one that exists? Thanks!
Nicky Hajal
  • 333
  • 1
  • 2
  • 9
1
2 3
13 14