1.cd /private/etc/
先修改权限:sudo chmod 777 hosts
vi hosts
localhost:etc mhx$ cat hosts
##
# 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
192.168.1.104 admin-pc
::1 localhost
添加ip及对应的域名即可