windows 和ubuntu下host文件
来源:互联网 发布:阿里云pc 编辑:程序博客网 时间:2024/06/07 19:38
有时候,我们需要让某些域名指向本地,方便进行代码调试,这就需要修改host文件。下面就来说一说windows系统和ubuntu系统修改host文件的方式:
Windows系统下:
进入 C:\Windows\System32\drivers\etc,可以看到HOSTS文件,该文件没有后缀名,一般需要通过管理员身份打开修改,下面给出该文件的例子:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
修改时只需要在文件后面追加需要域名解析的ip 和名称即可。
Ubuntu系统的Hosts只需修改/etc/hosts文件,修改完成之后需要重启网络:
sudo gedit /etc/hosts
需要添加的格式为:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
例如:216.239.37.99 www.google.com
修改完成后,重启网络:
sudo /etc/init.d/networking restart
- windows 和ubuntu下host文件
- ubuntu 下修改host文件
- ubuntu下修改host文件
- ubuntu vm与windows host共享文件
- Ubuntu 14.04下host文件修改格式
- ubuntu 下实现和windows文件共享
- HOST文件在WINDOWS下是什么作用?
- ubuntu下修改host
- Ubuntu修改host文件
- Windows host 文件位置
- ubuntu下开启samba服务和windows共享文件
- Ubuntu下添加samba实现和windows共享文件
- VirtualBox下的ubuntu和windows系统文件共享
- VMWare下虚拟机ubuntu 和 windows文件共享
- ubuntu下开启samba服务和windows共享文件
- Ubuntu和windows下共享文件之SSH
- windows下的host文件在哪里,有什么作用?
- windows下的host文件在哪里,有什么作用?
- jq代码学习25——基于jQuery的ajax聊天室 fl ch6 p209
- 安装kafka
- Python什么情况下会生成pyc文件?
- 顺序表应用4-2:元素位置互换之逆置算法(数据改进)
- 阿里云Redis公网连接的解决办法
- windows 和ubuntu下host文件
- hdu3966(数链剖分+线段树区间更新)
- 站在你身边的每个人都有可能改变世界,阿里云异构计算加速人工智能
- sql server 笔记
- TensorFlow 图像数据预处理及可视化
- 阿里云发布新一代数据库产品POLARDB_跑分领先一线友商
- 在yii框架下使用redis数据库
- 自创漫画图
- iOS11及iPhone X适配