快速访问GitHub
以GitHub为例进行讲解,其他几个网站类似操作即可。作为程序员最大代码托管和分享平台,都知道GitHub式国外网站,经常访问会卡或者进不去。苦恼的问题如何解决呢???
一、打开DNS检测|DNS检测
在检测栏中输入github.com得到响应的ip地址。
二、Ping响应地址
将得到的响应ip按TTL的值从小到大排序,依次ping
响应ip地址。最先ping通的就是我们要找的那个了。
三、写入hosts文件,加速域名解析
-
此处就要讲解一下啊hosts文件的作用了,hosts文件就是定义ip地址和hostname(主机名)的映射关系,是一个映射ip地址和hostname(主机名)。
-
在网络上访问网站,要首先通过过DNS服务器把要访问的网络域名(XXX.COM)解析为<stron>的ip地址,计算机才能对这个网络域名做访问。</stron>
-
如果对于每个域名请求都等待域名服务器解析后返回ip信息,访问效率就会大大降低,应为DNS作域名解析和返回IP都需时间。根据Windows/Linux系统规定,在进行DNS请求以前会先检测自己的Hosts文件中是否有这个网路域名映射关系。
Windows: C:\Windows\System32\drivers\etc\hosts
Linux: /etc/hosts
修改hosts文件有以下作用:
- 加快域名解析
- 方便局域网用户
- 屏蔽网站
四、推荐屏蔽站点
许多国外网站都加载的很慢的原因就是部分站点响应时间太长,以下是几个建议屏蔽的站点,基本是一些无关紧要的网站元素,但是响应时间很慢。
#屏蔽站点
127.0.0.1 www.gravatar.com
127.0.0.1 graph.facebook.com
127.0.0.1 ajax.googleapis.com
127.0.0.1 adservice.google.com
127.0.0.1 0.gravatar.com
127.0.0.1 1.gravatar.com
127.0.0.1 www.google-analytics.com
五、本人hosts文件
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#hadoop大数据学习
192.168.1.100 hadoop100
192.168.1.101 hadoop101
192.168.1.102 hadoop102
192.168.1.103 hadoop103
192.168.1.104 hadoop104
192.168.1.105 hadoop105
192.168.1.106 hadoop106
192.168.1.107 hadoop107
192.168.1.108 hadoop108
192.168.1.109 hadoop109
#域名增速
13.250.177.223 github.com
185.199.111.153 assets-cdn.github.com
66.220.155.12 github.global.ssl.fastly.net
185.199.111.153 github.io
151.101.193.69 stackoverflow.com
151.101.1.69 cdn.sstatic.net
#github download
74.86.228.110 github.global.ssl.fastly.net
54.251.140.56 codeload.github.com
219.76.4.4 github-cloud.s3.amazonaws.com
# leetcode域名解析
104.18.35.28 leetcode.com
104.18.34.28 assets.leetcode.com
#屏蔽站点
127.0.0.1 www.gravatar.com
127.0.0.1 graph.facebook.com
127.0.0.1 ajax.googleapis.com
127.0.0.1 adservice.google.com
127.0.0.1 0.gravatar.com
127.0.0.1 1.gravatar.com
127.0.0.1 www.google-analytics.com