/etc/hosts is the configuration file with locally known mappings between domain name and ip address.

learn more… | top users | synonyms

46
votes
6answers
15k views

Can I create a user-specific hosts file to complement /etc/hosts?

Is it possible to add a list of hosts that are only specific to a certain user? Perhaps a user-specific hosts file? This mechanism should also complement the entries in the /etc/hosts file.
11
votes
2answers
922 views

Two different /etc/hosts depending upon the time

I am trying to make a productivity suite for myself. My first goal is to block Facebook, Gmail and Stackexchange from 0900 to 1600. As of now, I have edited my /etc/hosts and added 0.0.0.0 ...
11
votes
1answer
3k views

How can I override the /etc/hosts file at user level? [duplicate]

Possible Duplicate: Can I create a user-specific hosts file to complement /etc/hosts? In short: I would like to know if it is possible to get a ~/hosts file that could override the ...
9
votes
1answer
856 views

Why does SSH not consult /etc/hosts?

I'm administrating a networked environment where the users authenticate over NIS. All machines can be used to SSH into the server but one. On the machine in question, I get the message ssh: connect ...
8
votes
5answers
862 views

Host lookup that respects /etc/hosts

Utilities like host and dig let you see the IP address corresponding to the host name. There is also the getent utility that can be used to query /etc/hosts or other NSS databases. I am looking for ...
7
votes
1answer
4k views

Wildcard in /etc/hosts file

It seems that wildcards are not supported in the /etc/hosts file. What is the best solution for me to resolve all *.local domains to localhost?
6
votes
2answers
12k views

Format of /etc/hosts on Linux (different from Windows?)

Pasted below this question is a sample of a /etc/hosts file from a Linux (CentOS) and a Windows machine. The Linux file has two tabbed entries after the IP address (that is localhost.localdomain ...
5
votes
2answers
4k views

/etc/hosts file refer to another configuration file

How can I get the /etc/hosts file to refer to another configuration file for it's list of hosts? Example /etc/hosts: ## My Hosts 127.0.0.1 localhost 255.255.255.255 broadcasthost #Other ...
5
votes
3answers
2k views

Maintaining `/etc/hosts` for hosts on DHCP

On my local DHCP network I have different PC's that I need to access remotely. Problem is that their IP's change. Sometimes I plug my laptop and netbook into other people's DHCP networks. My current ...
5
votes
2answers
2k views

Hosts file: Is it incorrect to have the same IP address on multiple lines?

For a while I have been formatting my hosts file like this. Notice the same ip on two lines: e.f.g.e foo.mydevsite.com e.f.g.e foo.myOtherDevSite.com I read recently that aliases are supposed to ...
4
votes
2answers
4k views

Creating alias to domain name with /etc/hosts

I have a domain setup to point to my LAN's external IP using dynamic DNS, because my external IP address changes frequently. However, I want to create an alias to this host, so I can access it with ...
4
votes
1answer
146 views

Alternative to DNS for internal servers

I am setting up my first network at work. All the servers are running CentOS 6.3 and have statically assigned IP addresses. For example: server1 192.168.0.101 server2 192.168.0.102 I want to be ...
3
votes
3answers
2k views

/etc/hosts file syntax. Is it possible to set one IP for a zone?

I would like to set one IP for a zone (livejournal.com) currently I am having to directly type the subdomains like: 11.11.11.11 sub1.livejournal.com 11.11.11.11 sub2.livejournal.com 11.11.11.11 ...
3
votes
3answers
628 views

How does /etc/hosts match work?

I'm curious about how /etc/hosts entries match works in Linux vs others *nix platform (if there is any difference). In particular I would be interested to understand if "match time" is proportional ...
3
votes
1answer
83 views

tcpdump command works only on local ip

I am trying to capture some IP packets in my personal LAN with tcpdump, through the command tcpdump -A -i eth0 'tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) ...
3
votes
1answer
3k views

Using /etc/hosts or iptables to redirect site to https:// version

I'd like to have my system automatically take me to https://facebook.com even if I put http://facebook.com into my browser. I can get /etc/hosts to redirect to me to different domains, but it seems ...
3
votes
2answers
7k views

How can I configure /etc/hosts file to point to apache web server?

I have installed apache web server and I need to point 127.1.1.1 with alias (www.someaddress.lan) to local apache. What is the proper way to do it? How to point someaddress.lan to default apache page ...
3
votes
2answers
11k views

/etc/hosts for Debian

I was trying to get a perl script that contacts a PostgreSQL database to work on a server. This script was mysteriously failing. I then realised that localhost was not in the /etc/hosts file. The ...
3
votes
1answer
84 views

date format in /etc/hosts.allow

I have following line in my /etc/hosts.allow sshd: 1.2.3.4 : spawn (echo `date` ALLOWED from %a >> /var/log/%d.log) & The problem is, the date command prints time in the standard format, ...
3
votes
1answer
87 views

How to test /etc/hosts

What's the best way to confirm that your /etc/hosts file is mapping a hostname to the correct IP address? Using a tool like dig queries an external DNS directly, bypassing the hosts file.
3
votes
1answer
87 views

Blocking Websites with /etc/hosts

There's a website, www.example.com, that I tried to block myself from accessing because it wastes too much of my time. So I configured my /etc/hosts file. I added the following lines, to block the ...
3
votes
2answers
809 views

Wget - Mirroring a full website with requisites on differents hosts

I am trying to make a full static copy of a wordpress website with wget to be browsed without any network connection (all links and images must be converted). The different requisites for the pages ...
3
votes
2answers
547 views

Local DNS rewrite from host to host for web requests

Is there some de-facto way for rewriting certain hostnames to other ones? Something like /etc/hosts for host to host instead of ip to host. Is this possible or should I create a local dns cname for ...
2
votes
3answers
624 views

/usr/bin/host not picking up changes to /etc/hosts even after reboot

I have a Ubuntu Server 12.04 (amd64) machine on which, when I change /etc/hosts, the changes aren't picked up, even after a reboot. I am using /usr/bin/host to test, but none of the other programs ...
2
votes
4answers
3k views

Hosts file modification not used

I added an entry to my hosts file for the development of a website. I put a new line in /etc/hosts xx.xx.xx.xx www.mysite.com But even after a reboot when I use chrome or firefox the host name is ...
2
votes
1answer
2k views

Hosts file on server with dynamic DNS?

I am setting up a RHEL-based server that is associated with dynamic DNS from DynDNS, with a domain of, say, "abc.dyndns.org" that is dynamically updated with the server's IP address. I have read that ...
2
votes
1answer
567 views

ignore hosts file in ZSH ssh/scp tab-complete

I use a hosts file to block ads/malware domains. When I use ssh or scp in zsh and try to tab-complete, it takes a good 5-10 seconds before anything appears and what does appear is usually a list of ...
2
votes
1answer
86 views

rhosts changes and re-initializing

I'm having trouble using the r-commands between my servers to do a tape backup. I've been making changes in the .rhosts file, but I'm not sure if the OS reads that file everytime it's called, or just ...
2
votes
1answer
1k views

Static IP address shifting to 192.168.1.251

I have a system with a static IP address of 192.168.1.150. I configured /etc/network/interfaces manually (i.e. without using NetworkManager.) It is a web server hosting three sites. I am having ...
2
votes
0answers
125 views

Why is my /etc/hosts.deny file being ignored?

I am using a small embedded linux setup generated by buildroot to run on a x86 device. It was generated to use busybox init system and also runs dropbear so I can ssh into the device. I wanted to ...
2
votes
0answers
170 views

why is FQDN using external IP address

When postfix connects to the FQDN dur.bounceme.net it uses the external IP address: root@dur:~# root@dur:~# tail /var/log/mail.log Aug 28 04:39:45 dur postfix/master[6667]: terminating on signal 15 ...
1
vote
2answers
69 views

How to change the name of localhost to a custom name which is available to other users in LAN

I need to use the a custom URL name which is accessible from all devices in a LAN. I know that it can be set in the /etc/hosts file 127.0.0.1 myname 127.0.1.1 system09-System-Product-Name # The ...
1
vote
1answer
348 views

Changing host file in Ubuntu

I tried to change /etc/hosts to change a local DNS entry, so I can map any website name to any IP, but it isn't working. How can I debug it?
1
vote
1answer
947 views

How to use localhost in browser instead of localhost:10088?

Installed zend-server CE. I would like to use this port (10088). But anytime I enter localhost I should enter localhost:10088, because localhost doesn't work. In the hosts file I tried to enter ...
1
vote
2answers
214 views

How to edit /etc/hosts without sudo?

I have a machine that I can only access using SSH. I was messing with the hostnames, and now it says: ssh: unable to resolve hostname I know how to fix it in /etc/hosts. Problem is, I need sudo ...
1
vote
2answers
204 views

Resolving pseudo domain name to private IP

Assume I have a VM running on OSX with private IP 10.0.0.1 which can be accessed from the host machine. I was wondering how can I map a pseudo domain, *.app.dev, to the private IP on my host machine ...
1
vote
2answers
323 views

Simple command that switches between two host files

I am using /etc/host to map localhost to a web domain. I would like a fast way of doing this rather than searching and replacing every time. I put this in my .bashrc file. alias hostchange=' ...
1
vote
1answer
26 views

Which kind of additional cleanup may be required after removing manually added entries from /etc/hosts?

My system is "Unable to resolve" removed entry from /etc/hosts. During development, I needed to add the custom domain entry to /etc/hosts, stating it resolves to 127.0.0.1. This mapping worked fine. ...
1
vote
1answer
459 views

One ubuntu machine in LAN cannot access internet

I have 4 ubuntu machines connected in a LAN network by a single switch.Their IP address is from 192.168.10.10-192.168.10.13.But after I restarted one of them since disk problem,I find that this ...
1
vote
2answers
96 views

Is there some kind kind of hosts.additional file for Linux

If you have a list of servers all linking to each other by static addresses, is there some kind of hosts.additional you can use as some kind of file based DNS? ie The hosts file contains static ...
1
vote
1answer
999 views

/etc/hosts in debian resets itself on reboot

I've been having a problem where when our vps provider decides to restart the server (running Debian 5.0.8), the server fails to remember changes to /etc/hosts. All I need is an database alias that ...
1
vote
2answers
95 views

Does dropbear take care of hosts.allow and hosts.deny?

I'm running dropbear as SSH daemon on Debian (actually Raspbian). I tried setting # /etc/hosts.allow dropbear:192.168.1.1 # my static ip from which I SSH connect to the device and # ...
1
vote
1answer
492 views

Postfix email bounced (mail for domain loops back to myself)

I have problem when i send a mail to example@orbialia.es for example2@orbialia.es My emails has bounced for this error: status=bounced (mail for orbialia.es loops back to myself) May 9 09:33:58 ...
1
vote
1answer
114 views

Dynamically change /etc/hosts

Each time I change my IP address I have to go edit /etc/hosts and change the line: myPc-Vaio 192.168.1.x I need this change for some programs I am using, so I can't just set the line to 127.0.0.1. ...
1
vote
1answer
75 views

Directing hostname to another computer within lan using hosts file

There seem to be more questions like this, excuse me if this is similar. I want to redirect to an IP address om my server computer. This is what I put in my hosts file on the client computer (IMac): ...
1
vote
1answer
460 views

Changing the server name

I changed the name of the hosts in /etc/hosts to IP.GOES.HERE newname Apache does recognize the new server name; but still, via ssh i get this on the ssh prompt: [root@oldname] Why? Where else ...
1
vote
1answer
161 views

Centos apache virtual hosts definition

Please excuse me if my logic is flawed as I am really new to Centos. I know I can define multiple virtual hosts in my httpd.conf file. But what I would like is to define virtual hosts in individual ...
1
vote
0answers
12 views

how to ensure stable domain names for newly-provisioned cloud server instances?

I've been playing with server configuration management tool Ansible, whose use often depends on reference to a local inventory file containing arbitrary host names. For example, # file: my_hosts ...
0
votes
1answer
99 views

Redirecting head output for update hosts file [duplicate]

Possible Duplicate: How can I make iconv replace the input file with the converted output? I'm writing a script to change the content of my hosts file but I got stuck on the head output ...
0
votes
1answer
2k views

Hostname not changing on Centos 6.4

We have centos machine. We have tried both the /etc/hosts and also /etc/sysconfig/network. Edited both files and service network restart. Yet the hostname is showing as localhost.localdomain. How to ...