Monday, May 30, 2011

DHCP server

Do you have small network or you are just lazy to setup IP addresses? You can run your own DHCP server to do this for you.


First you need to install dhcp server. It should be in the package dhcp-server (on some systems dhcp3-server). After installation, you can create your configuration. Open the file /etc/dhcpd.conf (or /etc/dhcp3/dhcpd.conf).


This is my file:

ddns-update-style none;
default-lease-time 14400;
subnet 192.168.10.0 netmask 255.255.255.0 { # setup the network IP address and mask
range 192.168.10.1 192.168.10.15; # the range for IP addresses assigned to clients
default-lease-time 14400; # how long the IP will be assigned and valid
max-lease-time 172800; # maximal time for valid IP addresses
host KrisKo { # here are settings for my computer
 fixed-address 192.168.10.100; # fixed IP, which will be assigned to host with following mac address
 hardware ethernet 00:1F:C5:95:54:34; # MAC address of the host
}

Starting the DHCP server: first you need static IP address for the server (from the configured network range):
#ifconfig eth0 192.168.10.50
then you can start the server:
rcdhcpd start (or /etc/init.d/dhcp3-server start)

No comments:

Post a Comment