How to modify hosts in Ubuntu

First create a file named hosts

touch hosts

Open and edit this file with vscode or gedit, and write the following content:

127.0.0.1	localhost
#xxxxx为你的计算机名
127.0.1.1	xxxxxxx

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# 以下是你需要改的内容,ip+网址,以下为示例
39.105.88.167 www.github.com
112.32.5.63 www.baidu.com

Finally, copy the modified hosts file to the /etc directory.

sudo cp hosts /etc/

It's that simple

Guess you like

Origin blog.csdn.net/TU_Dresden/article/details/128531676