Ubuntu 12.04 Command Line DHCP Installation and Setup

DHCP Command Line Ubuntu Command Prompt Servers
By See all their Tutorials
Ubuntu 12.04 Command Line DHCP Installation and Setup

[_] Ubuntu Server 12.04
[_] Sudo level access
[_] Test network
[_] Internet Access for downloading installation files
[_] Workstation for testing

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.

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;
____vii. option broadcast-address;
____viii. option domain-name-servers;
____ix. option domain-name "<YourDomainName>";
____x. subnet netmask {
____xi. range;
____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
____iii. network
____iv. netmask
____v. broadcast
____vi. gateway
__b. In the above if the above iface line should already exist you can simply rem out the existing line using the #

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.