can you explain in DHCP dora process how discover ,offer, request and ack massages send on L2 ? i know all 4 massages will be broadcast on L3 but on L2 how they will transfer (unicast or broadcast)
DHCP works in a client / server model. See this packet capture for reference: https://www.cloudshark.org/captures/c109b95db0af
The client encapsulates the Discover message in Ethernet II and transmits it via the MAC address FF:FF:FF:FF:FF:FF (L2 broadcast).
The DHCP server receives the client request and it will reply with an Offer using the source MAC address located on the Discover message (L2 unicast).
Based on this packet capture the client sends the DHCP Discover and Request messages as L2 broadcast. The DHCP server uses L2 unicast.
Note: The client sends the Request message as a broadcast even though it should know the mac address of the DHCP server after it received the Offer. The client should have an entry on it's ARP table. I think this behavior depends on the client OS but I'm not 100% sure on this.
ARP (Address Resolution Protocol) is what is used to resolve a layer-3 address to a layer-2 address. The ARP process for a host will send out an ARP request to get the layer-2 address for a layer-3 address. When you have a layer-3 broadcast address, that will not work because no host will claim the layer-3 broadcast address. That means that when you broadcast at layer-3, you must broadcast at layer-2 because it is not possible to resolve a layer-3 broadcast address to a layer-2 unicast address.
Having said that, there are variation of DHCP where only some of the DHCP messages are broadcast. Unfortunately, protocols above OSI layer-4, e.g. DHCP, are explicitly off-topic here.