LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-11-2011, 06:52 PM   #1
Nutnot
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
DHCP3-Server giving IP addresses depending on MAC


Hello, I have dhcp3-server (isc-dhcp-server) installed on my Debian and now I got a question about how it's giving the IP addresses to new devices.

For example: I connected my laptop and dhcp server gave me 192.168.1.5 address. Will it always give me the same ip address when I connect my laptop or it will eventually change after some time (week-month)??
If it's not changing it, then I am wrong about this.

BUT...
If I am somehow correct and if it will change in a week and give me another random (like 192.168.1.8) IP even I won't change my laptop network adapter, is it possible to configure dhcp server to always give same IP address depending on what MAC it is?

To make it clear, I want that when I connect new device (new laptop/pc) dhcp server would give it random IP but same time it would note the MAC address and never change the IP on that MAC.

I know about MAC filters, but setting filters is when you know MAC address since beginning and want to assign IP for it, but in my situation I don't know the MAC address.

I hope I made it clear, waiting for some help on this.
 
Old 04-11-2011, 07:39 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
You just have to edit the file /etc/dhcp3/dhcpd.conf (I believe that's the file, but I'm not in front of my Debian box right now). There's a section in the config file that talks about static routing based on MAC address. You should set that up for any machines you want to always have the same address.
 
Old 04-11-2011, 08:31 PM   #3
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
Smile

Hi Nutnot,

basically, leased IPs change overtime, but as pljvaldez said, there is a way to statically bind an IP address to a particular client, using its MAC address.

First, you need to figure out the client's MAC address. Everytime a DHCP server leases an IP to a client, it saves the event in a file called dhcpd.leases (in my Red Hat box, it's under /var/lib/dhcpd directory). It looks like this :

Code:
lease 10.12.12.100 {
  starts 6 2011/01/15 14:09:59;
  ends 0 2011/01/16 14:09:59;
  tstp 0 2011/01/16 14:09:59;
  cltt 6 2011/01/15 14:09:59;
  binding state free;
  hardware ethernet 00:0c:29:f9:f0:f5;
  uid "\001\000\014)\371\360\365";
}
Take the MAC address and put it to your DHCP server's dhcpd.conf file, under this directive :

Code:
host some-host-name { hardware ethernet 00:0c:29:f9:f0:f5; fixed-address 10.12.12.100; }
Reload/restart your dhcp service, and now every time your client requests an IP, the server will assign it with a fixed address of 10.12.12.100.

Don't forget to exclude the fixed IP from the dynamic range option to avoid any potential conflict with another host.


----
sibe
 
Old 04-11-2011, 09:10 PM   #4
Nutnot
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Well I know the ways you just said how to solve this manually by looking at client's MAC address and assigning IP to it, but is it possible to make all this job done automatically by dhcp server?

I mean maybe when dhcp server leases and IP it could make it permanent IP for that particular MAC address?
 
Old 04-11-2011, 09:29 PM   #5
sibe
Member
 
Registered: Apr 2011
Location: Jakarta, Indonesia
Distribution: Fedora, CentOS
Posts: 122

Rep: Reputation: 21
Smile

Please apologize if I didn't get the question correctly, but AFAIK there's no way to achieve a permanent lease automatically. Unless, well, you put a very very high TTL on the default and maximum lease variable
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
arp giving me incomplete mac addresses iamnotherbert Linux - Networking 2 01-02-2014 07:36 AM
ISC dhcp3 (ver. 3.04) vlan setup giving out of improper subnet addresses Valkyr1e Linux - Server 1 07-26-2008 12:15 PM
Binding 2 NICs (MAC addresses) to 2 IP Addresses in same Subnet RedHat EL4.0 skhira Linux - Networking 13 02-24-2008 09:16 PM
dhcpd to lease IP addresses depending gateway jlbocanegra Linux - Networking 1 05-28-2006 02:43 PM
DHCP3 Mac Filter linx win Debian 2 07-28-2005 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration