小小的hosts文件有着奇妙的作用!自动映射网络地址到指定IP。
- Windows7
位置:系统盘-〉windows/system32/drivers/etc/hosts 其中就有示例:
添加 localhost 127.0.0.1
- Ubuntu
打开host文件
$ sudo gedit /etc/hosts
添加你需要的项,格式如下:
IP HOSTNAME.DOMAIN> ALIAS>
示例: 216.239.37.99 www.google.com g
编辑后,你需要重新启动一下你的网络。
$sudo /etc/init.d/networking restart