Community discussions

MikroTik App
 
moveik
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Tue Nov 24, 2020 1:16 am

DHCP Offer takes time to be sent to the client

Tue Feb 14, 2023 11:19 pm

I noticed in my Mikrotik device that the DHCP Server takes a lot of time to reply to DHCP Discovery messages.
With Wireshark on the client device, I tested multiple times and measured a delay of up to 140 seconds.

Using the firewall log, I noticed that the DHCP packets are *accepted* into the input chain (in other words, these are NOT dropped), therefore it isn't a firewall issue.

So I did an experiment:
  1. I shutdown the Mikrotik device via Webfig.
  2. Disconnected the Mikrotik device power cable.
  3. Waited about 10 seconds.
  4. Started Wireshark on the client device.
  5. Re-connected the Mikrotik device power cable.
  6. Waited until client received IP address.
  7. Inspected Wireshark and the Mikrotik Logs.

I got these findings:
  • From the client prespective, it took 79 seconds between the first DHCP packet that the client sent to the router ( = Mikrotik device) until the first DHCP Offer by the DHCP Server.
  • From the Mikrotik device perspective, from the Logs webpage: it took 55 seconds between the "link up" message (for the corresponding Ethernet port) until the DHCP IP Address assignment message (by the DHCP Server). The *same* time (55 seconds) it took for the DHCP firewall accept rule to log the DHCP Discovery packet that the client sent.

Is it normal that it takes this amount of time?
How much time is considered NOT normal?

Note that the client is sequentially sending *multiple* DHCP Discovery/Request packets (with a 2 seconds to 25 seconds delay between each packet) until the DHCP Offer is detected.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11598
Joined: Thu Mar 03, 2016 10:23 pm

Re: DHCP Offer takes time to be sent to the client

Wed Feb 15, 2023 3:09 pm

By doing steps #1 and #5 you are not benchmarking performance of mikrotik DHCP server but rather boot time of ROS. And yes, it does take some time for ROS device to boot (length depends on particular MT device type). Even if ROS kernel enables switch chip (and ports can get "link up"), other services (DHCP server included) do not necessarily start immediately after.

If you want to benchmark ROS DHCP server responsiveness in usual conditions (i.e. router is up&running, new client tries to join LAN), you should do the following:
  1. disconnect network cable between client device and ROS device
  2. wait for 10 seconds
  3. start wireshark on client device
  4. reconnect network cable between client and ROS device
  5. wait for client to receive IP address
  6. analyse wireshark log to see time interval between first DHCP discover and final DHCP ack

Time between points #4 and #5 again depend largely on two factors: a) performance of NIC drivers on client (detection of link) and b) configuration of bridge on ROS device (if bridge protocol is set to anything but "none" then bridge will take some time before finally enabling port due to loop detection).
 
moveik
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Tue Nov 24, 2020 1:16 am

Re: DHCP Offer takes time to be sent to the client

Wed Feb 15, 2023 5:07 pm

By doing steps #1 and #5 you are not benchmarking performance of mikrotik DHCP server but rather boot time of ROS. And yes, it does take some time for ROS device to boot (length depends on particular MT device type). Even if ROS kernel enables switch chip (and ports can get "link up"), other services (DHCP server included) do not necessarily start immediately after.

If you want to benchmark ROS DHCP server responsiveness in usual conditions (i.e. router is up&running, new client tries to join LAN), you should do the following:
  1. disconnect network cable between client device and ROS device
  2. wait for 10 seconds
  3. start wireshark on client device
  4. reconnect network cable between client and ROS device
  5. wait for client to receive IP address
  6. analyse wireshark log to see time interval between first DHCP discover and final DHCP ack

Time between points #4 and #5 again depend largely on two factors: a) performance of NIC drivers on client (detection of link) and b) configuration of bridge on ROS device (if bridge protocol is set to anything but "none" then bridge will take some time before finally enabling port due to loop detection).
This was my bridge configs:
https://imgur.com/GawS38E

I changed "Protocol Mode" from "RSTP" to "none" and then performed your test.
Unfortunately, it took 102 seconds until DHCP ACK was detected.
I can see with Wireshark that my client machine is detecting the DHCP Discover/Request etc. from the very beginning.

I also started a network traffic capture ("/tool sniffer") in the Mikrotik device before that I disconnected the network cable between client and ROS device.
But for some reason, the Mikrotik router detected only the last two DHCP Discover/Request packets and then it performs an assignment of an IP address.

Is it possible that my Mikrotik device has some physical malfunction / bug ?
 
moveik
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Tue Nov 24, 2020 1:16 am

Re: DHCP Offer takes time to be sent to the client

Wed Feb 15, 2023 7:46 pm

UPDATE:

I connected my old PC to the Mikrotik device and the DHCP Discover AND Offer happened instantly!
I tested it twice, and the DHCP "handshake" happened very fast (under two seconds).

I guess, something is wrong with the Ethernet port of my client's Motherboard.
I hope it isn't a physical issue.
Will need to take a further look on this.

Who is online

Users browsing this forum: ShindigNZ and 71 guests