dhcpd: Handing out gateway and DNS addresses to clients


Results 1 to 5 of 5

Thread: dhcpd: Handing out gateway and DNS addresses to clients

Hybrid View

  1. #1
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,950
    In your dhcpd.conf, inside the "subnet" section for the subnet that you want to use these values, turn on these options:

    Code:
        option routers $YOUR_IP;
        option broadcast-address $SUBNET_BCAST;
        option domain-name $YOUR_DOMAIN;
        option domain-name-servers $DNS_SERVER_IP;
    You have to replace the $ variables yourself, though (dhcpd isn't smart enough to do that). $YOUR_DOMAIN is whatever you want your client DHCP daemon to put into /etc/resolv.conf as a "search" directive. $YOUR_IP is the gateway address. $DNS_SERVER_IP is what the client should put into resolv.conf as a "nameserver" directive. And $SUBNET_BCAST is the broadcast address for your subnet (you probably already have that set up).
    Share on Google+

  2. #2
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,950
    Originally posted by deanrantala
    do I enter my external ethernet IP? Or do I use the internal (LAN) IP here?
    Your internal (LAN) IP. It has to be an IP address that the clients can find via ARP -- in other words, an address on the local LAN -- because they don't know of a router address to use to get to it.

    I got that part right didn't I ?
    Yep.

    Now for this, I assume I need to enter "tampabay.rr.com"?
    Yes.

    Is this actually needed?
    I'm actually not sure. I have it in there, just to make sure that my DHCP clients can ping by hostname rather than IP address (my internal DNS server won't resolve just "alpha", for example, but it will resolve "alpha.mydomain").

    And am I even using the right domain name? are there rules for picking a domain name?
    As long as nobody outside your network can talk to your DNS server, then no, there aren't any rules. But if there's even a slight chance that they can, then there are rules for choosing a domain name. Basically, you have to pay a registrar for it. But it sounds like you already did, so that ought to be all right.

    this is pretty self-explainatory - right? Just plug in my DNS server list?
    Yep. Well -- your DNS server. I'm not sure if it can take a list or not (maybe that's been fixed in later dhcpd releases though).

    As for putting it in the subnet section vs. not, I'm not positive on that either. I have it in my subnet section, and it works. But I'd expect that as long as you'll only ever serve one subnet for DHCP (and duh, it makes sense that that'd be the case), then it won't metter.
    Share on Google+

  3. #3
    Join Date
    Mar 2003
    Location
    Cookeville, TN
    Posts
    642

    Need a little help with DHCPd (I almost got it)

    Ahh.. I got it - almost.

    I set up my iptables/firewall and all works fine. I can manually set IP info and connect to internet.

    Now to make life a little easier, I set up dhcpd on the firewall/router box. It seems to be working fine. It assigns the IP to the client but I don't belive it is assigning the it a default gateway or dns server list. How do I enable that? I have read the man pages and onlind doc but they are pretty helpless on this one..


    PS. How do I set the default gateway and dns server name statically on a linux box? I know how to set IP and subnet (in /etc/rc.d/rc.inet1) but I need the additional functiuonality


    thx
    Share on Google+

  4. #4
    Join Date
    Mar 2003
    Location
    Cookeville, TN
    Posts
    642
    # dhcpd.conf
    #
    # Configuration file for ISC dhcpd (see 'man dhcpd.conf')
    # Sample /etc/dhcpd.conf
    # (add your comments here)
    default-lease-time 600;
    max-lease-time 7200;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.254;
    option domain-name-servers 192.168.1.1, 192.168.1.2;
    option domain-name "mydomain.org";
    ddns-update-style ad-hoc;
    subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.10 192.168.1.100;
    range 192.168.1.150 192.168.1.200;
    }
    theres my dhcpd.conf file....

    I do not really understand it too well.

    Heres the deal. I got eth0 wich gets IP via dhcp from my ISP. I got eth1 wich is assigned the usual 192.168.1.1/255.255.255.0 subnet mask. Mt hostname is "gtwy2k1" and the domain name I gave it was "tampabay.rr.com".

    As I said before, the firewall/routing works great if I configure the clients manually, so I do not belive there is anytihng wrong with the normal net settings (do let me know if I am wrong here)

    Also....
    option routers $YOUR_IP;
    do I enter my external ethernet IP? Or do I use the internal (LAN) IP here?

    and..
    option broadcast-address $SUBNET_BCAST;
    I got that part right didn't I ?

    next...
    option domain-name $YOUR_DOMAIN;
    Now for this, I assume I need to enter "tampabay.rr.com"? Is this actually needed? And am I even using the right domain name? are there rules for picking a domain name?

    and finally..
    option domain-name-servers $DNS_SERVER_IP;
    this is pretty self-explainatory - right? Just plug in my DNS server list?

    thx again...

    oh.. yeah...

    You said the stuff mentioned goes into the "subnet" section? Ort do I just modify the file as mentioned earlier?
    Share on Google+

  5. #5
    Join Date
    Mar 2003
    Location
    Cookeville, TN
    Posts
    642
    thx

    I got it. And I have been rather happy the past few hours

    I got my firewall set up, FTP server running smoothly, Apache is working, routing is up and working right, and of coarse, I can now add another client to the LAN without needing to configure anything
    Share on Google+

Posting Permissions

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