# DHCP and DNS
###### tags: `computer network`
## DHCP
DHCP could dynamically assign IP address to Host machine.
How exactly do DHCP works? This video would be a great reference [click here](https://www.youtube.com/watch?v=S43CFcpOZSI&t=259s&ab_channel=CertBros)
To summary the video, the step is as the following:
1. The host broadcast request for IP
2. The DHCP server get the request, broadcast the IP
3. Only the host requesting for IP get the IP offer, Then the host request to lease the IP
4. The DHCP server Ack the request
## DNS
`reference` [good playlist for understading DNS server](https://www.youtube.com/watch?v=3EvjwlQ43_4&list=PL5DDE6309C9057EEA&index=6&ab_channel=BarryBrown)
The main responsibility of DNS server is to convert the domain name to the IP address
### Terminology
* Domain Namepsace
* Zone
## How DNS work
See [here](https://www.youtube.com/watch?v=3EvjwlQ43_4&list=PL5DDE6309C9057EEA&index=6&ab_channel=BarryBrown) for detailed explanation. To summary the steps, when a host machine request the resource by domain name (such as www.google.com)
1. the request is forward to ISP
2. If the ISP do not know the IP of www.google.com (since it may be the first time to query, and the ISP do not have cache), it then forward to root name server (i.e. .)
3. If the root name server do not kneow the IP, it would forward to .com
4. If the .com do not know the reqeusted IP, it would forward to google.com (which it must know the IP)
5. The IP is forward back to ISP and cached, and the Ip is returned