|
||||||||
|
|
#1
|
|
> 2. Secondly, I am also wondering if a "pool" of MAC addresses can be > setup so that only MAC's listed can be given an IP, but is random within > a range of valid IP addresses. This one can at least. subnet 10.4.0.0 netmask 255.255.0.0 { authoritive; option subnet-mask 255.255.0.0; option broadcast-address 10.0.255.255; pool { range 10.4.254.1 10.4.254.254; option routers 10.4.0.1; option domain-name-servers 10.4.0.7; default-lease-time 120; max-lease-time 120; allow unknown clients; } pool { range 10.4.1.1 10.4.5.254; option routers 10.4.0.1; option domain-name-servers 10.0.0.17, 10.0.0.23; default-lease-time 1209600; max-lease-time 1209600; deny unknown clients; } } host wwebster-1 { hardware ethernet 00 0:09:28:05:56 ; ddns-hostnamewwebster-1;} host cclark-1 { hardware ethernet 00:A0 2:1A:7C:A5 ; ddns-hostnamecclark-1;} These computers will be given IP's out of the second pool of addresses. The first pool is not needed for you most likely (it is part of a captive portal system). Noah Roberts |
|
#2
|
|||
|
|||
|
Hello all,
I have two questions regard DHCP: 1. Can I have DHCP execute a script for each lease it gives? What I would like to do is for everytime an IP is assigned, I would like it to execute a script which will set bandwidth restrictions on that IP (two arguments of that script would have to be MAC address and IP address). Also, is there a way of running a script upon termination of a lease (do the opposite of the first script). 2. Secondly, I am also wondering if a "pool" of MAC addresses can be setup so that only MAC's listed can be given an IP, but is random within a range of valid IP addresses. Thanks in advance. Kevin Brown |
|
#3
|
|||
|
|||
|
Kevin Brown <-NOSPAM-itismekevinb-NOSPAM-@hotmail.com> wrote:
> 1. Can I have DHCP execute a script for each lease it gives? What I > would like to do is for everytime an IP is assigned, I would like it to > execute a script which will set bandwidth restrictions on that IP (two > arguments of that script would have to be MAC address and IP address). > Also, is there a way of running a script upon termination of a lease (do > the opposite of the first script). You script may monitor /var/log/messages for records written on behalf of DHCP daemon every time client requests/reconfirms/releases IP address, and then do whatever you need (reconfigure iptables, or router). -- andrei |
|
#4
|
|||
|
|||
|
Kevin Brown <-NOSPAM-itismekevinb-NOSPAM-@hotmail.com> wrote:
> 1. Can I have DHCP execute a script for each lease it gives? What I > would like to do is for everytime an IP is assigned, I would like it to > execute a script which will set bandwidth restrictions on that IP (two > arguments of that script would have to be MAC address and IP address). > Also, is there a way of running a script upon termination of a lease (do > the opposite of the first script). On a quick review, I can't find the man page/reference where I found this before, but for every new DHCP lease (my system uses dhclient), the script /etc/dhclient-exit-hooks is executed. I can't recall if I set this up in a config file or it's executed if it exists. I use this script to update /etc/hosts when I get a new IP address. When called, environment variables contain various details about the event. -- ... Tim Rhodes ........................ http://rhodes.cc.vt.edu/~rhodes .. ... NIS-Systems Support, Virginia Tech .............. (E-Mail Removed) .. |
|
#5
|
|||
|
|||
|
Tim Rhodes wrote: > Kevin Brown <-NOSPAM-itismekevinb-NOSPAM-@hotmail.com> wrote: > > 1. Can I have DHCP execute a script for each lease it gives? What I > > would like to do is for everytime an IP is assigned, I would like it to > > execute a script which will set bandwidth restrictions on that IP (two > > arguments of that script would have to be MAC address and IP address). > > Also, is there a way of running a script upon termination of a lease (do > > the opposite of the first script). > On a quick review, I can't find the man page/reference where I found this > before, but for every new DHCP lease (my system uses dhclient), the script > /etc/dhclient-exit-hooks is executed. I can't recall if I set this up in > a config file or it's executed if it exists. I use this script to update > /etc/hosts when I get a new IP address. When called, environment variables > contain various details about the event. /sbin/dhclient-script ? |
|
#6
|
|||
|
|||
|
On 3 Feb 2005 16:29:05 -0800, prg wrote:
> > /sbin/dhclient-script ? That is the script which calls /etc/dhclient-exit-hooks if it exists. /sbin/dhclient-script should not be modifed. User code goes in /etc/dhclient-exit-hooks. |
|
#7
|
|||
|
|||
|
Bit Twister wrote: > On 3 Feb 2005 16:29:05 -0800, prg wrote: > > > > /sbin/dhclient-script ? > > That is the script which calls /etc/dhclient-exit-hooks if it exists. > /sbin/dhclient-script should not be modifed. > User code goes in /etc/dhclient-exit-hooks. "...the script which calls /etc/dhclient-exit-hooks" is what he could not find, so I told him how to find where /etc/dhclient-exit-hooks (exit_with_hooks) is called. No? That's the whole point of exit_with_hooks. No? But I may have misunderstood -- not the first time ![]() regards, prg email above disabled |
|
#8
|
|||
|
|||
|
On 3 Feb 2005 17:08:37 -0800, prg wrote:
> > But I may have misunderstood -- not the first time ![]() Tim had indicated he could not remember how he knew about dhclient-exit-hooks man dhclient-script talks about it. I misunderstood your response. I assumed you were suggesting the user modify /sbin/dhclient-script. O:-) |
|
#9
|
|||
|
|||
|
Bit Twister wrote: > On 3 Feb 2005 17:08:37 -0800, prg wrote: > > > > But I may have misunderstood -- not the first time ![]() > > Tim had indicated he could not remember how he knew about dhclient-exit-hooks > > man dhclient-script talks about it. > > I misunderstood your response. I assumed you were suggesting the user > modify /sbin/dhclient-script. O:-) And so might someone else without you prodding me into a clarification. All bases covered. Is that teamwork, or what? prg |
![]() |
| Tags |
| dhcp |
| Thread Tools | |
| Display Modes | |
|
|