LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   dhcp3 and mysql (http://www.linuxquestions.org/questions/linux-server-73/dhcp3-and-mysql-929544/)

suprstar 02-15-2012 03:25 PM

dhcp3 and mysql
 
I have ubuntu 10.04 LTS dhcp servers.

I have a mysql table of customers with a flag for if their cable modem is in bridge mode or route mode. I want to give all router modems a public ip address. I want to give all bridge modems a private 10.x.x.x ip, because whatever is behind the bridge will be getting the public ip, and I dont want all the cable modems eating away at my public ip space.

Is there any way to make dhcp3-server interface with mysql for such a purpose?

The only solution I can think of is using cron jobs to write a chunk of config to be included by dhcpd.conf. It would have to set a huge list of mac's to some dhcp3 class, where I can allow or deny in a shared-subnet with 2 sets (public and private) of pools. I'd like to accomplish this in real time by making dhcp3-server look this info up in mysql when it gets the request, possibly by setting a class. Is this possible?

TB0ne 02-16-2012 09:43 AM

Quote:

Originally Posted by suprstar (Post 4603364)
I have ubuntu 10.04 LTS dhcp servers.

I have a mysql table of customers with a flag for if their cable modem is in bridge mode or route mode. I want to give all router modems a public ip address. I want to give all bridge modems a private 10.x.x.x ip, because whatever is behind the bridge will be getting the public ip, and I dont want all the cable modems eating away at my public ip space.

Is there any way to make dhcp3-server interface with mysql for such a purpose?

The only solution I can think of is using cron jobs to write a chunk of config to be included by dhcpd.conf. It would have to set a huge list of mac's to some dhcp3 class, where I can allow or deny in a shared-subnet with 2 sets (public and private) of pools. I'd like to accomplish this in real time by making dhcp3-server look this info up in mysql when it gets the request, possibly by setting a class. Is this possible?

You can use dnsmasq for doling out DHCP addresses, and it can be used with a MySQL backend:

http://thekelleys.org.uk/dnsmasq/doc.html
http://tournasdimitrios1.wordpress.c...ices-on-linux/
(old, but may be useful) http://www.howtoforge.com/mydns_mydn...on_ubuntu_edgy

May not be exactly what you're looking for, though.

suprstar 02-21-2012 07:19 AM

Thanks, that looks interesting, but I see it's targeted at small lan's with up to 500 clients. This is for an ISP so scalability will probably be an issue..

I have this working in my lab environment:

Code:

class "BRIDGE" {
        match hardware;
}
subclass "BRIDGE" 1:00:16:7e:20:9d:38;
subclass "BRIDGE" 1:00:16:7e:70:31:82;
subclass "BRIDGE" 1:00:16:7e:4f:1a:a1;
subclass "BRIDGE" 1:00:16:7e:a7:b3:bf;
subclass "BRIDGE" 1:00:16:7e:92:ba:7f;
subclass "BRIDGE" 1:00:16:7e:c3:65:31;
...

All those subclass lines are written to a file and included by dhcpd.conf. I'm concerned how well this scales up as well - I could possibly have tens of thousands of mac's listed here. Is there going to be a performance problem? I have a quad core xeon 2.4GHz/8MB cache cpu and 8gb ram in each server. Each server is doing mainly dns and dhcp for the customers. Load levels are currently acceptable, adding this kind of config wouldn't have a big impact on performance would it?

TB0ne 02-21-2012 09:45 AM

Quote:

Originally Posted by suprstar (Post 4608169)
Thanks, that looks interesting, but I see it's targeted at small lan's with up to 500 clients. This is for an ISP so scalability will probably be an issue..

I have this working in my lab environment:

Code:

class "BRIDGE" {
        match hardware;
}
subclass "BRIDGE" 1:00:16:7e:20:9d:38;
subclass "BRIDGE" 1:00:16:7e:70:31:82;
subclass "BRIDGE" 1:00:16:7e:4f:1a:a1;
subclass "BRIDGE" 1:00:16:7e:a7:b3:bf;
subclass "BRIDGE" 1:00:16:7e:92:ba:7f;
subclass "BRIDGE" 1:00:16:7e:c3:65:31;
...

All those subclass lines are written to a file and included by dhcpd.conf. I'm concerned how well this scales up as well - I could possibly have tens of thousands of mac's listed here. Is there going to be a performance problem? I have a quad core xeon 2.4GHz/8MB cache cpu and 8gb ram in each server. Each server is doing mainly dns and dhcp for the customers. Load levels are currently acceptable, adding this kind of config wouldn't have a big impact on performance would it?

Honestly, I can't answer that. The biggest DHCP environment I've ever managed was for about 2,500 on a corporate LAN. You're trying to slay a different dragon. :)

If it was me, though, I'd implement it in a lab, and see how it goes, and watch the trends on load.


All times are GMT -5. The time now is 04:29 AM.