File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_set_up_a_dhcp_server.mdwn
Revision 1.5: download - view: text, annotated - select for diffs
Wed Sep 9 14:28:56 2020 UTC (2 months, 2 weeks ago) by kim
Branches: MAIN
CVS tags: HEAD
Use man template

    1: Setting up a DHCP Server for your home or company network is pretty simple with NetBSD. You don't need to install any software, because everything you need, is part of the base system. Just create the file /etc/dhcpd.conf like this: 
    2:     
    3:     
    4:     deny unknown-clients;       
    5:     ddns-update-style none;      
    6:     subnet 192.168.0.0 netmask 255.255.255.0 {
    7:             range 192.168.0.200 192.168.0.254; 
    8:             default-lease-time 28800;
    9:             max-lease-time 86400;
   10:             option broadcast-address 192.168.0.255;
   11:             option domain-name "mycompanydomainname.com";
   12:             option domain-name-servers 194.152.64.35, 194.25.2.132;
   13:             option routers 192.168.0.1;
   14:      
   15:             host ftp-server {
   16:                     hardware ethernet 00:00:0a:d8:39:ee;
   17:                     fixed-address 192.168.0.199;
   18:                     }
   19:             host sparc {
   20:                     hardware ethernet 00:50:04:01:ee:20;
   21:                     fixed-address 192.168.0.198;
   22:                     }
   23:     }
   24:     
   25: 
   26: Now add the service to your /etc/rc.conf. This way the DHCP will be started on every reboot. 
   27:     
   28:     dhcpd=yes
   29:     dhcpd_flags="-q ex0"
   30:     
   31: 
   32: ex0 is the Network Interface to listen on for dhcp requests. This is important if you have more than one Network Interface. If you don't, you can omit the second line. 
   33: 
   34: Before starting the service, you have to create a lease file, that the dhcp server needs. 
   35:     
   36:     # touch /var/db/dhcpd.leases
   37:     
   38: 
   39: Now start the service: 
   40:     
   41:     # /etc/rc.d/dhcpd start
   42:     
   43: 
   44: To test if your dhcp server is running, run _dhcpcd_ on another host on the same network. 
   45:     
   46:     # dhcpcd
   47:     
   48: 
   49: Also check your /var/db/dhcpd.leases file. That's it. Have fun. 
   50: 
   51: ##  Additional Information 
   52: 
   53:   * [[!template id=man name="dhcpd" section="8"]]
   54: 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb