Ubuntu 12.04 Command Line DHCP Installation and Setup
Pre-requisites
[_] Ubuntu Server 12.04
[_] Sudo level access
[_] Test network
[_] Internet Access for downloading installation files
[_] Workstation for testing
Description
The following instructions will guide you through the setup of a basic DHCP server for your Ubuntu 12.04 server. You can adjust settings as needed to suit your specific needs. Also, don't configure the following on a network with an existing DHCP server as they will fight and could cause major issues for your systems.
Instructions
1.)From your CLI run the command “sudo apt-get install dhcp3-server”
__a. Click ‘Y’ when prompted
2.) If there are multiple interfaces on your server complete the following steps:
__a. sudo vi /etc/default/isc-dhcp-server
__b. Once you have entered the vi command locate the ‘Interfaces=””’ command and add the interface name (‘eth0’, ‘eth1’, etc.)
__c. When you’ve completed this step hit ‘escape’ then ‘:wq’ enter
3.) Create a backup of your configuration file
__a. Navigate to the ‘/etc/dhcp/’ directory
__b. Copy the ‘dhcpd.conf’ file to ‘dhcpd.conf.bkup’
4.) Configuration file creation
__a. It is easiest to delete the original file and then add what we want so delete the existing ‘dhcpd.conf’ file
__b. Once deleted enter the command “sudo touch dhcpd.conf” to recreate the file with no data
__c. Now add the following lines to the newly recreated file:
____i. ddns-update-style none;
____ii. default-lease-time 600;
____iii. max-lease-time 7200;
____iv. authoritative;
____v. log-facility local7;
____vi. option subnet-mask 255.255.255.0;
____vii. option broadcast-address 192.168.1.255;
____viii. option domain-name-servers 192.168.1.1;
____ix. option domain-name "<YourDomainName>";
____x. subnet 192.168.1.0 netmask 255.255.255.0 {
____xi. range 192.168.1.100 192.168.1.200;
____xii. }
*The above graphic is correctly formatted version of c.i - c.xii. Formatting is very important in any Linux configuration file, please take your time and verify spacing.
5.) Set a static IP
__a. Edit ‘/etc/network/interfaces’ and add the following (some details may already be present)
____i. iface eth0 inet static
____ii. address 192.168.1.10
____iii. network 192.168.1.0
____iv. netmask 255.255.255.0
____v. broadcast 192.168.1.255
____vi. gateway 192.168.1.1
__b. In the above if the above iface line should already exist you can simply rem out the existing line using the #
Testing
1. ‘sudo service isc-dhcp-server restart’, as we’ve made changes to an active DHCP system we need to restart to get our changes activated.
2. Now use a test workstation on the same network, activate DHCP, and confirm that it gets a valid IP address from your server.
The settings above are just for example, you will want to adjust your configuration file to fit your specific network needs.
Pre-requisites
[_] Ubuntu Server 12.04
[_] Sudo level access
[_] Test network
[_] Internet Access for downloading installation files
[_] Workstation for testing
Description
The following instructions will guide you through the setup of a basic DHCP server for your Ubuntu 12.04 server. You can adjust settings as needed to suit your specific needs. Also, don't configure the following on a network with an existing DHCP server as they will fight and could cause major issues for your systems.
Instructions
1.)From your CLI run the command “sudo apt-get install dhcp3-server”
__a. Click ‘Y’ when prompted
2.) If there are multiple interfaces on your server complete the following steps:
__a. sudo vi /etc/default/isc-dhcp-server
__b. Once you have entered the vi command locate the ‘Interfaces=””’ command and add the interface name (‘eth0’, ‘eth1’, etc.)
__c. When you’ve completed this step hit ‘escape’ then ‘:wq’ enter
3.) Create a backup of your configuration file
__a. Navigate to the ‘/etc/dhcp/’ directory
__b. Copy the ‘dhcpd.conf’ file to ‘dhcpd.conf.bkup’
4.) Configuration file creation
__a. It is easiest to delete the original file and then add what we want so delete the existing ‘dhcpd.conf’ file
__b. Once deleted enter the command “sudo touch dhcpd.conf” to recreate the file with no data
__c. Now add the following lines to the newly recreated file:
____i. ddns-update-style none;
____ii. default-lease-time 600;
____iii. max-lease-time 7200;
____iv. authoritative;
____v. log-facility local7;
____vi. option subnet-mask 255.255.255.0;
____vii. option broadcast-address 192.168.1.255;
____viii. option domain-name-servers 192.168.1.1;
____ix. option domain-name "<YourDomainName>";
____x. subnet 192.168.1.0 netmask 255.255.255.0 {
____xi. range 192.168.1.100 192.168.1.200;
____xii. }

*The above graphic is correctly formatted version of c.i - c.xii. Formatting is very important in any Linux configuration file, please take your time and verify spacing.
5.) Set a static IP
__a. Edit ‘/etc/network/interfaces’ and add the following (some details may already be present)
____i. iface eth0 inet static
____ii. address 192.168.1.10
____iii. network 192.168.1.0
____iv. netmask 255.255.255.0
____v. broadcast 192.168.1.255
____vi. gateway 192.168.1.1
__b. In the above if the above iface line should already exist you can simply rem out the existing line using the #
Testing
1. ‘sudo service isc-dhcp-server restart’, as we’ve made changes to an active DHCP system we need to restart to get our changes activated.
2. Now use a test workstation on the same network, activate DHCP, and confirm that it gets a valid IP address from your server.
The settings above are just for example, you will want to adjust your configuration file to fit your specific network needs.