DHCPD Fails to start at startup


Results 1 to 11 of 11

Thread: DHCPD Fails to start at startup

  1. #1
    Join Date
    Jan 2005
    Posts
    2

    DHCPD Fails to start at startup

    I tried to change my hostname on my computer and I really screwed something up. Because now when I start my computer I see a message that my computer can't find it's own host name. I think the problem is being caused by the fact that my dhcpd doesn't start up when I turn on my computer. When I look and my dhcpd.conf file, it say the same thing and my dhcpd.conf.old and conf.orig files.

    This is what my dhcpd.conf file says :

    ddns-update-style none;
    subnet 192.168.1.0 netmask 255.255.255.0 {
    # default gateway
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;

    option domain-name "localdomain";
    option domain-name-servers 192.168.123.254;

    range dynamic-bootp 192.168.1.16 192.168.1.253;
    default-lease-time 43200;
    max-lease-time 21600;
    }

    Then this is what my dhcpd.conf.old files says:

    ddns-update-style none;
    subnet 192.168.1.0 netmask 255.255.255.0 {
    # default gateway
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;

    option domain-name "localdomain";
    option domain-name-servers 192.168.123.254;

    range dynamic-bootp 192.168.1.16 192.168.1.253;
    default-lease-time 21600;
    max-lease-time 43200;
    }
    They say the same thing, am I looking at the wrong set of files for this problem?

    Any help in this matter would be greatly appreciated.

  2. #2
    Join Date
    Jan 2004
    Location
    boston, mass USA
    Posts
    1,878
    Are you trying to assign an IP address dynamically from a dhcp server running on the same machine? Not sure that would work....you would need an IP on the server for it to hand out IP's to your clients, which in your case is yourself....i would think it would get confused.

    I would just assign a static IP to the dhcpd server and go play games.

  3. #3
    Join Date
    Jan 2005
    Posts
    2
    I'm trying to assign an IP address to anything, just change the hostname.

    I've also seen a message that my hostname has an invalid character and that it is the post.conf file

    I can't see how to get into the postconf file in the first place and there seems to be too files one in my bin directory and the other in my sbin directory.

    I'm 90% sure that 's it's the one in sbin, but the message goes by so fast that I don't have a lot of time to read it.

  4. #4
    Join Date
    Mar 2002
    Location
    Pennsylvania, USA
    Posts
    1,713
    If you change your host name, you need to make sure there is an entery for it in your /etc/hosts file. The file should look something like this:

    127.0.0.1 localhost localhost.localdomain
    192.168.1.x hostname hostname.domainname

    Use the IP address of your machine and the hostname you've assigned to it. If you're not using a domain on your network, you can leave out hostname.domainname.

    Do not remove the 127.0.0.1 line from the file.

    Once you make that correction, restart the server and the error messages related to the host name should disappear.
    If God hadn't meant for us to use GUI tools, there wouldn't have been a Xerox PARC.

  5. #5
    Join Date
    Jan 2004
    Location
    boston, mass USA
    Posts
    1,878
    I have had this conversation a million times now, and with each new person, I get different answers for what the /etc/hosts file should contain.

    Isn't the hosts file ONLY for assigning IPs to names? Why would you need to tell your own machine what its own IP and name is in hosts?

    Especially using dhcp, shouldn't hosts only contain the loopback? since the IP could/would change at every boot?

    Redhat does something weird to /etc/hosts automatically during install in that it puts something like:

    127.0.0.1 localhost.localdomain localhost mikespc mikespc.localdomain

    Its very weird if you ask me. So maybe this should be a new poll, "what does your /etc/hosts file contain?"

  6. #6
    Join Date
    Mar 2002
    Location
    Pennsylvania, USA
    Posts
    1,713
    Technically speaking, the /etc/hosts file is not used to assign anything. It's purpose is host or fully qualified domain name resolution.
    If you type in http://www.google.com, the IP address for www.google.com could be found in your hosts file.

    Now days, the primary means of name resolution is using DNS servers. If you type in http://www.google.com, your machine will go to the DNS servers you have set up for your computer to resolve www.google.com to an IP address. However, by default, most machines will check the hosts file first for name resolution, and when it doesn't find an answer there, it will go to the DNS server.

    If you want to test this, make an entry in your hosts file such as

    192.168.1.1 www.google.com

    then try to access Google. You probably won't get there unless your machine has been configured to look at the DNS server first. Most machines aren't.

    Years ago when the Internet was new and there were no DNS servers, everyone used just the hosts file. As the Internet grew, that became too cumbersome. Can you imagine if you had to list every possible web, ftp, chat, e-mail site you wanted to access in your hosts file? It would be impossible to keep up to date. Thats why they came up with DNS to supplement/replace the hosts file.

    If you have a good DNS server that is providing name resolution for your local network, you should probably never need to touch your hosts file. Most people don't have that on their own own small networks so you sometimes have to make entries in your hosts file.

    Many services when they start up, such as dhcpd and apache, need to resolve the machines host name to it's IP address. The first place that is usually checked is the local hosts file. If it's not found there, then the DNS server is queried. When all means of name resolution are exhausted, they will generate an error and usually won't start or run correctly. I'm not sure why they need to do this, I just know that they do.
    I know on many versions of Red Hat, even the GUI wouldn't start up if it couldn't resolve it's host name to ip address. If you didn't have a DNS server on the network, then you had to have an entry in your hosts file for it. I don't know if that's still true for current versions of Red Hat/Fedora or not.

    In newlinuxuser03's case, if he had a DNS server for his local network, he wouldn't have needed entries in his host file. Without the DNS server, the entries in the hosts file are critical for the services to start correctly.

    You're correct in your assessment regarding machines using dhcp and the hosts file. If my IP address changes every time I reboot my machine, what good is an entry for it in the hosts file? None. That's why you'll see a lot of machines on small networks that just use the default host name of localhost. By default, you'll always have an entry in your hosts file for local host.
    As a matter of fact, in many cases whey you are using dhcp and you want to change your host name to something different than localhost, you can get away with adding your hostname to the localhost line like this:

    127.0.0.1 localhost localhost.localdomain myhostname

    That solved the problem of the GUI start up in Red Hat for machines using dhcp.

    Even with a DNS server on the local network assigning host names using DHCP could be a challenge. With the advent of dynamic DNS, that has been made much easier.

    If you're running a dhcp or web server on your machine, you should be using a static IP address so an entry in the hosts file makes sense.

    One more thing to remember, the hosts file on a machine is only used by that machine for name resolution. No other machine on the network will directly use the hosts file on another machine for name resolution.

    I hope this helps.
    If God hadn't meant for us to use GUI tools, there wouldn't have been a Xerox PARC.

  7. #7
    Join Date
    Apr 2003
    Location
    Oklahoma
    Posts
    559
    Originally posted by cowanrl
    If you change your host name, you need to make sure there is an entery for it in your /etc/hosts file. The file should look something like this:

    127.0.0.1 localhost localhost.localdomain
    192.168.1.x hostname hostname.domainname

    Shouldn't the second entry also map to 127.0.0.1?
    It does on mine, and although using the interface ip address should work (I've never tried) it will necessitate editing the file every time the addy changes (just like you said).

  8. #8
    Join Date
    Mar 2002
    Location
    Pennsylvania, USA
    Posts
    1,713
    Do you mean something like this?

    127.0.0.1 localhost localhost.localdomain
    192.168.1.x 127.0.0.1 myhostname myhostname.mydomain

    Or like this?

    127.0.0.1 localhost localhost.localdomain
    127.0.0.1 myhostname myhostname.mydomain
    If God hadn't meant for us to use GUI tools, there wouldn't have been a Xerox PARC.

  9. #9
    Join Date
    Apr 2003
    Location
    Oklahoma
    Posts
    559
    The second:

    127.0.0.1 localhost localhost.localdomain
    127.0.0.1 myhostname myhostname.mydomain

  10. #10
    Join Date
    Mar 2002
    Location
    Pennsylvania, USA
    Posts
    1,713
    I have never seen it this way:

    127.0.0.1 localhost localhost.localdomain
    127.0.0.1 myhostname myhostname.mydomain

    I've always seen that accomplished like this:

    127.0.0.1 localhost localhost.localdomain myhostname myhostname.mydomain

    On your machine, if you ping localhost, localhost.localdomain, myhostname or myhostname.mydomain, does it always show the name resolved to 127.0.0.1?

    That could just be two ways of accomplishing the same thing.
    If God hadn't meant for us to use GUI tools, there wouldn't have been a Xerox PARC.

  11. #11
    Join Date
    Apr 2003
    Location
    Oklahoma
    Posts
    559
    After running netconfig on slackware, each of my boxes uses the format:

    127.0.0.1 localhost
    127.0.0.1 myhostname.domain myhostname

    The only ping that doesn't return is myhostname (returns "unknown host") but localhost and myhostname.domain both return 127.0.0.1 Like you said, I think it might just be two ways to do the same thing. I have never had any network problems with this setup, wire or wireless, workstation or server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •