LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 07-08-2010, 03:43 AM   #1
digsecurity
Member
 
Registered: Apr 2010
Posts: 54

Rep: Reputation: 18
fixed address in dhcp server


Hi all,
I want to set up a dhcp server such that the clients get same ip every time. Giving fixed address to every client would be a long process.

"I don't want to assign a specific ip to the client but what i want is the server provides same ip every time"

Is there a way. Thanks in advance
 
Old 07-08-2010, 04:36 AM   #2
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
You can make the lease very long.

But I would not rely on it if you want to firewall specific IPs.

On all platforms you will have to add entries "manually".
Actually, if you create a list of mac addresses and of IPs, you can very easily script adding all the IPs.
 
Old 07-08-2010, 05:48 AM   #3
barghota
Member
 
Registered: Jul 2003
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Debian, FreeBSD
Posts: 94

Rep: Reputation: 38
You would want to assign IP per MAC address,

This is a sample...

Quote:
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.3;
option subnet-mask 255.255.255.0;

range 192.168.0.20 192.168.0.90;
default-lease-time 216000;
max-lease-time 432000;

host HostA {
hardware ethernet 00:16:6f:62:49:b4;
fixed-address 192.168.0.20;
}
host HostB {
hardware ethernet 00:1f:3c:8c:4a:e0;
fixed-address 192.168.0.21;
}
}
 
Old 07-08-2010, 06:21 AM   #4
digsecurity
Member
 
Registered: Apr 2010
Posts: 54

Original Poster
Rep: Reputation: 18
I was wondering if there's a way server provides same ip without assigning ip per MAC address. I have clients more than 70 and binding all MAC would be a headache....Is there a way server does this automatically?

Thanks
 
Old 07-08-2010, 08:00 AM   #5
barghota
Member
 
Registered: Jul 2003
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Debian, FreeBSD
Posts: 94

Rep: Reputation: 38
You could set that a lease never expires in the leases file:

lease 192.168.0.88 {
starts 3 2010/03/24 19:26:19;
ends never;
tstp 3 2010/03/24 21:22:09;
binding state active;
hardware ethernet 00:0c:29:45:15:3c;
}

Note that the leases file is build with the MAC address, you won't have to declare it per IP.

If you have a populated leases database, you could set all the leases to "ends never;" using sed...

# mv dhcpd.leases old.dhcpd.leases && sed 's/ends .*;/ends never;/g' old.dhcpd.leases > dhcpd.leases
 
Old 07-08-2010, 11:26 PM   #6
digsecurity
Member
 
Registered: Apr 2010
Posts: 54

Original Poster
Rep: Reputation: 18
Thanks, I'll give it a try
 
Old 07-09-2010, 01:33 AM   #7
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
As I said, you can script it.
You will have the same issue having to put the stanza with the mac there 70 times.
 
  


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
[SOLVED] dhcp fixed address not working [GOD]Anck Slackware 6 06-07-2010 05:25 AM
DHCP Fixed IP Address confusion noir911 Linux - Server 1 03-23-2008 08:10 AM
dhcp.conf problem: host fixed-address declarations ignored lslade Linux - Server 0 03-05-2007 01:47 PM
DHCP: Problem in assigning fixed address to clients libregeek Linux - Networking 6 11-17-2005 11:59 PM
Fixed IP Address with DHCP dgreenbean Linux - Networking 9 09-19-2004 01:12 PM


All times are GMT -5. The time now is 10:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration