以前寫過一篇博文,利用github pages五分鐘建好我的網站+我的博客 ,在這篇
博文裏,作了一件什麼事呢?git
github pages
和Jekyll
建立了我的網站,這個我的網站的原始域名是: logos23333.github.io
logos23333.top
域名logos23333.top
與logos23333.github.io
綁定,當用戶在瀏覽器鍵入logos23333.top
時,自動解析到logos23333.github.io
我如今是大二下,開了computer networking 這門課程,因此我就想着用所學的知識具體解釋一下這個第3點是怎麼實現的,若是有不對的地方請不吝賜教!github
當初咱們綁定域名時作了兩件事情:瀏覽器
域名管理
界面,找到了本身購買的域名logos23333.top
,對其進行解析,添加了三條記錄。logos23333.top
。第一步有什麼做用呢?緩存
在Computer Networking A Top-Down Approach 一書中,咱們對於一條DNS記錄有如下的認識:服務器
A resource record is a four-tuple that contains the following fields: (Name, Value, Type, TTL)
TTL is the time to live of the resource record; it determines when a resource should be removed from a cache.app
TTL決定了一條記錄在緩存中存在的時間,也就是說,TTL時間越長,緩存時間越長,更新越不容易及時生效,增長TTL值,能夠加速網站訪問速度,節約域名解析時間,相反,TTL時間越短,緩存時間越短,生效時間也就更快。
在下面的討論中,咱們忽略TTL,只關注Name
Value
和 Type
。dom
If Type=A, then Name is a hostname and Value is the IP address for the hostname. Thus, a Type A record provides the standard hostname-to-IP address mapping. As an example, (relay1.bar.foo.com, 145.37.93.126, A)
is a Type A record.
If Type=NS, then Name is a domain (such as foo.com) and Value is the hostname of an authoritative DNS server that knows how to obtain the IP addresses
for hosts in the domain. This record is used to route DNS queries further along in the query chain. As an example, (foo.com, dns.foo.com, NS) is a Type
NS record.
If Type=CNAME, then Value is a canonical hostname for the alias hostname Name. This record can provide querying hosts the canonical name for a hostname. As an example, (foo.com, relay1.bar.foo.com, CNAME) is a
CNAME record.
If Type=MX, then Value is the canonical name of a mail server that has an alias hostname Name. As an example, (foo.com, mail.bar.foo.com, MX) is an MX record. MX records allow the hostnames of mail servers to have simple aliases. Note that by using the MX record, a company can have the same
aliased name for its mail server and for one of its other servers (such as its Web server). To obtain the canonical name for the mail server, a DNS client would query for an MX record; to obtain the canonical name for the other server, the
DNS client would query for the CNAME record.ide
再來分析咱們添加的三條記錄:網站
@
的意思是直接解析,也就是說當咱們解析logos23333.top
時,會自動去解析logos23333.github.io
的ip地址。192.30.252.153
是github服務器的名字。第3條記錄也是同樣的意思。我如今有如下幾個點不明白:code
logos23333.top
的意義在哪?彷佛只添加那一條CNAME記錄就能實現了。2018/3/12 23:51 在github pages的幫助界面,彷佛官方並非經過建立CNAME文件這種方式,而是直接在倉庫的settings裏改,好像是同樣的效果。