Difference between revisions of "DHCP dynamic IP assignation"

(Created page with "Category:Linux =Access configuration file= The main configuration file is '''/etc/dhcp/dhcpd.conf''' <syntaxhighlight lang="bash"> vim /etc/dhcp/dhcpd.conf </syntaxhig...")
 
 
Line 9: Line 9:
 
vim /etc/dhcp/dhcpd.conf
 
vim /etc/dhcp/dhcpd.conf
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
You can adjust the interface the server is listening on in /etc/dhcp/dhcp3-server
 
INTERFACES="eth0 eth1"
 
  
  

Latest revision as of 21:15, 8 August 2014


Access configuration file

The main configuration file is /etc/dhcp/dhcpd.conf

vim /etc/dhcp/dhcpd.conf


Random IP assignation

The following configuration will accept all clients and give them a random IP @.

# 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 172.16.50.255;
option routers 172.16.50.254;
# Put your own DNS server or your ISP | Google servers
option domain-name-servers 172.16.50.2, 8.8.8.8;
# Put your domain name - if you have one
option domain-name "mydomain.lan";
option ntp-servers 172.16.50.254;

subnet 172.16.50.0 netmask 255.255.255.0 {
  range 172.16.50.10 172.16.50.100;
  range 172.16.50.150 172.16.50.200;
}

You have to adjust:

  • Network parameters - instead of 172.16.50.*
  • DHCP range(s). In the given example there are 2 ranges from 10-100 and 150-200