Why is Github slow?

As we all know, when we visit a web site through a domain name, we actually visit an IP address, and the resolution of the CORRESPONDING IP address of the domain name is done by the DNS server

If the resolved IP address is wrong, or the resolution process is wrong, then naturally cannot access the domain name

As GitHub’s accelerated distribution CDN domain name assets-cdn.github.com was contaminated by DNS, we could not connect to GitHub’s accelerated distribution server, which made the access speed in mainland China slow.

How to solve the slow problem

Finding the mapping between domain names and IP addresses does not have to be done by DNS resolution. You can also configure the local hosts file to let your device know the mapping between certain domain names and IP addresses

So there are two steps we have to take

  1. Find one of the sites where we need to access the domain nameIPAddress, and we have access to thisIPaddress
  2. Modify the localhostsfile

Then you can have fun with the interview!

First, how do you find the IP address? Recommend mping.chinaz.com

Let’s say I have something less than 1 Ms. Let’s try it

  • Windows:

    Open Explorer and go to C:\Windows\System32\drivers\etc

    The file shown in the red box is the configuration file we want to modify. This file cannot be modified by default. You need to edit its control permissions first

    Right-click, choose Properties, switch to the security TAB, and click Edit to edit the permissions of the current login user on the hosts file to fully control (it is best to write to prevent malicious programs from damaging the hosts file)

    Then use notepad or the command line to open the file for editing

    As shown in the figure above, write the IP address on the left, and write the corresponding domain name in the blank space. Then save the file and create a window in the browser to access the newly configured domain name

  • Mac:

    Open the terminal and run the following command (sudo vi /etc/hosts may be added)

    Edit the hosts file

    Esc.:qsave

    The browser creates a new window to access the newly configured domain name

Other access methods

  • Access through mirroring
  • Browser plugin to speed up access to Github
  • SwitchHosts (this method is not easy to use)
  • Other accelerators

Original text: yzl. Xyz/Lin / 2021/05…