LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Force DHCP To Refuse Clients A DHCP Lease Depending On Client MAC Address (http://www.linuxquestions.org/questions/linux-server-73/force-dhcp-to-refuse-clients-a-dhcp-lease-depending-on-client-mac-address-576744/)

blackfish 08-13-2007 09:14 AM

Force DHCP To Refuse Clients A DHCP Lease Depending On Client MAC Address
 
Hi,

I have a setup at home where I have a network consisting of two servers each on a different subnet. There is one linux server between the two subnets that runs as a DHCP Server. One of my other servers also runs DHCP Server. This is a Windows server.

The problem I have is that I want to be able to make the Linux Server refuse IP addresses that should be handled on the other subnet. The two subnets are using the same media between the server room in the garage and the main house and I have no way of being able to change this as the is only one trunk cable.

I have configured my Windows Server to only allow clients listed in the reservations section to obtain DHCP leases on subnet 2 server

The Linux server I am using as a firewall, It has three NIC's installed:

Card One - Internet (WAN)
Card Two - Subnet 1 (General LAN)
Card Three - Subnet 2 (DMZ LAN)

Unfortunately As I mentioned above these two subnets share the same cable from the server room to the house.

So, My question is:

Can I make my linux server on subnet 1 refuse DHCP leases to clients in subnet 2 if i somehow program the MAC addresses of the clients into the Server? If it can be done, How can this be Done?

Any help will be much apprieciated :)

Many Thanks,

Blackfish

jeenam 08-13-2007 01:55 PM

Use iptables with the MAC match: http://iptables-tutorial.frozentux.n....html#MACMATCH

e.g. iptables -A INPUT -p UDP --destination-port 67:68 -m mac --mac-source XX:XX:XX:XX:XX:XX -j DROP

Add a rule for each mac address of the machines that the DHCP server should not service.

finegan 08-13-2007 03:41 PM

Hate to just reply with a link, but this is what you're looking for:

http://www.linuxmanpages.com/man5/dhcpd.conf.5.php

The location of dhcpd.conf varies from distro to distro, usually in /etc/ or /etc/dhcp. You probably just want to put in a group with a bunch of declared mac to host mappings.

-Finegan

blackfish 08-17-2007 12:54 AM

Quote:

Originally Posted by finegan (Post 2857745)
Hate to just reply with a link, but this is what you're looking for:

http://www.linuxmanpages.com/man5/dhcpd.conf.5.php

Thanks very much, thats exactly what I wanted :)

Many Thanks,

Blackfish


All times are GMT -5. The time now is 07:33 PM.