lazyrunner50
Programmer
I'm using CentOS 5 (2.6.18-53.1.6.el5) and trying to figure out how all the networking files work together. Ok, so I have a wireless router and have set it up as a DHCP server and I get DNS "automatically from ISP". I realize DNS would not have the hostnames for the computers on my LAN, so I'm assuming the DNS server is contained in files on my router.
From my understanding, to resolve hostnames the machine looks at /etc/host.conf first, finds out where it should go (in this case /etc/hosts), and then goes to the other locations if the entry is not contained in the first one (in this case /etc/resolv.conf). I noticed however, that no matter what I changed the second value of /etc/hosts to (myComp2), it would still use the old value which I believe is a cached name on my router. So, I have a couple questions.
1. Is my /etc/hosts file correct (assuming I don't have a static IP assigned to my computer)? Should it look like this instead?
2. If I do have a static IP of 192.168.1.2, will this entry update the cache on my router DNS?
3. How can I set the hostname of my computer if I get my ip from DHCP (meaning non-static)? I've already tried the hostname command, but I can't figure out what file that edits, nor does the value seem to be persistent between reboots.
Code:
Here are my files:
/etc/hosts
192.168.1.2 myComp2 localhost.localdomain
/etc/host.conf
order hosts,bind
/etc/resolv.conf
nameserver 192.168.1.1
1. Is my /etc/hosts file correct (assuming I don't have a static IP assigned to my computer)? Should it look like this instead?
Code:
127.0.0.1 myComp2 localhost.localdomain
3. How can I set the hostname of my computer if I get my ip from DHCP (meaning non-static)? I've already tried the hostname command, but I can't figure out what file that edits, nor does the value seem to be persistent between reboots.