Posted by: isaraffee | April 21, 2010

Configuring DHCP server in Ubuntu Jaunty

Configuring DHCP server in Ubuntu Jaunty

DHCP server: Ubuntu

DHCP client: Vector linux

On DHCP server, install DHCP package

root@ismail-laptop:~# apt-get install dhcp3-server

<output truncated for brevity>

Setting up dhcp3-common (3.1.1-5ubuntu8.2) …

Setting up dhcp3-client (3.1.1-5ubuntu8.2) …

* Reloading AppArmor profiles … [ OK ]

Setting up dhcp3-server (3.1.1-5ubuntu8.2) …

Generating /etc/default/dhcp3-server…

* Reloading AppArmor profiles … [ OK ]

* Starting DHCP server dhcpd3 * check syslog for diagnostics.

[fail]

invoke-rc.d: initscript dhcp3-server, action “start” failed.

To check if the dhcp packages are installed, type:

# dpkg –list | grep dhcp

ii dhcp3-client 3.1.1-5ubuntu8.2 DHCP client

ii dhcp3-common 3.1.1-5ubuntu8.2 common files used by all the dhcp3* packages

ii dhcp3-server 3.1.1-5ubuntu8.2 DHCP server for automatic IP address assignm

Next on the DHCP server edit the configuration file. But before that I could never strees enough on making a backup copy of the original file.

root@ismail-laptop:~# cd /etc/dhcp3/

root@ismail-laptop:/etc/dhcp3# ls

dhclient.conf dhclient-enter-hooks.d dhclient-exit-hooks.d dhcpd.conf

root@ismail-laptop:/etc/dhcp3# cp -p dhcpd.conf dhcpd.conf.bak

Now edit the file and include the following lines:;

#i added the following

subnet 72.16.0.0 netmask 255.255.0.0 {

range 172.16.0.10 172.16.0.20;

}

The above entries said that to assign IP address in the range of 172.16.0.10 to 172.16.0.20 to a host (dhcp client).

Check that the DHCP server is running. And if changes were done on the configuration file, you have to restart the dhcpd service.

# cd /etc/init.d/

# ./dhcp3-server status

Status of DHCP server: dhcpd3 is not running.

Start the dhcpd server,

# ./dhcp3-server start

  • Starting DHCP server dhcpd3 [ OK ]

Configuring the dhcp client (Vector LInux)

Edit the network settings of the dhcp client. Change the DHCP value to “yes”

root:# cd /etc/rc.d

vector://etc/rc.d

root:# vi rc.inet1

## The settings

DEVICE=’eth0′

DHCP=’yes’

IPADDR=’172.16.0.1′

NETMASK=’255.255.0.0′

GATEWAY=’172.16.0.2′

PROBE=’no’

Save and quit. Then you need to restart the network services.

root:# ./rc.inet1 stop

Stopping network eth0 …

root:# ./rc.inet1 start

Starting network eth0 using a DHCP server…

dhcpcd: MAC address = 00:11:85:77:d0:a7

dhcpcd: your IP address = 172.16.0.10

eth0 Link encap:Ethernet HWaddr 00:11:85:77:D0:A7

inet addr:172.16.0.10 Bcast:172.16.255.255 Mask:255.255.0.0

UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1

RX packets:4 errors:0 dropped:0 overruns:0 frame:0

TX packets:1 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:671 (671.0 b) TX bytes:594 (594.0 b)

Interrupt:20

From the output, it shows that the dhcp client was assign the IP address of 172.16.0.10. Remember that we have assigned a range of IP addresses on the DHCP server i.e. IP addresses from 172.16.0.10 to 172.16.0.20.

Verify this IP address and check that you can now ping the DHCP server, and that the DHCP server can ping its clients.

root:# ping 172.16.0.2

PING 172.16.0.2 (172.16.0.2) 56(84) bytes of data.

64 bytes from 172.16.0.2: icmp_seq=1 ttl=64 time=0.213 ms

64 bytes from 172.16.0.2: icmp_seq=2 ttl=64 time=0.204 ms

Yes the dhcp client can ping the DHCP server

Try ping the dhcp client from the DHCP server

# ping 172.16.0.10

PING 172.16.0.10 (172.16.0.10) 56(84) bytes of data.

64 bytes from 172.16.0.10: icmp_seq=1 ttl=64 time=1.26 ms

64 bytes from 172.16.0.10: icmp_seq=2 ttl=64 time=0.202 ms

Yes this shows that the dhcp client can ping the DHCP server.

Next we are going to assign IP address based on a specificHardware MAC address.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: