Tagged Questions

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

learn more… | top users | synonyms

1
vote
2answers
349 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=' ...
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 ...
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 ...
3
votes
2answers
575 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 ...
1
vote
1answer
1k 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 ...
2
votes
1answer
611 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 ...
6
votes
2answers
15k 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 ...
3
votes
2answers
13k 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 ...
52
votes
6answers
18k 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.
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 ...
5
votes
3answers
3k 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 ...
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?