舞鬼十七's Blog

简单,快乐,有所追求

SyncHosts——自动联网更新hosts程序

舞鬼十七 posted @ 2011年12月22日 13:49 in 编程作品 with tags .net hosts 程序 , 6067 阅读

1程序简介
由于众所周知的原因,中国的互联网用户过得很艰辛。为了更好地使用Google以及其它的一些网站提供的服务,不少用户不得不使用hosts把这些服务的域名解析到固定的IP上。由于hosts优先于DNS服务器,因而这种方法能在一定程度上帮助想获取更多信息的用户。 但是Google和其它著名网站的服务IP并不是固定的,而是时常会变化,如果hosts中的IP过期,反而会使用户无法访问,得不偿失。而有人会在Google Docs上维护这些服务网站的最新可用的IP地址,为此,我写了个自动联网获取最新IP地址更新hosts文件的程序——SyncHosts。

2程序运行条件
安装了.Net Framework3.5的Windows系统。win7系统已默认安装.Net Framework3.5。


3运行说明
如果你曾自己把Google服务域名的IP添加到hosts文件,请最好删除,以免发生冲突。
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



下载SyncHosts

下载SyncHosts v1.0.1(update:2012-1-7)

Avatar_small
Xredman 说:
2012年1月06日 11:27

不能用,一更新就卡机

Avatar_small
舞鬼十七 说:
2012年1月07日 15:48

@Xredman: 使用 v1.0.1版试试

Avatar_small
Mike 说:
2012年1月08日 21:21

有 UNIX/Linux 版吗?
或者源码也行。

Avatar_small
alexandersen 说:
2012年1月13日 23:09

v1.0.1 也是一更新就卡住,win7系统的

Avatar_small
舞鬼十七 说:
2012年2月19日 21:56

抱歉,没有UNIX/Linux版,因为是用C#写的。

Avatar_small
舞鬼十七 说:
2012年2月19日 21:59

我的系统也是win7,我用的时候没有什么问题。你的应该是网络问题,必须能够ping通www.g.cn才能更新。


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter