To set up an ISC DHCP server on Ubuntu or Debian Linux, follow these steps:
sudo apt-get install isc-dhcp-server
/etc/dhcp/dhcpd.conf
. Open the file in a text editor by typing the following command:sudo nano /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; }
This defines a network range of 192.168.1.100
to 192.168.1.200
with a subnet mask of 255.255.255.0
.
option routers 192.168.1.1; option domain-name-servers 192.168.1.1;
This sets the router's IP address to 192.168.1.1
and the DNS server's IP address to 192.168.1.1
.
Save the changes and exit the text editor.
Edit the DHCP server's default interface configuration file. The file is located at /etc/default/isc-dhcp-server
. Open the file in a text editor by typing the following command:
sudo nano /etc/default/isc-dhcp-server
INTERFACES
directive in the file and specify the name of the network interface that you want to use for the DHCP server. For example:INTERFACES="eth0"
This sets the DHCP server to use the eth0
interface.
Save the changes and exit the text editor.
Restart the DHCP server by typing the following command:
sudo service isc-dhcp-server restart
The DHCP server is now set up and ready to serve DHCP requests on the specified network interface.
Note: This is just a basic configuration example. There are many other options and settings that you can specify in the DHCP configuration file to customize the behavior of the DHCP server. You should consult the ISC DHCP documentation for more information.