How to configure hosts under Mac OS system

Source: Internet
Author: User


First of all, introduce what is the hosts


Hosts is a system file without extension, you can use the system comes with Notepad and other tools to open, the role is to use some of the commonly used URL domain name and its corresponding IP address to establish an association, when the user in the browser input a need to login URL, The system will automatically find the corresponding IP address from the Hosts file, once found, the system will immediately open the corresponding URL, if not found, the system will then submit the URL to the DNS domain name resolution server for IP address resolution,
Taking 192.168.1.64 m.taowaitao.cn as an example
Indicates that every time you visit m.taowaitao.cn, do not go back to the DNS domain name resolution server to obtain the real IP address, indicating that it has been intercepted, and directly use 192.168.1.64 open the corresponding URL


Simple introduction of the next several hosts of the role of 1, convenient local area network users
In the corporate LAN, there will be servers available to users. However, because the local area network generally rarely set up a DNS server, access to these servers, to enter the hard-to-remember IP address. This is rather troublesome for many people. You can give these servers an easy-to-remember name, and then set up an IP map in the hosts, so when you visit later, just enter the name of the server.
2. Blocked website (domain redirect)
  There are many websites without user consent to install a variety of plug-ins to your computer, some of which may be Trojan or virus. For these sites we can use the hosts to map the site's domain name to the wrong IP or local computer's IP, so that it does not have access. In a Windows system, the contract 127.0.0.1 is the IP address of the local computer, and 0.0.0.0 is the wrong IP address.


If, in the hosts, we write the following:
127.0.0.1 # sites to block a
0.0.0.0 # sites to block B
In this way, when the computer resolves the domain A and b, it resolves to the native IP or the wrong IP, and achieves the purpose of masking sites A and B.


Configuration Method 1, vi Editor modification
Last login: Thu Apr 27 16:50:28 on ttys001
zhengmingxiangdeMac-mini:~ zhengmingxiang$ sudo vi /etc/hosts
Password:


According to the above input, there will be a password let you enter the password, when you enter the time will not appear any * character symbol, there will be no hint, you just enter the password and press ENTER after the good. After opening the file, press I to enter edit mode


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


After you see this insert, it is editable (can insert the meaning of the text), and then you are based on the IP address + URL on it, after the completion of the edit press ESC is to exit the edit mode, and then press ESC + SHIFT +: And then press ENTER after Wq, then saved.


2. Modify the file directory


First find this flag right click Select Go to Folder (or SHIFT + COMMAND + G) Address bar input




You'll find the goods when you click to go.




First copy to the desktop, and then use the system's text editor to open, open the changes and then dragged back, the same name, you directly replace it OK



How to configure hosts under Mac OS system


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.