Community discussions

MikroTik App
 
PackElend
Member Candidate
Member Candidate
Topic Author
Posts: 269
Joined: Tue Sep 29, 2020 6:05 pm

DHCP Server, how /ip pool and /ip dhcp-server network are related to each other

Sat Jul 02, 2022 7:21 pm

Hi,
as I'm not that happy with the docs in regard to how the /ip/dhcp-server picks the right IP configuration defined in /ip/pool and /ip/dhcp-server network, I would like to share my interpretation, hoping it helps others as well.
Feel free to correct me.
  • IP pool can be any range, it does not have to much the intended subnet for the DHCP Server. Connections would just simply fail if /ip/pool and /ip dhcp-server network address are not within the same subnet.
  • DHCP Server identifies the intended network by the Address and Network (/ip/address) of the interface on which the DHCP Server shall run on
  • The /ip dhcp-server network which belongs to the DHCP-Server is identified by the match of /ip/address of DHCP Server's Interface and the defined Gateway in /ip dhcp-server network.
  • /ip dhcp-server network address defines Broadcast and Netmask address



documentation
https://wiki.mikrotik.com/wiki/Manual:IP/Pools
https://help.mikrotik.com/docs/display/ROS/IP+Pools
https://wiki.mikrotik.com/wiki/Manual:I ... r#Networks
https://help.mikrotik.com/docs/display/ ... CP-Network
Last edited by PackElend on Sat Jul 02, 2022 11:34 pm, edited 1 time in total.
 
sindy
Forum Guru
Forum Guru
Posts: 10205
Joined: Mon Dec 04, 2017 9:19 pm

Re: DHCP Server, how /ip pool and /ip dhcp-server network are related to each other

Sat Jul 02, 2022 11:03 pm

  • IP pool can be any range, it does not have to much the intended subnet for the DHCP Server. Connections would just simply fail if /ip/pool and /ip dhcp-server network address are not within the same subnet.
If the address assigned to the client from the pool doesn't match the address prefix of any /ip dhcp-server network row, the client will get that address with a /32 netmask and with no defaul gateway. That is the reason why the "connections would fail" - the client has an address, but since the netmask is /32, it has to use a route (gateway) for anything it wants to send, but it has got no gateway either.

  • DHCP Server identifies the intended network by the Address and Network (/ip/address) of the interface on which the DHCP Server shall run on
The DHCP server will assign an address from any pool attached to it, regardless the IP address(es) and netmask(s) attached to the same interface. The only way to choose a specific pool is currently to use an /ip dhcp-server vendor-class-id row.

  • The /ip dhcp-server network which belongs to the DHCP-Server is identified by the match of /ip/address of DHCP Server's Interface and the defined Gateway in /ip dhcp-server network.
The /ip dhcp-server network is a "profile" grouping additional parameters of the lease (default gateway, dns server list, ...); it is chosen by best match of its address parameter (a prefix) to the leased address. It does not relate to the address attached to the interface to which the DHCP server is attached.

  • /ip dhcp-server network address defines Broadcast address
The address item on the /ip dhcp-server network row is a prefix used to match against the leased address to choose the best matching row and to specify a netmask in the lease; the latter can be overridden by setting the netmask item on that row, e.g. if you use multiple /ip dhcp-server network rows to assign different individual options to devices from different vendors in the same subnet (vendor class id -> pool -> network).
 
PackElend
Member Candidate
Member Candidate
Topic Author
Posts: 269
Joined: Tue Sep 29, 2020 6:05 pm

Re: DHCP Server, how /ip pool and /ip dhcp-server network are related to each other

Sat Jul 02, 2022 11:42 pm

hey Sindy thx for the quick contribution / correction
  • DHCP Server identifies the intended network by the Address and Network (/ip/address) of the interface on which the DHCP Server shall run on
The DHCP server will assign an address from any pool attached to it, regardless the IP address(es) and netmask(s) attached to the same interface. The only way to choose a specific pool is currently to use an /ip dhcp-server vendor-class-id row.
  • The /ip dhcp-server network which belongs to the DHCP-Server is identified by the match of /ip/address of DHCP Server's Interface and the defined Gateway in /ip dhcp-server network.
The /ip dhcp-server network is a "profile" grouping additional parameters of the lease (default gateway, dns server list, ...); it is chosen by best match of its address parameter (a prefix) to the leased address. It does not relate to the address attached to the interface to which the DHCP server is attached.
I assumed the same in the first place but at a certain point, I took the wrong exit and began to build my theory :).
Thx for getting me back on track


.
  • /ip dhcp-server network address defines Broadcast address
The address item on the /ip dhcp-server network row is a prefix used to match against the leased address to choose the best matching row and to specify a netmask in the lease; the latter can be overridden by setting the netmask item on that row, e.g. if you use multiple /ip dhcp-server network rows to assign different individual options to devices from different vendors in the same subnet (vendor class id -> pool -> network).
thx for adding this
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19101
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DHCP Server, how /ip pool and /ip dhcp-server network are related to each other

Sun Jul 03, 2022 12:56 am

Wrong exit, or fell into the deep end of the pool......... couldnt resist the pun!!

Who is online

Users browsing this forum: CedrikAlton, dido1236, xristostsilis, xrlls and 84 guests