Networking Forums

Networking Forums > Computer Networking > Linux Networking > DHCP for specific range of mac addresses?

Reply
Thread Tools Display Modes

DHCP for specific range of mac addresses?

 
 
Tom Horsley
Guest
Posts: n/a

 
      02-16-2008, 11:58 PM
I'd like to run a dhcp server that will only respond to dhcp
requests from the virtual machines on my xen server box
(all of which use 00:16:3e as a mac address prefix).

This seemed like such a simple idea till I started reading
the dhcpd.conf man page :-).

I see a dhcp-eval man page, I see a "hardware" operator, and
then I run out of pointers. What the heck does the string
generated by "hardware" look like? I can't find an example
anywhere, so I can't tell what to look for in it to match
only my virtual machines.

Anyone know what "hardware" generates? Anyone have an example
of already doing something like this?

Thanks for any info you can provide...
 
Reply With Quote
 
 
 
 
Jack Snodgrass
Guest
Posts: n/a

 
      02-17-2008, 12:45 AM
On Sat, 16 Feb 2008 18:58:34 -0600, Tom Horsley wrote:

> I'd like to run a dhcp server that will only respond to dhcp requests
> from the virtual machines on my xen server box (all of which use
> 00:16:3e as a mac address prefix).
>
> This seemed like such a simple idea till I started reading the
> dhcpd.conf man page :-).
>
> I see a dhcp-eval man page, I see a "hardware" operator, and then I run
> out of pointers. What the heck does the string generated by "hardware"
> look like? I can't find an example anywhere, so I can't tell what to
> look for in it to match only my virtual machines.
>
> Anyone know what "hardware" generates? Anyone have an example of already
> doing something like this?
>
> Thanks for any info you can provide...


here is a section of my dhcpd.conf file where I assign IPs to my tivos
based on their hardware / mac address. The hardware address is just a
mac address.



host tivodev {
# FA120
hardware ethernet 00:0f:b5:84:d0:23;
fixed-address tivodev.private.net;
}

host tivoa {
# FA120
hardware ethernet 00:09:5b:e3:76:eb;
#tivonet
#hardware ethernet 00:0B:AD:77:68:43;
fixed-address tivoa.private.net;
}

host tivob {
# usb200m
#hardware ethernet 00:10:60:25:f5:d1;
hardware ethernet 00:12:0E:02:C7:6B;
fixed-address tivob.private.net;
}


I don't know how to specify a hardware range... just individual mac
addresses....

why not hardcode your xen mac address in the xen profile and then use
those same mac addresses in your dhcpd.conf file. That's what I do for
my vmware stuff. I set the mac address on the virtual interface to
something that I know what it is and put that in my dhcpd.conf file.

--
D.A.M. - Mothers Against Dyslexia

see http://www.jacksnodgrass.com for my contact info.

jack - Grapevine/Richardson
 
Reply With Quote
 
Tom Horsley
Guest
Posts: n/a

 
      02-17-2008, 02:04 AM
On Sun, 17 Feb 2008 01:45:48 +0000, Jack Snodgrass wrote:

> why not hardcode your xen mac address in the xen profile and then use
> those same mac addresses in your dhcpd.conf file. That's what I do for
> my vmware stuff. I set the mac address on the virtual interface to
> something that I know what it is and put that in my dhcpd.conf file.


Because I have a lot more virtual machines than IP addrs, so I
want to randomly assign them from a pool, but I don't want
some unsuspecting person in the lab genning some real machine to
wind up grabbing one of my virtual machine IPs from my dhcp
server :-).

After much poking around, I found the "log" statement, which allowed
me to experiment with the "hardware" statement, which finally allowed
me to determine that the "hardware" "string" is binary data with a
binary 1 byte if it is ethernet followed by the 6 bytes of the mac
address, so with sufficient diddling around and use of the
binary-to-ascii function, I think I'll be able to define an if
expression that will restrict my server to responding only to
my virtual machines, then I can hand out IPs from a random pool.

Now I gotta go figure out how to hand out random host names
as well as random IP addrs (but keep the same host with the
same IP all the time to make ssh happy). Maybe I can derive
the host name from the IP that gets assigned? I'll have to
poke around more...
 
Reply With Quote
 
Tom Horsley
Guest
Posts: n/a

 
      02-17-2008, 02:51 AM
On Sat, 16 Feb 2008 21:04:30 -0600, Tom Horsley wrote:

> Maybe I can derive
> the host name from the IP that gets assigned? I'll have to poke around
> more...


Yea, looks like the "leased-address" string is the one I can
extract more data from to build the hostname.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables port forwarding for specific source addresses ynotssor Linux Networking 22 08-30-2008 03:52 AM
How to programmatically ban specific IP addresses Mike via WinServerKB.com Windows Networking 1 06-12-2008 03:51 AM
IP utility to scan a range of addresses? Dennis_S Windows Networking 4 12-18-2007 12:57 PM
DHCP Server Leasing Addresses to MAC Addresses of 00-00-00-00-00-00 nomorespameventhoughthejapanesespamgivesmeachuckle Linux Networking 9 12-05-2006 09:49 PM
Denying a range of IP addresses Donnie Burris Linux Networking 2 08-10-2006 03:17 PM



1 2 3 4 5 6 7 8 9 10 11