Tuesday, May 1, 2012

How to Setup a DHCP Server in ubuntu

Install the DHCP Server:

sudo apt-get install isc-dhcp-server

When the installation finish we need to edit the /etc/dhcp/dhcpd.conf file to fit our network needs
Lets see the following example:

  default-lease-time 3600;
  max-lease-time 7000;

  subnet 192.168.1.0 netmask 255.255.255.0 
{
  range 192.168.1.100 192.168.1.254;
  option routers 192.168.1.1;
  option domain-name-servers 192.168.1.2, 192.168.1.3;

Explanation:

default-lease-time: The default time in seconds (3600) that the server will lease the ip to a client if the client doesn't ask for a specific time frame.

max-lease-time: in any case, even if the client had request for a specific time frame the maximum allowed lease will be 7000 seconds.

subnet: the subnet that the dhcp server will manage

range: the range of ip addresses that the server will give to clients

option routers: The gateway that the server will "advise" the clients to use

option domain-name-servers: The DNS server(s) that the server will "advise" the clients to use

After any change we made to the dhcp server config file we have to restart the dhcp server

sudo /etc/init.d/isc-dhcp-server restart

No comments:

Post a Comment