Fireship · @fireship

DNS Explained in 100 Seconds

Uploaded July 6, 2021 · Length 2:16

DNS Explained in 100 Seconds

Summary

dns explained in 100 seconds, how dns works, dns query process, dns records, a records, cname records, mx records, ns records.

  • dns explained
  • dns query
  • dns records
  • a records
  • cname records
  • mx records
  • ns records

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    the domain name system or dns is like

  2. 0:02

    the phone book of the internet it maps

  3. 0:04

    human readable urls or host names like

  4. 0:09

    www.fireship.io

  5. 0:10

    to the ip address of the server that

  6. 0:12

    hosts that site when you type a url into

  7. 0:14

    the browser

  8. 0:15

    it makes a dns query to figure out which

  9. 0:18

    unique ip address

  10. 0:19

    is associated with that hostname first

  11. 0:21

    it'll attempt to look in the local

  12. 0:22

    browser or operating system cache

  13. 0:25

    but if the cache is empty then we need

  14. 0:26

    to look up the ip address in the phone

  15. 0:28

    book which is the job of a server

  16. 0:30

    known as the dns recursive resolver it's

  17. 0:33

    recursive

  18. 0:33

    because it needs to make multiple

  19. 0:35

    requests to other servers starting with

  20. 0:37

    the root name server which itself will

  21. 0:39

    respond with the address of a top level

  22. 0:41

    domain dns server which stores data

  23. 0:43

    about top level domains like

  24. 0:45

    com or dot io the resolver makes a

  25. 0:47

    request there which will respond with

  26. 0:49

    the ip address of the authoritative name

  27. 0:51

    server

  28. 0:52

    that's the final source of truth that

  29. 0:53

    contains the requested website's ip

  30. 0:55

    address that gets sent back down to the

  31. 0:57

    client

  32. 0:58

    and is cached for future use that sounds

  33. 1:00

    complicated but it all happens within a

  34. 1:02

    fraction of a second

  35. 1:03

    you can think of it as a globally

  36. 1:04

    distributed database that handles more

  37. 1:06

    requests than any other database in the

  38. 1:08

    world

  39. 1:08

    when you register a domain name it's

  40. 1:10

    handled by a registrar

  41. 1:12

    accredited by the non-profit

  42. 1:13

    organization icann the record is then

  43. 1:15

    maintained by a registry operator who

  44. 1:18

    stores your dns settings and propagates

  45. 1:20

    them to

  46. 1:20

    other dns servers around the world as

  47. 1:22

    the registrant you'll be assigned a zone

  48. 1:24

    file where you can configure

  49. 1:26

    the settings of your domain every zone

  50. 1:28

    has a startup authority record

  51. 1:29

    to tell other dns servers who's in

  52. 1:31

    charge of that domain

  53. 1:32

    but most importantly we have the a

  54. 1:34

    record it means address

  55. 1:36

    and maps a domain or subdomain to the ip

  56. 1:38

    address of its host

  57. 1:39

    in other cases though we may want to

  58. 1:41

    forward a domain to another domain on

  59. 1:43

    the internet

  60. 1:44

    instead of an ip address in which case a

  61. 1:46

    canonical name or cname record would be

  62. 1:48

    used

  63. 1:49

    we have mx records for email and we can

  64. 1:51

    store arbitrary data with text records

  65. 1:53

    which is

  66. 1:54

    often used to communicate with third

  67. 1:55

    parties to verify ownership of the

  68. 1:57

    domain and finally we have the ns or