Blocking multiple macs in dhcpd.conf

Issues related to configuring your network
Post Reply
vinmansbrew
Posts: 26
Joined: 2016/10/06 20:12:33

Blocking multiple macs in dhcpd.conf

Post by vinmansbrew » 2021/04/19 15:50:33

Ok, so I need to block multiple macs from obtaining an IP.
In my dhcpd.conf:
host name {
hardware ethernet (mac address);
deny booting;
}

Seems correct, and for 1 entry, it seems to work, and dhcpd restarts fine.
I add a second entry, exactly the same syntax, just different MAC, and dhcpd will not restart.
It tells me there is an error with what is essentially the last line, which is just "}"

What would the reason for this be? Syntax should be right, afaik.

I have also tried doing a class and adding subclasses:
class "black-hole" {
match substring (hardware, 1, 6);
# deny booting;
ignore booting;
}
subclass "black-hole" 00:12:ba:1d:c1:b7;
subclass "black-hole" 00:12:df:b6:7b:e7;

I seem to have an issue with that, as well.

It appears I may have gotten the black-hole to work. At least dhcpd restarted, I'll have to watch logs and see if the macs show up still.
However, I'd like to know what the issue with my first attempt was.

thoughts?
Last edited by vinmansbrew on 2021/04/19 16:22:12, edited 1 time in total.

User avatar
jlehtone
Posts: 3454
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Blocking multiple macs in dhcpd.conf

Post by jlehtone » 2021/04/19 16:02:40

Can you do it the other way; list allowed clients?

Code: Select all

        pool {
                deny unknown-clients;
                range A B;
        }

User avatar
TrevorH
Forum Moderator
Posts: 30628
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Blocking multiple macs in dhcpd.conf

Post by TrevorH » 2021/04/19 18:03:35

Works for me. I think you must have some other config error that causes it. I added

Code: Select all

  host blocked1
        {
        hardware ethernet       88:88:88:88:88:88;
        deny booting;
        }
  host blocked2
        {
        hardware ethernet       88:88:88:88:88:89;
        deny booting;
        }
to my config and did a restart.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

vinmansbrew
Posts: 26
Joined: 2016/10/06 20:12:33

Re: Blocking multiple macs in dhcpd.conf

Post by vinmansbrew » 2021/04/19 18:55:51

I see where yours is different. You have blocked1 and blocked2. I didn't number them.

User avatar
TrevorH
Forum Moderator
Posts: 30628
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Blocking multiple macs in dhcpd.conf

Post by TrevorH » 2021/04/19 19:18:27

They are hostnames and need to differ.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 8 - Networking Support”