Linux Hosts File (Windows user needs help)

gregor7777

Platinum Member
Nov 16, 2001
2,758
0
71
Hello all,

currently both of my windows setups are configured through the hosts file to point my domain name at my local ip address of my server. My router does not support loopback, so this obviously allows me to use my domain name within my LAN.

Anyhow, I'm moving over to Linux (trying a few flavors now) and I can't figure out how to make a similiar setup. Right now I just point it to my local IP, but for cosmetic reasons I'd like to be able to use my domain name.

Any suggestions? Thanks.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Yep the /etc/host file contains the stuff for the network addressing. You can set up your aliias thru here.

And also remember that any line beginning with a # mark is commented out.
A basic file will look like this:

# blah blah blah

127.0.0.1 localhost
10.0.0.1 Mycomputer mycomputer puty
10.0.0.2 Myserver myserver www.mydomain.com


so if you ping mycomputer or puty or Mycomputer you will try to reach 10.0.0.1..
if you want 10.0.0.2 to be your server than it can be reached by using either myserver, Myserver, or www.mydomain.com.

I assume of course that to the outside world your router is realy what it pings when they ping your domain and that some of your router's ports are forwarded to the server in order to provide the services. So that may lead to some confusion due to the dns server telling you that the server is the outside of the router, and the hosts file tells your computer that it is the actual server. That's not normally a big deal since when your computer tries to resolve a name it goes to the host file first, just remember incase you hook up a laptop or something that's not configured for your network so that you don't get confused if you try to login to your server and the laptop is trying to latch onto the router, which may or may not work...