当你接上因特网
When you’re connected to the internet
听音乐 玩线上游戏
and you are listening to music, playing online games
或浏览网页的时候
or browsing the web,
在这些场景的背后运行着许多标准协议
there are many standard protocols running behind the scenes,
来确保你的计算机能连接这些服务器
to make sure that your computer can indeed communicate with these services.
例如 因特网协议
There is for instance the Internet Protocol
或叫IP 负责从一台计算机向其它的计算机传送信息
or IP that is responsible for delivering messages from one computer to another.
这些信息也叫做包
These messages are also called packets
就像邮包
and just like postal packages
它们总是拥有发送者 接收者和有效负荷
They always havea sender, a receiver and a payload.
不过 不用街名和邮政编码
But instead of street names and postal codes,
因特网使用IP地址
the internet uses IP addresses and they look
看上去像是这样
something like this.
没有它们 计算机就不能彼此通信
Without them, computers can’t communicate with each other
也就意味着没有计算机网络
which means no computer networks
和没有因特网
and no internet.
那么 如果你打开油管
So if you open up YouTube,
你的计算机实际上向油管的IP地址发送了一条信息
your computer actually sends a message to YouTube’s IP address,
请求显示网页所需要的数据
asking for the data that it needs to show the webpage.
“但请稍等” 你说
“But wait a minute”, you say.
“当我想打开油管时 我只是在浏览器输入了YouTube.com
“ When I want to open YouTube I just enter youtube.com into my browser.
我不需要IP地址
I don’t need the IP address.
计算机是怎么知道地址的呢?”
So how does my computer know the address then?”
问得好
Well ! I’m Glad you asked!
在因特网的早期阶段(阿帕网)这个问题就被解决了
This issue was solved in the early days of the internet (ARPANET)
当时 斯坦福研究院创建了一个叫做“hosts.txt”的文档
when the Stanford Research Institute created a text file called “hosts.txt”.
该文件将youtube.com等名称翻译成
This file translated names like youtube.com,
计算机需要通信的IP地址
into the IP addresses that computers need to communicate.
然后 该文件被安装在所有连接到阿帕网的计算机上
The file was then installed on all the computers connected to the ARPANET
这样它们就可以将域名“翻译”成IP地址
so they could “ translate ” a domain name into an IP address.
然而 随着互联网的不断发展
However,as the internet kept growing,
计算机对这些域名的需求也在不断增长
so did the demand for these domain names.
管理主机文件的小团队很快就不堪重负了
The small team that was managing the hosts file was quickly overwhelmed
因此在1983年发布了一个规范来自动完成这项任务
and so in 1983 a specification was published to automate this task
于是DNS或“域名系统”便诞生了
and DNS or the “ Domain Name System ” was born.
DNS基本上是一个大型的互联网电话簿
DNS is basically a big phonebook for the internet,
将域名(如google.com)与IP地址相匹配
matching domain names like google.com to an IP address.
这个电话簿托管在分布于全球的DNS服务器上
This phonebook is hosted on DNS servers that are distributed across the world.
接下来让我们看一下
So let’s take a look at
当你想要访问www.google.com时会发生什么
what happens when you want to go to www.google.com.
首先 您的操作系统将域名分成多个部分
For starters your operating systems splits the domain name into multiple parts
或者也称为用点分隔的标签
or also called labels that are separated by dots.
在这种情况下 我们有三个标签:
So in this case we have three labels
“www” “google”和“com”
“ www ”, “ google ” and “ com ”.
他们创建了一个必须从右向左读取的层次结构
They create a hierarchy that has to be read from right to left.
最右边的标签叫做顶级域名
The right-most label is called the top-level domain,
在本例中是“com”
in this case “ com ”.
我们可以说“Google”是com的子域名
We can then say that “google” is a subdomain of “com”.
还可以说"www"是“Google”的子域名
and ” www” is a subdomain of”google".
要解析google.com的IP地址
To resolve the IP address of google.com,
您的计算机将访问根名称服务器
your computer reaches out to a root name server
然后问这个问题:“www.google.com”的IP地址是什么?
and asks the question: “What’s the IP address for “www.google.com”?
根名称服务器从不给出直接的答案
Root name servers never give a direct answer,
相反 它会给你推荐给更可能帮助你的服务器
instead they refer you to a server that is more likely to be able to help you.
在本例中 就是管着
In this case that’ll be the nameserver in charge
”.com”顶级域名的命名服务器
of the “ dot com ” top level domain.
你的计算机现在向“com”名称服务器询问同样的问题
Your computer now asks the same question to the “ com ” name server
而这个名称服务器可能会将您转到另一个名称服务器
and this one is likely to refer you to yet another name server.
这个例子中 它将再转到
In this case it will redirect you to
“google”托管的名称服务器上
a name server that Google itself hosts.
这个服务器很有可能
This one is very likely to be able
告诉计算机哪个IP地址连接到www.google.com
to tell what IP address is connected to www.google.com.
这种机制再加上域名的层次结构 使得DNS易扩展
This mechanism, along with the hierarchy of domain names makes DNS very scalable.
因为 毕竟
Because after all,
每个名称服务器只存储一小组IP地址
each name server only stores a small set of IP addresses.
” com “域名服务器对” org “上的网站一无所知
The “ com ” name servers don’t know anything about websites that are hosted on the “ org ” domain for instance.
就像电话簿一样
The phonebook analogy holds up here as well:
我的电话号码列在比利时的电话簿上
my phone number is listed in the Belgian phone book
但不在美国的电话簿上
but not in the US one.
但是 这样做有两个缺点
But there are however two drawbacks to this.
首先:
First of all:
这给根名称服务器带来了很大的压力
it puts a lot of pressure on the root name servers
因为每当有人想要连接到某个网站时 都会与它们联系
as they will be contacted every time someone wants to connect to a website
其次:设备需要能够链接到引用的来源
And secondly: devices need to be able to follow a referral,
来源从根服务器或其他名称服务器处获取
which it will get from root servers and perhaps other name servers as well.
这两个问题都被“递归解析器”解决了
Both these problems are solved by “recursive resolvers”.
这些是特殊的DNS服务器 将负责整个解析过程
These are special DNS servers that will take care of the entire resolving process.
你的设备不用再连接大量的名称服务器
Instead of having your devices contact multiple name servers,
只需要联系一个递归解析器就可以了
they just contact a recursive resolver which does it all for them.
它们通常由互联网服务提供商托管
They are often hosted by internet service providers
最近也由谷歌和Cloudflare等公司托管
and more recently are also hosted by companies like Google and Cloudflare.
大多数家用路由器都有双重功能 并且也可以作为递归解析器
Most home routers pull double duty and serve as a recursive resolver as well.
那么 我们的设备如何知道使用什么解析器呢?
So how do our devices know what resolver to use?
默认情况下 它们将使用由网络管理员配置的
Well by default they will use the one that is configured by the network administrator.
在您的ISP家庭网络中
In a home network that is your ISP
虽然它们可能会配置自己的解析器 但是您总是可以选择另一个解析器
and they’ll likely configure their own resolvers but you can always choose another one.
一些递归方式的解析器会比其他的解析器更快
Some recursive resolvers are faster than others,
所以切换到由谷歌或Cloudflare托管的解析器
so switching to a resolver hosted by Google or Cloudflare
可能会使你的连接的速度减缓
could give you a slight speed bump.
为了进一步加快DNS的速度
To speed up DNS even further,
递归解析器还有一个缓存
recursive resolvers also have a cache
它存储最频繁请求的域名的IP地址
which stores the IP address of domain names that are most frequently being requested.
当你在手机上访问Google.com时
When you go to google.com on your phone,
路由器上的递归解析器会查找谷歌的IP地址
the recursive resolver on your router will look up Google’s IP address
一旦找到了
and once it figures that out,
就把它存储在缓存中 以备将来参考
stores it in its cache for future reference.
如果你网络上的其他设备也想解析google.com
If another device on your network wants to resolve google.com as well,
你的路由器可以立刻给出一个答案
your router can instantly give an answer,
而不需要经历所有
without having to go through all the hoops
联系多个名称服务器的麻烦
of contacting multiple name servers.
虽然缓存可以大大提高
Caching can greatly increase the speed
DNS查询的速度 但也可能是有害的
of DNS queries but it can also be poisonous.
域名的IP地址的更改结果
Changes to the IP address of a domain name
不会立即在世界各地的域名上发生改变
aren’t immediately reflected across the world
因为旧地址仍然存储在
because the old address is still stored
许多递归解析器的缓存中
in the cache of many recursive resolvers.
为了解决这个问题
To combat this issue,
域所有者可以定义一个IP地址可以缓存多长时间
domain owners can define how long an IP address may be cached.
这称为TTL或生存时间 以秒为单位表示
This is called the TTL or time-to-live and is expressed in seconds.
如果缓存记录超出了给定TTL的时间
If a cache record is older than the given TTL,
解析器必须删除它
the resolver must delete it
然后必须再次使用传统的解析过程
after which it has to use the traditional resolving process again.
但是一些递归解析器不遵守这个TTL
But some recursive resolvers don’t adhere to this TTL
而是将记录保存在缓存中
and keep records in their cache
更长时间以减少负载
for a longer time to reduce the load.
上述做法是有问题的
This practice is problematic
因为网站所有者可能想要
for website owners wanting to change the IP addresses linked
改变链接到IP地址的域名
to their domain names.
但这只是个小问题
But that’s a minor hiccup.
很明显
It’s clear that
DNS是我们今天使用internet的主要基石
DNS is a major cornerstoneof the way we use the internet today.
它还有一些很酷的使用案例
It also has some cool alternative use cases.
例如 您可以使用自定义DNS服务器
You can for instance use a custom DNS server
来阻止广告或保护自己
to block advertisements or to protect yourself
免受传播恶意软件的域的攻击
from domains that spread malware.
听起来很复杂
Sounds complicated
但是你可以通过在树莓派上安装PiHole
but you can easily do it by installing PiHole on a Raspberry Pi
并将其插入到你的家庭网络中来轻松地做到这一点
and plugging it into your home network.
PiHole作为所有设备的递归DNS解析器
PiHole acts as a recursive DNS resolver for all your devices
当一个设备想解析ads.google.com时
and when a device wants to resolve ads.google.com for instance,
PiHole将返回一个本地IP地址
the PiHole will return a local IP address
并停止加载广告
and essentially stop the advertisement from loading.
真是天才的做法!
Genius!
以上是对域名系统的简要概述
So that’s a quick overview of the Domain Name System.
这是一个非常开放的系统
It’s a very open system
并且不可否认的是 它是一个使得网站对每个人来说都是可访问
and undeniably a protocol that makes the web accessible
以及易于使用的协议
and easy to use for everyone.
用容易记住的域名替换难记的IP地址
Replacing hard to remember IP addresses with easy to remember domain names.
这就是本期视频的全部内容
That was it for this video!
请在下面的评论中告诉我你的想法
Let me know what you thought about it in the comments below.
如果你喜欢这个视频
If you liked the video,
给它点赞 考虑订阅我的频道
give it a thumbs up and consider getting subscribed to my channel.
非常感谢您的收看 下次节目再见!
Thank you so much for watching and till next time!

相关热播

  • 2021-08-24什么是DNS当你接上因特网When you’re connected to the internet 听音乐 玩线上游戏and you are listening to music, playing online games 或浏览网页的时候or browsing the web, 在这些场景的背后运行着许多标准协议there are many standard protocols running behi..
  • 2021-08-24国外火热的“地理藏宝”游戏欢迎收看《IAYTD》Welcome to I Am Your Target Demographic and 今天我们要介绍“地理藏宝”这个户外藏宝游戏today we’re exploring a hobby known as Geocaching, 在任何地方都可以that can be done literally anywhere. 它是一种新的旅行方式It can be a fun w..
  • 2021-08-24迪士尼到底有多大?你正在收看的是冷流科技You are watching ColdFusion TV 冷流科技[Music playing] 大家好 欢迎再次收看ColdFusion视频栏目Hi, welcome to another ColdFusion video 当提到华特迪士尼的时候你会想到什么呢?What comes to your mind when I say Walt Disney? 有些人可能会..
  • 2021-08-24这个不可思议的轮椅能上下楼梯Scewo自平衡轮椅可爬楼梯 与乘坐者一起 去往轮椅以前未到达的地方 Scewo可应对寒冷天气和复杂地形 甚至可爬螺旋楼梯 一般的轮椅都得有斜坡辅助 Scewo可在城市住宅 房屋和公共场所运行良好 你可以在Patreon上支持Scewo众筹来帮助轮椅使用者
  • 2021-08-24震惊!跳伞运动员使用无人驾驶飞机据报道 这是世界上第一例使用无人机进行的高空跳伞 无人机升至海拔1000英尺的高空 拉脱维亚的Aerones公司建造了这台有28个螺旋桨的无人机 它将跳伞运动员因古斯·昂斯特卡恩从360英尺高的塔顶吊起 在起飞前 无人机持续升高了超过60秒 昂斯特卡恩放手后垂直落下 此无人机能载动超过400磅的重量 它需要三个人进行驾驶 一人负责飞行和与跳伞者交谈 一人负责控制高度和电量 一人负责紧急降落伞的展..
  • 2021-08-24大众公司有多大?你正在观看ColdFusion电视台You’re watching ColdFusion TV. 冷流科技[Music playing] 大家好 欢迎再次收看ColdFusion视频栏目Hi, welcome to another ColdFusion video. 大众汽车 地球人都知道的名字Volkswagon, pretty much everyone on the plane..
  • 2021-08-24区块链最大的输家——区块链系列3您正在收看的是冷流科技You are watching ColdFusion TV. 冷流科技[Music playing] 大家好 欢迎再次观看ColdFusion视频栏目Hi. Welcome to another ColdFusion video. 这是本频道关于区块链的第三个视频This is the third video about blockchain on this channe..
  • 2021-08-24为什么不要买便宜的充电线这里是《生活杀手锏》频道 这个视频将在九十秒内 解决你生活中常见的问题 我们不应该买十二美元五根的数据线 因为它们不可能物美价廉 开始吧 我该如何避免买到假数据线 说真的 你一定要小心那些便宜的数据线 它们会对你的手机造成危害 当给你的苹果或者安卓手机 买数据线时该注意些什么 买苹果手机数据线还是比较容易的 只要买有MFI认证的线就行了 MFI是苹果质检合格的第三方产品 要是想买安卓线那就有点麻..
  • 2021-08-24黏液菌对无人驾驶汽车的启发智慧并不必通过一个大脑袋来体现We know you don’t need one big brain to act smart. 就拿蚂蚁举例吧Take ants, for example. 它们搭建错综复杂的洞穴 觅食 斗争They build intricate colonies; they farm; they wage war. 一只蚂蚁只有一个小脑袋Each ant ha..
  • 2021-08-24智能厨房?这五件设施你值得拥有这五种最智能的厨房电器现在都能买到 这款名为琼的智能烤箱将确保你不会再烤坏任何东西 其售价为1500美元 它是一台一体化设备 能实现多种方式的烤炙 当肉烤熟了表皮自动变脆时 它的温度探针能探测到 琼的内置相机甚至能探测到你在制作什么并向你的手机发送更新状态 售价199美元的Pantelligent是一款能教你做饭的智能煎锅 它是由麻省理工学院的科学家开发 并与Pantelligent应用成对 此..
  • 2021-08-24苹果创始人之一沃兹尼亚克的人生标语“幸福=微笑-皱眉” 会是最适合刻进我的墓志铭的那句话 斯蒂夫·沃兹尼亚克向我们讲述了自己希望以何被世人记住 当时在设计的时候 我根本没想到(它会产生什么影响) 确实我们都没想到 Apple Ⅱ电脑会给世界带来深远影响 和在早期与之相伴的非凡技术突破 一切都打破了常规 它们都与课本上学到的完全不同 每每回想起来我都无比自豪 我甚至无法想象当时我是怎么做到的 有时看着我设计出的产品我会想 我怎么能..
  • 2021-08-24如何防止自己受到网络诈骗有一次我的手机开始出现奇怪的故障 这引起了我的注意So I started noticing, once my phone started glitching in a weird way. 以往我是不会在意的Which I would’ve paid no attention to. 后来 我收到一封来自PayPal的邮件地址Then I got a PayPal email to..

我要评论

    评论加载中...

译学馆所有视频和图片来自互联网版权归原创者所有。

加载中...