zoukankan      html  css  js  c++  java
  • 本地ip被劫持,初始化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

    hosts文件位置在

    windows xp/2003/vista/2008/7/8用户HOSTS文件是在“c:windowssystem32driversetc

    可以直接根据上述路径进入也可Win+R后输入 c:windowssystem32driversetc

    这是当初用gulp的browser-sync的插件时碰到的问题,解决方案是在browser-sync中用port属性更改端口,改为了8080端口,或改成80端口

    hosts作用,了解及说明

    host是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,当用户在浏览器中输入一个需要登录网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦
    找到,系统会立即打开对应网页,如果没有找到,则系统再会将网址提交DNS域名解析服务器进行IP地址的解析。
    
    hosts文件的作用如下:
    
    1、加快域名解析 
    对于要经常访问的网站,可以通过在Hosts中配置域名和IP的映射关系,这样当输入域名计算机就能很快解析出IP,而不用请求网络上的DNS服务器。 
    
    2、方便局域网用户 
    在很多单位的局域网中,会有服务器提供给用户使用。但由于局域网中一般很少架设DNS服务器,访问这些服务要输入难记的IP地址,对不少人来说相当麻烦。
    现在可以分别给这些服务器取个容易记住的名字,然后在Hosts中建立IP映射,这样以后访问的时候输入这个服务器的名字就行了。
    
    3、屏蔽网站 
    现在有很多网站不经过用户同意就将各种各样的插件安装到计算机中,有些说不定就是木马或病毒。对于这些网站可以利用Hosts把该网站的域名映射到错误的IP或自己计算机的IP,这样就不用访问了。在Hosts写上以下内容:
    127.0.0.1 #屏蔽的网站 
    0.0.0.0 #屏蔽的网站 
    这样计算机解析域名就解析到本机或错误的IP,达到了屏蔽的目的。

    在host里面配置这个 因为gist被墙了

    192.30.253.118 gist.github.com
  • 相关阅读:
    [模板] 循环数组的最大子段和
    [最短路][几何][牛客] [国庆集训派对1]-L-New Game
    [洛谷] P1866 编号
    1115 Counting Nodes in a BST (30 分)
    1106 Lowest Price in Supply Chain (25 分)
    1094 The Largest Generation (25 分)
    1090 Highest Price in Supply Chain (25 分)
    树的遍历
    1086 Tree Traversals Again (25 分)
    1079 Total Sales of Supply Chain (25 分 树
  • 原文地址:https://www.cnblogs.com/Model-Zachary/p/6115096.html
Copyright © 2011-2022 走看看