Host file for browser?
Greg Rundlett
greg at freephile.com
Thu Dec 9 21:36:00 EST 2004
Hi Jason,
Adding to Bill's good example, I usually develop on my local machine
("liberty"), having a local webserver on the same machine setup. This
way I can test stuff locally without ever moving it to the 'production'
server ("brie"), or before checking it in to CVS. Of course my real
webserver (brie) on my internal network is provisioned with a static IP
address of 192.168.1.100, making host entries straightforward. But, my
local workstation and others use Dynamic Host Control Protocol (DHCP) to
get a dynamic IP address from my Linksys router every time I reboot
those machines. Thus, I do not know my own IP. Since the /etc/hosts
file supports aliases for each IP address, and the local loopback IP is
always 127.0.0.1, I can add multiple aliases to that address so that my
local machine knows where to send requests to those local sites.
greg at liberty:~$ cat /etc/hosts
(long lines may be wrapped)
# syntax
# IP_Address hostname alias(es)
127.0.0.1 localhost liberty.rundlett.com liberty
liberty.freephile.com liberty.drstephaniehancox.com
liberty.harbor-lights.com
192.168.1.100 brie.freephile.com # brie has a static IP
# the following lines are commented b/c they will eventually fail
using DHCP on liberty
# 192.168.1.102 liberty.freephile.com
# 192.168.1.102 liberty.drstephaniehancox.com
# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
More information about the gnhlug-discuss
mailing list