Method for configuring hosts in Mac OS system

First, introduce what is hosts

Hosts is a no extension of the file system, the system can use Notepad and other tools to open, is used some of the URL of the domain name and the corresponding IP address to establish a connection, when a user input need to log the URL in the browser, the system first will automatically find the corresponding IP address, from the hosts file once found, the system will immediately open the corresponding web site, if not found, the system will then be said every time to visit the m.taowaitao.cn
site analysis, submitted to the DNS domain name server IP address to 192.168.1.64 m.taowaitao.cn
as an example, do not go back to the DNS domain name server to obtain the real IP address, said has been stopped, and the direct use of 192.168.1.64 to open the corresponding web site.

A brief introduction to the role of several Hosts
1, convenient LAN users
In the company LAN, there will be provided to the user server. However, due to the local area network is rarely set up DNS server, access to these servers, to enter the hard to remember the IP address. It's a lot of trouble for a lot of people. Each server can be given an easy to remember name, and then set up the IP mapping in the Hosts, so that after the visit, just enter the name of the server on the line.
2, shielding website (domain name redirection)
There are a lot of sites without the consent of the user will be a variety of plug-ins installed in your computer, some of which may be Trojan or virus. For these sites we can use Hosts to map the domain name of the site to the wrong IP or the local computer's IP, so you don't have to visit it. In the WINDOWS system, 127.0.0.1 is the IP address of the local computer, 0.0.0.0 is the wrong IP address.

If we are in Hosts, write the following:
127.0.0.1 A
# to shield the site 0.0.0.0 # to shield the site B
, A B and computer domain, it resolves to the machine IP or false IP, reached A and B to block the site.

Collocation method
1, modify the VI editor
Last login: Thu 27 16:50:28 ttys001 zhengmingxiang$sudo VI zhengmingxiangdeMac-mini:~ /etc/hosts Password: on Apr

According to the above input, below will be the emergence of a password allows you to enter the password when you input is not any * symbol, also won’t have any tips, you just press the enter password input end is good. After opening the file, press I to enter edit mode

## # Host Database localhost is used # # to configure the loopback interface when system is booting. # the Do not change this entry. 127.0.0.1 localhost 255.255.255.255 broadcasthost ##: localhost: 1 ~ kd.gdgb.com ~ -- INSERT -- 119.63.61.166

After seeing the INSERT, on behalf of the editor (can be inserted into the text’s meaning), then you can according to the IP address and web site, after editing after the press ESC is exit edit mode, then press ESC + SHIFT + WQ, and then press enter, save it.

2, modify the file directory

First find the right click to choose to go to the folder (or SHIFT + COMMAND + G) address bar input

Method for configuring hosts in Mac OS system

you’ll find the
before you click on it

Method for configuring hosts in Mac OS system

to copy a copy to the desktop, and then use the text editor to open the system, and then turn back after the change, the same name, you replace the OK directly on the

Method for configuring hosts in Mac OS system
Method for configuring hosts in Mac OS system

OVER~~
written in the last
great God do not spray, recently wrote a record to facilitate future search. I hope we can learn to communicate and progress. If you feel good for a little money, thank you. I wish you code never bug