Posted by: isaraffee | April 21, 2010

Assgining IP address with a specific MAC address

Assgining IP address with a specific MAC address

Suppose our dhcp client has a MAC address of 00:11:85:77:d0:a7 and we want to fixed its IP address as 172.16.0.99. These are the steps:

Firstly on the DHCP server, edit the dhcpd.conf and add the following lines.

# cd /etc/dhcp3/

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

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

root@ismail-laptop:/etc/dhcp3# vi dhcpd.conf

#I add this

subnet 172.16.0.0 netmask 255.255.0.0 {

range 172.16.0.07 172.16.0.99;}

host examplehost {

hardware ethernet 00:11:85:77:d0:a7;

fixed-address 172.16.0.99;

}

Save and quit. Then restart the dhcpd service.

You can also run the following command

# service dhcp3-server restart

* Stopping DHCP server dhcpd3 [ OK ]

* Starting DHCP server dhcpd3 [OK].

On the dhcp client, in my case the Vector Linux, type:

#/etc/rc.d/./rc.inet1 stop

#/etc/rc.d/./rc.inet1 start

if it fail to obtain IP address then type:

#dhcpcd

This is the DHCP client daemon. Then check the IP address. It should now assign the IP address based on the MAC address.

# ifconfig eth0

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

inet addr:172.16.0.15 Bcast:172.16.255.255 Mask:255.255.0.0

UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1

Note

You can include the DNS server in the DHCP server

option domain-name-servers 172.16.0.2;
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: