dhcpd.conf logical hierachy

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

dhcpd.conf logical hierachy

Narcis Garcia
In a Debian 9 host, I receive warnings like:
Dynamic and static leases present for 172.16.20.201.
Remove host declaration printer_1 or remove 172.16.20.201
from the dynamic address pool for 172.16.0.0/16

I'm trying to combine static reservations with dynamic assignment in
same subnet:

authoritative;
use-host-decl-names on;
server-name "equilibri.cpu.actiu.net";
subnet 172.16.0.0 netmask 255.255.0.0 {
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        option ntp-servers 172.16.20.100;
        pool {
                # IP range to be assigned dinamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
        pool {
                # IP range to be assigned statically
                range 172.16.20.0 172.16.20.149;
                range 172.16.20.190 172.16.20.255;
                deny unknown-clients;
#                deny all clients;
                group MyReservations {
                        host printer_1 {  # Impressora
                                hardware ethernet **:**:**:**:**:**;
                                fixed-address 172.16.20.201;
                                option host-name "printer_1";
                        }
                }
        }
}

But I've not clear if "group" and "host" work inside "pool", or what
else is the problem.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Simon Hobson
Narcis Garcia <[hidden email]> wrote:

> In a Debian 9 host, I receive warnings like:
> Dynamic and static leases present for 172.16.20.201.
> Remove host declaration printer_1 or remove 172.16.20.201
> from the dynamic address pool for 172.16.0.0/16

That was put in a long time ago to deal with a common misconfiguration that keeps popping up and causing problems - especially where people learned on the defective and limited Microsoft server.

> I'm trying to combine static reservations with dynamic assignment in
> same subnet:
>
> authoritative;
> use-host-decl-names on;
> server-name "equilibri.cpu.actiu.net";
> subnet 172.16.0.0 netmask 255.255.0.0 {
>        option routers 172.16.20.100;
>        option broadcast-address 172.16.255.255;
>        option domain-name-servers 172.16.21.61;
>        option ntp-servers 172.16.20.100;
>        pool {
>                # IP range to be assigned dinamically
>                range 172.16.20.150 172.16.20.189;
>                allow unknown-clients;
>        }
>        pool {
>                # IP range to be assigned statically
>                range 172.16.20.0 172.16.20.149;
>                range 172.16.20.190 172.16.20.255;
>                deny unknown-clients;
> #                deny all clients;
>                group MyReservations {
>                        host printer_1 {  # Impressora
>                                hardware ethernet **:**:**:**:**:**;
>                                fixed-address 172.16.20.201;
>                                option host-name "printer_1";
>                        }
>                }
>        }
> }
>
> But I've not clear if "group" and "host" work inside "pool", or what
> else is the problem.

You need to do exactly what the message says - remove the address from the pool, or remove it from the host declaration. To do the former you need to split your pool like this :

pool {
  range 172.16.20.190 172.16.20.200;
  range 172.16.20.202 172.16.20.255;
}

Also, you should move your host declarations outside of the subnets - they are always global in scope but by putting them inside a subnet you can get some "interesting" inheritance issues that will have you pulling your hair out (think, get address from one subnet, default router from another !)

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
Do you mean this setup for example?

authoritative;
use-host-decl-names on;
server-name "director.example.net";
subnet 172.16.0.0 netmask 255.255.0.0 {
        # IP range to be assigned dinamically
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        option ntp-servers 172.16.20.100;
        pool {
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
}
group MyReservations {
# Without defining subnet/mask ?!
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        option ntp-servers 172.16.20.100;
        host printer_1 {
                hardware ethernet **:**:**:**:**:**;
                fixed-address 172.16.20.201;
                option host-name "printer_1";
        }
}




El 14/10/17 a les 18:11, Simon Hobson ha escrit:

> Narcis Garcia <[hidden email]> wrote:
>
>> In a Debian 9 host, I receive warnings like:
>> Dynamic and static leases present for 172.16.20.201.
>> Remove host declaration printer_1 or remove 172.16.20.201
>> from the dynamic address pool for 172.16.0.0/16
>
> That was put in a long time ago to deal with a common misconfiguration that keeps popping up and causing problems - especially where people learned on the defective and limited Microsoft server.
>
>> I'm trying to combine static reservations with dynamic assignment in
>> same subnet:
>>
>> authoritative;
>> use-host-decl-names on;
>> server-name "director.example.net";
>> subnet 172.16.0.0 netmask 255.255.0.0 {
>>        option routers 172.16.20.100;
>>        option broadcast-address 172.16.255.255;
>>        option domain-name-servers 172.16.21.61;
>>        option ntp-servers 172.16.20.100;
>>        pool {
>>                # IP range to be assigned dinamically
>>                range 172.16.20.150 172.16.20.189;
>>                allow unknown-clients;
>>        }
>>        pool {
>>                # IP range to be assigned statically
>>                range 172.16.20.0 172.16.20.149;
>>                range 172.16.20.190 172.16.20.255;
>>                deny unknown-clients;
>> #                deny all clients;
>>                group MyReservations {
>>                        host printer_1 {  # Impressora
>>                                hardware ethernet **:**:**:**:**:**;
>>                                fixed-address 172.16.20.201;
>>                                option host-name "printer_1";
>>                        }
>>                }
>>        }
>> }
>>
>> But I've not clear if "group" and "host" work inside "pool", or what
>> else is the problem.
>
> You need to do exactly what the message says - remove the address from the pool, or remove it from the host declaration. To do the former you need to split your pool like this :
>
> pool {
>   range 172.16.20.190 172.16.20.200;
>   range 172.16.20.202 172.16.20.255;
> }
>
> Also, you should move your host declarations outside of the subnets - they are always global in scope but by putting them inside a subnet you can get some "interesting" inheritance issues that will have you pulling your hair out (think, get address from one subnet, default router from another !)
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Simon Hobson
Narcis Garcia <[hidden email]> wrote:

> Do you mean this setup for example?
>
> authoritative;
> use-host-decl-names on;
> server-name "director.example.net";
> subnet 172.16.0.0 netmask 255.255.0.0 {
>        # IP range to be assigned dinamically
>        option routers 172.16.20.100;
>        option broadcast-address 172.16.255.255;
>        option domain-name-servers 172.16.21.61;
>        option ntp-servers 172.16.20.100;
>        pool {
>                range 172.16.20.150 172.16.20.189;
>                allow unknown-clients;
>        }
> }
> group MyReservations {
> # Without defining subnet/mask ?!
>        option routers 172.16.20.100;
>        option broadcast-address 172.16.255.255;
>        option domain-name-servers 172.16.21.61;
>        option ntp-servers 172.16.20.100;
>        host printer_1 {
>                hardware ethernet **:**:**:**:**:**;
>                fixed-address 172.16.20.201;
>                option host-name "printer_1";
>        }
> }

Don't define things like routers in the group. All you need to define here is the IP address of each host - the routers, broadcast, DNS etc are all inherited from the subnet the IP address belongs in. You can redefine options if you need them to be different, but in this case, all four of the options you've defined are the same as would be inherited.

While it won't break anything, it's duplication of settings and that leaves scope for changing one and missing that there's another copy that needs changing - perhaps years down the line when you've completely forgotten how/why you configured it.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
El 15/10/17 a les 23:03, Simon Hobson ha escrit:

> Narcis Garcia <[hidden email]> wrote:
>
>> Do you mean this setup for example?
>>
>> authoritative;
>> use-host-decl-names on;
>> server-name "director.example.net";
>> subnet 172.16.0.0 netmask 255.255.0.0 {
>>        # IP range to be assigned dinamically
>>        option routers 172.16.20.100;
>>        option broadcast-address 172.16.255.255;
>>        option domain-name-servers 172.16.21.61;
>>        option ntp-servers 172.16.20.100;
>>        pool {
>>                range 172.16.20.150 172.16.20.189;
>>                allow unknown-clients;
>>        }
>> }
>> group MyReservations {
>> # Without defining subnet/mask ?!
>>        option routers 172.16.20.100;
>>        option broadcast-address 172.16.255.255;
>>        option domain-name-servers 172.16.21.61;
>>        option ntp-servers 172.16.20.100;
>>        host printer_1 {
>>                hardware ethernet **:**:**:**:**:**;
>>                fixed-address 172.16.20.201;
>>                option host-name "printer_1";
>>        }
>> }
>
> Don't define things like routers in the group. All you need to define here is the IP address of each host - the routers, broadcast, DNS etc are all inherited from the subnet the IP address belongs in. You can redefine options if you need them to be different, but in this case, all four of the options you've defined are the same as would be inherited.
>
> While it won't break anything, it's duplication of settings and that leaves scope for changing one and missing that there's another copy that needs changing - perhaps years down the line when you've completely forgotten how/why you configured it.
>

Do you mean the [group] outside of [subnet] inherits parameters from
previous clauses?

Anyway, is this a valid (or best) setup to split dynamic and static
definitions for same subnet?
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Simon Hobson
Narcis Garcia <[hidden email]> wrote:

> Do you mean the [group] outside of [subnet] inherits parameters from
> previous clauses?

No
The config file isn't parsed "top to bottom" in terms of how things are evaluated when a request comes in from a client, or put another way, the order of sections within the file isn't important.

The inheritance is based on scopes. So taking your specific example, printer_1 does a DHCP Discover and the server does two things :
It uses the incoming interface (directly connected clients) or Gateway Interface Address (if coming via a relay) to identify the subnet (or shared network) to which the client is connected.
It evaluates classes and host declarations to see if it matches - in this case it will match a host declaration with a fixed address.

As the fixed address is valid for the subnet to which the client is connected (assuming it's plugged into the right network) then the address will be assigned, the client will be "put into" that subnet, and all the subnet (and possibly shared network) options will be applied. Then any group and host declaration options will be applied.

If you were to plug the printer into a different network (subnet) served by the same server, then the fixed address assignment would be ignored (not valid for the subnet) but other options declared in the host declaration and group would still be applied and over-ride the subnet/shared network/global options.


I would recommend that you find a copy of "The DHCP Handbook" by Ralph Droms and Ted Lemon which is more or less the definitive guide to how DHCP works - and specifically the ISC server. It's in it's second edition, but that only really adds the failover stuff so the original version will cover what you need.


> Anyway, is this a valid (or best) setup to split dynamic and static
> definitions for same subnet?

Yes. You can mix and match dynamic pools and fixed addresses as much as you want as long as there is no overlap. As I showed earlier, if you want a fixed address in the middle of a range then you just have to split the range to omit that address from it - you can have multiple ranges in a pool.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
As I've understood for my poor english, [subnet] declaration has no much
sense because both subnet and netmask are determined by incoming
interface's data.

Then I suppose this specification structure with a group should be better:

authoritative;
server-name "director.example.net";
group MyInterface1 {
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        pool {
                # IP range to be assigned dinamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
        pool {
                # IP ranges to be assigned statically
                range 172.16.20.0 172.16.20.149;
                range 172.16.20.190 172.16.20.255;
                deny unknown-clients;
                host printer_1 {
                        hardware ethernet 00:11:22:33:44:55;
                        fixed-address 172.16.20.201;
                }
        }
}



El 16/10/17 a les 10:35, Simon Hobson ha escrit:

> Narcis Garcia <[hidden email]> wrote:
>
>> Do you mean the [group] outside of [subnet] inherits parameters from
>> previous clauses?
>
> No
> The config file isn't parsed "top to bottom" in terms of how things are evaluated when a request comes in from a client, or put another way, the order of sections within the file isn't important.
>
> The inheritance is based on scopes. So taking your specific example, printer_1 does a DHCP Discover and the server does two things :
> It uses the incoming interface (directly connected clients) or Gateway Interface Address (if coming via a relay) to identify the subnet (or shared network) to which the client is connected.
> It evaluates classes and host declarations to see if it matches - in this case it will match a host declaration with a fixed address.
>
> As the fixed address is valid for the subnet to which the client is connected (assuming it's plugged into the right network) then the address will be assigned, the client will be "put into" that subnet, and all the subnet (and possibly shared network) options will be applied. Then any group and host declaration options will be applied.
>
> If you were to plug the printer into a different network (subnet) served by the same server, then the fixed address assignment would be ignored (not valid for the subnet) but other options declared in the host declaration and group would still be applied and over-ride the subnet/shared network/global options.
>
>
> I would recommend that you find a copy of "The DHCP Handbook" by Ralph Droms and Ted Lemon which is more or less the definitive guide to how DHCP works - and specifically the ISC server. It's in it's second edition, but that only really adds the failover stuff so the original version will cover what you need.
>
>
>> Anyway, is this a valid (or best) setup to split dynamic and static
>> definitions for same subnet?
>
> Yes. You can mix and match dynamic pools and fixed addresses as much as you want as long as there is no overlap. As I showed earlier, if you want a fixed address in the middle of a range then you just have to split the range to omit that address from it - you can have multiple ranges in a pool.
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
In reply to this post by Narcis Garcia
Better now?

shared-network MyMap_interface1 {
        subnet 172.16.0.0 netmask 255.255.0.0 {
                option routers 172.16.20.100;
                option broadcast-address 172.16.255.255;
                option domain-name-servers 172.16.21.61;
                pool {
                        # IP range to be assigned dynamically
                        range 172.16.20.150 172.16.20.189;
                }
                pool {
                        # IP ranges to be assigned statically
                        range 172.16.20.0 172.16.20.149;
                        range 172.16.20.190 172.16.20.255;
                        deny unknown-clients;
                        host printer_1 {
                                hardware ethernet 00:11:22:33:44:55;
                                fixed-address 172.16.20.201;
                        }
                }
        }
}


Remember: My goal is to use dynamic and static specifications in same
subnet, and also avoid this error message:
Dynamic and static leases present for 172.16.20.201
Remove host declaration printer_1 or remove 172.16.20.201



El 18/10/17 a les 17:59, Bruce Hudson ha escrit:

> On Wed, Oct 18, 2017 at 05:43:04PM +0200, Narcis Garcia wrote:
>
>> As I've understood for my poor english, [subnet] declaration has no much
>> sense because both subnet and netmask are determined by incoming
>> interface's data.
>
>     If I understand you correctly, you are wrong. What you suggest is true
> only if the incoming requests were not relayed. If they have been forwarded
> by a relay, it is the gateway IP address in the packet that determines what
> subnet an IP address should be assigned from.
>
>     Even if there is no relay, it is possible to have multiple subnets share
> a single broadcast domain; specified in the DHCP configuration by putting
> the subnet declarations into a "shared-network" container.
>
>     In short, you need to be able to write declarations for multiple subnets.
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Bill Shirley-2
In reply to this post by Narcis Garcia
Do not define static address in a pool and define your hosts outside
your subnet:
authoritative;
use-host-decl-names on;
server-name "equilibri.cpu.actiu.net";
subnet 172.16.0.0 netmask 255.255.0.0 {
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        option ntp-servers 172.16.20.100;
        pool {
                # IP range to be assigned dinamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
}
group MyReservations {
    host printer_1 {  # Impressora
        hardware ethernet **:**:**:**:**:**;
        fixed-address 172.16.20.201;
        option host-name "printer_1";
    }
}
Your group statement above is not needed, it doesn't add
any configuration.

However...
group MyReservations {
    default-lease-time	21600;	# 6 hours
    host printer_1 {  # Impressora
        hardware ethernet **:**:**:**:**:**;
        fixed-address 172.16.20.201;
        option host-name "printer_1";
    }
    host printer_2 {  # Impressora
        hardware ethernet **:**:**:**:**:*2;
        fixed-address 172.16.20.202;
        option host-name "printer_2";
    }
}
This will give out a different default lease time for every device in the group.

Bill


On 10/14/2017 12:00 PM, Narcis Garcia wrote:
In a Debian 9 host, I receive warnings like:
Dynamic and static leases present for 172.16.20.201.
Remove host declaration printer_1 or remove 172.16.20.201
from the dynamic address pool for 172.16.0.0/16

I'm trying to combine static reservations with dynamic assignment in
same subnet:

authoritative;
use-host-decl-names on;
server-name "equilibri.cpu.actiu.net";
subnet 172.16.0.0 netmask 255.255.0.0 {
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        option ntp-servers 172.16.20.100;
        pool {
                # IP range to be assigned dinamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
        pool {
                # IP range to be assigned statically
                range 172.16.20.0 172.16.20.149;
                range 172.16.20.190 172.16.20.255;
                deny unknown-clients;
#                deny all clients;
                group MyReservations {
                        host printer_1 {  # Impressora
                                hardware ethernet **:**:**:**:**:**;
                                fixed-address 172.16.20.201;
                                option host-name "printer_1";
                        }
                }
        }
}

But I've not clear if "group" and "host" work inside "pool", or what
else is the problem.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Bruce Hudson
In reply to this post by Narcis Garcia
On Wed, Oct 18, 2017 at 07:21:15PM +0200, Narcis Garcia wrote:

> Better now?
>
> shared-network MyMap_interface1 {
>         subnet 172.16.0.0 netmask 255.255.0.0 {
>                 option routers 172.16.20.100;
>                 option broadcast-address 172.16.255.255;
>                 option domain-name-servers 172.16.21.61;
>                 pool {
>                         # IP range to be assigned dynamically
>                         range 172.16.20.150 172.16.20.189;
>                 }
>                 pool {
>                         # IP ranges to be assigned statically
>                         range 172.16.20.0 172.16.20.149;
>                         range 172.16.20.190 172.16.20.255;
>                         deny unknown-clients;
>                         host printer_1 {
>                                 hardware ethernet 00:11:22:33:44:55;
>                                 fixed-address 172.16.20.201;
>                         }
>                 }
>         }
> }
>
>
> Remember: My goal is to use dynamic and static specifications in same
> subnet, and also avoid this error message:
> Dynamic and static leases present for 172.16.20.201
> Remove host declaration printer_1 or remove 172.16.20.201

     The "shared-network" adds nothing with only one subnet but hurts
nothing. There is no problem with static and dynamic in the same subnet.
The issue is including the static IP addresses in your range statement.
To avoid the error, just do two (or three) range statements.

                > pool {
                >    range 172.16.20.190 172.16.20.200;
                >    range 172.16.20.202 172.16.20.255;
                >    ...
                > }

    Then put the host statements at the global scope level so they so not
accidentally inherit when they shouldn't.
--
Bruce A. Hudson | [hidden email]
ITS, Networks and Systems |
Dalhousie University |
Halifax, Nova Scotia, Canada | (902) 494-3405
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
Any way I define the static pool, error messages occur.
This is the only configuration I've reached without errors when a known
host connects, but I might not be defining subnet/interface where static
cases are attached to:

subnet 172.16.0.0 netmask 255.255.0.0 {
        option subnet-mask 255.255.0.0;
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        pool {
                # IP range to be assigned dynamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
}
group MyReservations {
        option subnet-mask 255.255.0.0;
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        host printer_1 {
                hardware ethernet 00:11:22:33:44:55;
                fixed-address 172.16.20.201;
        }
}


El 18/10/17 a les 20:37, Bruce Hudson ha escrit:

> On Wed, Oct 18, 2017 at 07:21:15PM +0200, Narcis Garcia wrote:
>
>> Better now?
>>
>> shared-network MyMap_interface1 {
>>         subnet 172.16.0.0 netmask 255.255.0.0 {
>>                 option routers 172.16.20.100;
>>                 option broadcast-address 172.16.255.255;
>>                 option domain-name-servers 172.16.21.61;
>>                 pool {
>>                         # IP range to be assigned dynamically
>>                         range 172.16.20.150 172.16.20.189;
>>                 }
>>                 pool {
>>                         # IP ranges to be assigned statically
>>                         range 172.16.20.0 172.16.20.149;
>>                         range 172.16.20.190 172.16.20.255;
>>                         deny unknown-clients;
>>                         host printer_1 {
>>                                 hardware ethernet 00:11:22:33:44:55;
>>                                 fixed-address 172.16.20.201;
>>                         }
>>                 }
>>         }
>> }
>>
>>
>> Remember: My goal is to use dynamic and static specifications in same
>> subnet, and also avoid this error message:
>> Dynamic and static leases present for 172.16.20.201
>> Remove host declaration printer_1 or remove 172.16.20.201
>
>      The "shared-network" adds nothing with only one subnet but hurts
> nothing. There is no problem with static and dynamic in the same subnet.
> The issue is including the static IP addresses in your range statement.
> To avoid the error, just do two (or three) range statements.
>
> > pool {
> >    range 172.16.20.190 172.16.20.200;
> >    range 172.16.20.202 172.16.20.255;
> >    ...
> > }
>
>     Then put the host statements at the global scope level so they so not
> accidentally inherit when they shouldn't.
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Bill Shirley-2
You do not need subnet-mask, router, broadcast-address, or domain-name-servers
in the group unless they override an option.  They will be supplied by the subnet.
Defining them in the group clause doesn't "hurt" anything though.

Bill

On 10/18/2017 3:19 PM, Narcis Garcia wrote:

> Any way I define the static pool, error messages occur.
> This is the only configuration I've reached without errors when a known
> host connects, but I might not be defining subnet/interface where static
> cases are attached to:
>
> subnet 172.16.0.0 netmask 255.255.0.0 {
>          option subnet-mask 255.255.0.0;
>          option routers 172.16.20.100;
>          option broadcast-address 172.16.255.255;
>          option domain-name-servers 172.16.21.61;
>          pool {
>                  # IP range to be assigned dynamically
>                  range 172.16.20.150 172.16.20.189;
>                  allow unknown-clients;
>          }
> }
> group MyReservations {
>          option subnet-mask 255.255.0.0;
>          option routers 172.16.20.100;
>          option broadcast-address 172.16.255.255;
>          option domain-name-servers 172.16.21.61;
>          host printer_1 {
>                  hardware ethernet 00:11:22:33:44:55;
>                  fixed-address 172.16.20.201;
>          }
> }
>
>
> El 18/10/17 a les 20:37, Bruce Hudson ha escrit:
>> On Wed, Oct 18, 2017 at 07:21:15PM +0200, Narcis Garcia wrote:
>>
>>> Better now?
>>>
>>> shared-network MyMap_interface1 {
>>>          subnet 172.16.0.0 netmask 255.255.0.0 {
>>>                  option routers 172.16.20.100;
>>>                  option broadcast-address 172.16.255.255;
>>>                  option domain-name-servers 172.16.21.61;
>>>                  pool {
>>>                          # IP range to be assigned dynamically
>>>                          range 172.16.20.150 172.16.20.189;
>>>                  }
>>>                  pool {
>>>                          # IP ranges to be assigned statically
>>>                          range 172.16.20.0 172.16.20.149;
>>>                          range 172.16.20.190 172.16.20.255;
>>>                          deny unknown-clients;
>>>                          host printer_1 {
>>>                                  hardware ethernet 00:11:22:33:44:55;
>>>                                  fixed-address 172.16.20.201;
>>>                          }
>>>                  }
>>>          }
>>> }
>>>
>>>
>>> Remember: My goal is to use dynamic and static specifications in same
>>> subnet, and also avoid this error message:
>>> Dynamic and static leases present for 172.16.20.201
>>> Remove host declaration printer_1 or remove 172.16.20.201
>>       The "shared-network" adds nothing with only one subnet but hurts
>> nothing. There is no problem with static and dynamic in the same subnet.
>> The issue is including the static IP addresses in your range statement.
>> To avoid the error, just do two (or three) range statements.
>>
>> > pool {
>> >    range 172.16.20.190 172.16.20.200;
>> >    range 172.16.20.202 172.16.20.255;
>> >    ...
>> > }
>>
>>      Then put the host statements at the global scope level so they so not
>> accidentally inherit when they shouldn't.
>>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Bob Harold
In reply to this post by Narcis Garcia

On Wed, Oct 18, 2017 at 3:19 PM, Narcis Garcia <[hidden email]> wrote:
Any way I define the static pool, error messages occur.

Maybe there a confusion in the words "static pool"
"pool" and "range" are used to define dynamic ranges.
"fixed-address" defines a static assignment.
 
This is the only configuration I've reached without errors when a known
host connects, but I might not be defining subnet/interface where static
cases are attached to:

subnet 172.16.0.0 netmask 255.255.0.0 {
        option subnet-mask 255.255.0.0;
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        pool {
                # IP range to be assigned dynamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
}
group MyReservations {

These four lines are redundant and should be removed: 
        option subnet-mask 255.255.0.0;
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
Delete the four lines above.
 
        host printer_1 {
                hardware ethernet 00:11:22:33:44:55;
                fixed-address 172.16.20.201;
        }
}


That looks good.  If you need a larger range, just remeber that the dynamic range and static fixed-addresses should no overlap.  So ranges like:
    range 172.16.20.190 172.16.20.200;
    range 172.16.20.202 172.16.20.255;

As others have said.

-- 
Bob Harold


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
How do I explicitly link the group MyReservations to that subnet and its
options?
What if some day I want to setup other subnets and other fixed hosts?


El 18/10/17 a les 21:33, Bob Harold ha escrit:

>
> On Wed, Oct 18, 2017 at 3:19 PM, Narcis Garcia <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Any way I define the static pool, error messages occur.
>
>
> Maybe there a confusion in the words "static pool"
> "pool" and "range" are used to define dynamic ranges.
> "fixed-address" defines a static assignment.
>  
>
>     This is the only configuration I've reached without errors when a known
>     host connects, but I might not be defining subnet/interface where static
>     cases are attached to:
>
>     subnet 172.16.0.0 netmask 255.255.0.0 {
>             option subnet-mask 255.255.0.0;
>             option routers 172.16.20.100;
>             option broadcast-address 172.16.255.255;
>             option domain-name-servers 172.16.21.61;
>             pool {
>                     # IP range to be assigned dynamically
>                     range 172.16.20.150 172.16.20.189;
>                     allow unknown-clients;
>             }
>     }
>     group MyReservations {
>
>
> These four lines are redundant and should be removed: 
>
>             option subnet-mask 255.255.0.0;
>             option routers 172.16.20.100;
>             option broadcast-address 172.16.255.255;
>             option domain-name-servers 172.16.21.61;
>
> Delete the four lines above.
>  
>
>             host printer_1 {
>                     hardware ethernet 00:11:22:33:44:55;
>                     fixed-address 172.16.20.201;
>             }
>     }
>
>
> That looks good.  If you need a larger range, just remeber that the
> dynamic range and static fixed-addresses should no overlap.  So ranges like:
>     range 172.16.20.190 172.16.20.200;
>     range 172.16.20.202 172.16.20.255;
>
> As others have said.
>
> -- 
> Bob Harold
>
>
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Bill Shirley-2
Why do you think you need to link the group to the subnet?  The fixed-address
of printer-1 ties it to the subnet.

For your 2nd question, add the subnets and hosts to dhcpd.conf. What problem
are you thinking about?

Bill

On 10/19/2017 2:52 AM, Narcis Garcia wrote:

> How do I explicitly link the group MyReservations to that subnet and its
> options?
> What if some day I want to setup other subnets and other fixed hosts?
>
>
> El 18/10/17 a les 21:33, Bob Harold ha escrit:
>> On Wed, Oct 18, 2017 at 3:19 PM, Narcis Garcia <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>      Any way I define the static pool, error messages occur.
>>
>>
>> Maybe there a confusion in the words "static pool"
>> "pool" and "range" are used to define dynamic ranges.
>> "fixed-address" defines a static assignment.
>>  
>>
>>      This is the only configuration I've reached without errors when a known
>>      host connects, but I might not be defining subnet/interface where static
>>      cases are attached to:
>>
>>      subnet 172.16.0.0 netmask 255.255.0.0 {
>>              option subnet-mask 255.255.0.0;
>>              option routers 172.16.20.100;
>>              option broadcast-address 172.16.255.255;
>>              option domain-name-servers 172.16.21.61;
>>              pool {
>>                      # IP range to be assigned dynamically
>>                      range 172.16.20.150 172.16.20.189;
>>                      allow unknown-clients;
>>              }
>>      }
>>      group MyReservations {
>>
>>
>> These four lines are redundant and should be removed:
>>
>>              option subnet-mask 255.255.0.0;
>>              option routers 172.16.20.100;
>>              option broadcast-address 172.16.255.255;
>>              option domain-name-servers 172.16.21.61;
>>
>> Delete the four lines above.
>>  
>>
>>              host printer_1 {
>>                      hardware ethernet 00:11:22:33:44:55;
>>                      fixed-address 172.16.20.201;
>>              }
>>      }
>>
>>
>> That looks good.  If you need a larger range, just remeber that the
>> dynamic range and static fixed-addresses should no overlap.  So ranges like:
>>      range 172.16.20.190 172.16.20.200;
>>      range 172.16.20.202 172.16.20.255;
>>
>> As others have said.
>>
>> --
>> Bob Harold
>>
>>
>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
subnet 172.16.0.0 netmask 255.255.0.0 { # For eth0=172.16.20.100
        ...
        pool {
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
}
subnet 192.168.2.0 netmask 255.255.255.0 { # For eth0=172.16.20.100
        ...
        pool {
                range 192.168.2.3 192.168.2.199;
                allow unknown-clients;
        }
}
host printer_1 {
        hardware ethernet 00:11:22:33:44:55;
        fixed-address 172.16.20.201;
}
host printer_2 {
        hardware ethernet 22:33:44:55:66:77;
        fixed-address 192.168.2.220;
}


El 19/10/17 a les 09:19, Bill Shirley ha escrit:

> Why do you think you need to link the group to the subnet?  The
> fixed-address
> of printer-1 ties it to the subnet.
>
> For your 2nd question, add the subnets and hosts to dhcpd.conf. What
> problem
> are you thinking about?
>
> Bill
>
> On 10/19/2017 2:52 AM, Narcis Garcia wrote:
>> How do I explicitly link the group MyReservations to that subnet and its
>> options?
>> What if some day I want to setup other subnets and other fixed hosts?
>>
>>
>> El 18/10/17 a les 21:33, Bob Harold ha escrit:
>>> On Wed, Oct 18, 2017 at 3:19 PM, Narcis Garcia <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>>      Any way I define the static pool, error messages occur.
>>>
>>>
>>> Maybe there a confusion in the words "static pool"
>>> "pool" and "range" are used to define dynamic ranges.
>>> "fixed-address" defines a static assignment.
>>>  
>>>      This is the only configuration I've reached without errors when
>>> a known
>>>      host connects, but I might not be defining subnet/interface
>>> where static
>>>      cases are attached to:
>>>
>>>      subnet 172.16.0.0 netmask 255.255.0.0 {
>>>              option subnet-mask 255.255.0.0;
>>>              option routers 172.16.20.100;
>>>              option broadcast-address 172.16.255.255;
>>>              option domain-name-servers 172.16.21.61;
>>>              pool {
>>>                      # IP range to be assigned dynamically
>>>                      range 172.16.20.150 172.16.20.189;
>>>                      allow unknown-clients;
>>>              }
>>>      }
>>>      group MyReservations {
>>>
>>>
>>> These four lines are redundant and should be removed:
>>>
>>>              option subnet-mask 255.255.0.0;
>>>              option routers 172.16.20.100;
>>>              option broadcast-address 172.16.255.255;
>>>              option domain-name-servers 172.16.21.61;
>>>
>>> Delete the four lines above.
>>>  
>>>              host printer_1 {
>>>                      hardware ethernet 00:11:22:33:44:55;
>>>                      fixed-address 172.16.20.201;
>>>              }
>>>      }
>>>
>>>
>>> That looks good.  If you need a larger range, just remeber that the
>>> dynamic range and static fixed-addresses should no overlap.  So
>>> ranges like:
>>>      range 172.16.20.190 172.16.20.200;
>>>      range 172.16.20.202 172.16.20.255;
>>>
>>> As others have said.
>>>
>>> -- 
>>> Bob Harold
>>>
>>>
>>>
>>> _______________________________________________
>>> dhcp-users mailing list
>>> [hidden email]
>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Simon Hobson
Narcis Garcia <[hidden email]> wrote:

> subnet 172.16.0.0 netmask 255.255.0.0 { # For eth0=172.16.20.100
>        ...
>        pool {
>                range 172.16.20.150 172.16.20.189;
>                allow unknown-clients;
>        }
> }
> subnet 192.168.2.0 netmask 255.255.255.0 { # For eth0=172.16.20.100
>        ...
>        pool {
>                range 192.168.2.3 192.168.2.199;
>                allow unknown-clients;
>        }
> }
> host printer_1 {
>        hardware ethernet 00:11:22:33:44:55;
>        fixed-address 172.16.20.201;
> }
> host printer_2 {
>        hardware ethernet 22:33:44:55:66:77;
>        fixed-address 192.168.2.220;
> }

That's it - almost, lets ignore the 192.168.2.0 subnet for the moment.

The server will automagically "do the right thing" in terms of matching a fixed-address with the appropriate subnet. So printer 1 will automatically be associated with the 172.16.0.0 subnet and inherit the appropriate options (eg routers).

To be a bit more precise ...
It's not the fixed-address declaration that links them, it's the fact the the device is connected to the appropriate network.

As I said earlier, when the DHCP packets come in, the server will determine where the client is based on either the interface (if it's directly connected), or using the GI-Addr field if the packet has been relayed. So it gets a packet from printer 1, find that it's directly attached to eth0, and associates it with the 172.16.0.0 subnet - at which point, all the options defined for that subnet will get applied.

The server will also find the host statement matching it's hardware address, and will assign it the fixed-address as this is valid for the subnet. If any options are defined for the host (or an enclosing group) then these will over-ride anything configured for the subnet.
IIRC, if the fixed-address is not valid for the subnet (eg someone has moved printer 1 to a different network also served by this DHCP server), then the fixed-address will be ignored but the rest of the host statement will be applied. You can also specify multiple addresses for the fixed-address statement and the server will pick one that is valid for the network the device is attached to.

No, about that 192.168.2.0 subnet. Your comment says that this is also attached to eth0.
If this is the case, then you need to wrap the two subnets in a shared network statement - this is exactly the situation the shared network is designed to deal with, 2 (or more) IP subnets on the same physical network (or to be precise, collision domain).
However, if it is the other side of a router and the packets are being relayed to the server, then this is not a shared network.
It's important to correctly define the network so what the DHCP server knows about matches the actual network topology.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: dhcpd.conf logical hierachy

Narcis Garcia
In reply to this post by Bob Harold
Thank you very much Simon Hobson, Bruce Hudson, Bill Shirley and Bob
Harold, to help me to understand better the dhcpd.conf clauses organization.

I hope some day I'll be helpful for others in this area.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users