Solve the problem of slow access to github under Linux

Reasons why Github is slow to open:

  1. DNS resolution issues;
  2. The server is abroad.

solution:

Modify the local host file, add configuration content, and bypass domain name resolution to achieve acceleration.

Enter the following command to modify the host file:

sudo vim /etc/hosts

Add below 127.0.0.1 localhost:

199.232.69.194          github.global.ssl.fastly.net
140.82.113.3            github.com
185.199.108.154         github.githubassets.com 

Restart the systemd-resolved service and refresh DNS:

sudo systemctl restart systemd-resolved

If an error occurs when executing the command, please search for the corresponding refresh DNS command for your version of the system.

Special instructions (must read!!!):

Github's IP address is constantly changing. If you find that the website cannot be opened, you can obtain a new IP address and modify the content in hosts as follows:

https://ip.tool.chinaz.com/Enter the domain name you want to resolve on the website

For example: github.comTo obtain the IP, enter the following content in the input box:

github.com
github.githubassets.com
github.global.ssl.fastly.net 

Get the corresponding IP address and replace hoststhe content inside.

The commonly used related domain names of github are as follows (the IP obtained on the day of posting). You can copy and paste them directly into your own hosts. Don’t forget to refresh the DNS.

199.232.69.194              github.global.ssl.fastly.net
140.82.113.3                github.com
185.199.108.154             github.githubassets.com
140.82.113.21               central.github.com
185.199.108.133             desktop.githubusercontent.com
185.199.108.153             assets-cdn.github.com
185.199.108.133             camo.githubusercontent.com
185.199.108.133             github.map.fastly.net
140.82.114.4                gist.github.com
185.199.108.153             github.io
140.82.112.5                api.github.com 

Guess you like

Origin blog.csdn.net/lojloj/article/details/131770277