⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0440ntp.htm

📁 鸟哥的linux私房菜
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	>
<html lang="zh-TW">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
	<meta name="Author" content="VBird, 鸟哥" >
	<meta name="Description" content="Network Time Protocol 就是 NTP 的全名。NTP 主机主要在提供网路上可以进行网路校时的主机功能!" >
	<title>鸟哥的 Linux 私房菜 -- NTP 时间伺服器</title>
	<style type="text/css">
	 	body {
			background-color: #D3D3D3;
			color: #000000;
			background-attachment:fixed ;
		}
				body,th,td,input,select,textarea,select,checkbox {
			font-family: '新细明体', 'Times New Roman', serif;
			font-size: 11pt ;
		}
		a:link		{text-decoration: none; color: blue}
		a:visited	{text-decoration: none; color: blue}
		a:active	{text-decoration: none; color: blue}
		a:hover		{text-decoration: underline; color: #ff0000}
				table.head1	{width:100%; background-color: #FFCCCC; 
				 border-style:groove;border-width:5px;border-color: #FFCCCC; margin:0;
				 padding: 5px 5px}
		   		   td.head1	{font: 10pt "新细明体", serif; color: #000099; }
		   		   td.info1	{font: 11pt "新细明体", serif; color: #000066; text-align:center; width:14%}
		   td.info2	{font: 11pt "新细明体", serif; color: #000066; text-align:center; width:12%}
		    *.info21	{font: 11pt "新细明体", serif; color: #000066; }
		    *.info22	{font: 11pt "新细明体", serif; color: blue  ; }
		    *.info23	{font: 11pt "新细明体", serif; color: green ; }
		   td.info3	{font: 11pt "新细明体", serif; color: #000066; text-align:justify}
				*.text_head0	{font-size:18pt; font-family:'标楷体','Times New Roman','Times', serif; }
		*.text_head_en	{font-size:18pt; font-family:'Times New Roman','Times', serif; }
				*.text_h1	{font: 15pt "新细明体", serif; color: #0000BB; font-weight: bold }
				*.text_h2	{font: 13pt "新细明体", serif; color: #0000BB; font-weight: bold }
				*.text_import1	{font:  11pt "新细明体", serif; color: #000088; font-weight: bold  }
		*.text_import2	{font:  11pt "新细明体", serif; color: #000088; font-weight: normal}
		*.text_vbird	{font:  11pt "新细明体", serif; color: #000088; font-weight: normal; 
				 font-style: italic;}
		*.text_history	{font:  10pt "新细明体", serif; color: #000066; }
		*.text_date	{font:  10pt "新细明体", serif; color: #3333FF; }
				*.block1	{padding: 10px 20px 10px 25px; text-align:left }
				*.block2	{padding: 10px 0px  10px 25px; text-align:left }
	    table.term2		{width: 350px; background-color: #000000;
				 border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
	    	    table.term		{width: 580px; background-color: #000000;
				 border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
	       	       td.term		{font:  10pt "细明体", Fixedsys, serif; color: #FFFFFF; }
		*.term_hd	{font:  10pt "细明体", Fixedsys, serif; color: #BBBBBB; }
		*.term_note	{font:  10pt "细明体", Fixedsys, serif; color: #777777; font-weight: normal }
		*.term_note_b	{font:  10pt "细明体", Fixedsys, serif; color: #FF77FF; font-weight: bolder }
		*.term_command	{font:  10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: bolder }
		*.term_write	{font:  10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: normal }
		*.term_say	{font:  10pt "细明体", Fixedsys, serif; color: #FF6666; font-weight: normal }
	</style>
	<script language="JaveScript" type="text/javascript" src="/include/java.js"></script>
</head>
<body style="margin:0; padding:0">
<center>


<!-- 这里是关于页首按钮处的按钮程式 -->
<div style="text-align:center">
<span style="font-weight:bolder; color:#3333FF"><span class="text_head0">鸟哥的<span class="text_head_en"> 
	Linux </span>私房菜</span></span><br />
<span style="color:#000080">为取得较佳浏览结果,请爱用 <a href="http://moztw.org" target="_blank">firefox</a>
	浏览本网页</span><br />
<a href="http://linux.vbird.org/" target="_blank"
	onmouseover="document.head_icon1.src='../images/icon_VBird_on.jpg'"
	onfocus="document.head_icon1.src='../images/icon_VBird_on.jpg'"
	onmouseout="document.head_icon1.src='../images/icon_VBird_off.jpg'">
	<img alt="前往鸟哥的 Linux 私房菜馆首页" title="前往鸟哥的 Linux 私房菜馆首页" name="head_icon1"
		src="../images/icon_VBird_off.jpg" border="0" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_basic"
	onmouseover="document.head_icon2.src='../images/icon_basic_on.jpg'"
	onfocus="document.head_icon2.src='../images/icon_basic_on.jpg'"
	onmouseout="document.head_icon2.src='../images/icon_basic_off.jpg'">
	<img src="../images/icon_basic_off.jpg" border="0" 
		alt="前往 Linux 基础文件,新手请从头学起" 
		title="前往 Linux 基础文件,新手请从头学起" name="head_icon2" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_server"
	onmouseover="document.head_icon3.src='../images/icon_server_on.jpg'"
	onfocus="document.head_icon3.src='../images/icon_server_on.jpg'"
	onmouseout="document.head_icon3.src='../images/icon_server_off.jpg'">
	<img src="../images/icon_server_off.jpg" border="0"
		alt="前往 Linux 架站文件,网路基础那章节请务必参考!" 
		title="前往 Linux 架站文件,网路基础那章节请务必参考!" name="head_icon3" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_security"
	onmouseover="document.head_icon4.src='../images/icon_security_on.jpg'"
	onfocus="document.head_icon4.src='../images/icon_security_on.jpg'"
	onmouseout="document.head_icon4.src='../images/icon_security_off.jpg'">
	<img src="../images/icon_security_off.jpg" border="0"
		alt="前往『网路安全』相关文件网页" title="前往『网路安全』相关文件网页" name="head_icon4" /></a>
<a href="http://phorum.vbird.org" target="_blank"
	onmouseover="document.head_icon5.src='../images/icon_forum_on.jpg'"
	onfocus="document.head_icon5.src='../images/icon_forum_on.jpg'"
	onmouseout="document.head_icon5.src='../images/icon_forum_off.jpg'">
	<img src="../images/icon_forum_off.jpg" border="0"
		alt="前往 Linux 新手讨论区,发问前务必查阅发文规则" 
		title="前往 Linux 新手讨论区,发问前务必查阅发文规则" name="head_icon5" /></a>
<a target="_blank" href="http://linux.vbird.org/adsl"
	onmouseover="document.head_icon6.src='../images/icon_adsl_on.jpg'"
	onfocus="document.head_icon6.src='../images/icon_adsl_on.jpg'"
	onmouseout="document.head_icon6.src='../images/icon_adsl_off.jpg'">
	<img src="../images/icon_adsl_off.jpg" border="0"
		alt="前往『ADSL连线分享』相关文件网页" title="前往『ADSL连线分享』相关文件网页" name="head_icon6" /></a>
<a href="http://www.study-area.org" target="_blank"
	onmouseover="document.head_icon7.src='../images/icon_study-area.jpg'"
	onfocus="document.head_icon7.src='../images/icon_study-area.jpg'"
	onmouseout="document.head_icon7.src='../images/icon_study-area.jpg'">
	<img src="../images/icon_study-area.jpg" border="0"
		alt="前往 Study Area 网站" title="前往 Study Area 网站" name="head_icon7" /></a>
<br />
</div>


<table summary="本文内容的排版" style="width:750px; 
	background-image:url('../images/VBirdLinux.jpg');
	background-attachment:fixed;" border="0" cellspacing="0" cellpadding="0">
<tr><td style="width:16px; height:16px; background-image:url('../images/border-top-left.jpg'); 
	font-size:6px">  </td>
    <td style="width:718px; height:16px; font-size:6px;
	background-image:url('../images/border-top-center.jpg')">  </td>
    <td style="width:16px; height:16px; background-image:url('../images/border-top-right.jpg');
	font-size:6px">  </td></tr>
<tr><td style="width:16px; font-size:6px;
	background-image:url('../images/border-middle-left.jpg')">  </td>
    <td width="718">

<!-- 本文的档头部分 -->
<div style="text-align:center">
    <a href="0440ntp.php">
    <span class="text_head0"><span class="text_head_en">NTP </span>时间伺服器</span></a><br />
</div>
    <div style="text-align:left">
        <a href="0440ntp.php?thisscreen=800x600"><!--切换解析度为 800x600--></a>
    </div>
    <div style="text-align:right">
        <span class="text_history">最近更新日期∶2006/12/08</span>
    </div>


<!-- 本文的档头部分 -->
<table class="head1" summary="排版∶文章档头的说明"><tr><td class="head1">
	很多时候由于电脑硬体的问题,所以我们都会调整一下时间,好让电脑系统的时间可以一直保持正确的状态。
	而既然要调整时间,那么自然就会有一个让我们可以对照著来调整时间的『准确时间』咯!
	在实际生活中,我们可以透过电视台、广播电台、电话等等来调整我们的手表,那么如果是在网路上呢?
	该如何让我们的主机随时保持正确的时间资讯?!另外,整个地球被切分成为
	24 个时区,那么什么是 GMT (格林威治时间),我们所在的时区又是哪一区呢?让我们来简单的谈一谈吧!
</td></tr></table><br />


<!-- 本文的连结区部分 -->
<div class=block1>
<span class="text_h1">
1. <a href="#before">本章的行前准备工作</a><br />
2. <a href="#theory">关于时区与网路校时的通讯协定</a><br />
	<span class=text_h2>
	    2.1 <a href="#theory_timezone">什么是时区?全球有多少时区?GMT 在那个时区?</a><br />
	    2.2 <a href="#theory_summer">什么是夏季节约时间 (daylight savings)?</a><br />
	    2.3 <a href="#theory_UTC">Coordinated Universal Time (UTC)与系统时间的误差 </a><br />
	    2.4 <a href="#theory_NTP">NTP 通讯协定</a><br />
	</span>
3. <a href="#server">NTP 伺服器的安装与设定</a><br />
	<span class=text_h2>
	    3.1 <a href="#server_pkg">所需套件与套件结构</a><br />
	    3.2 <a href="#server_ntp.conf">主要设定档 ntp.conf 的处理</a><br />
	    3.3 <a href="#server_start">NTP 的启动与观察</a><br />
	    3.4 <a href="#server_firewall">安全性设定</a><br />
	</span>
4. <a href="#client">用户端的时间更新方式</a><br />
	<span class=text_h2>
	    4.1 <a href="#client_systime">Linux 系统时间与硬体时间</a><br />
	    4.2 <a href="#client_timezone">Linux 系统时区与手动校时工作∶ date, hwclock</a><br />
	    4.3 <a href="#client_linux">Linux 的网路校时</a><br />
	    4.4 <a href="#client_windows">Windows 的网路校时</a><br />
	</span>
5. <a href="#review">重点回顾</a><br />
6. <a href="#ex">课后练习</a><br />
7. <a href="#reference">参考资料</a><br />
<span class=text_h2>
8. <a href="http://phorum.vbird.org/viewtopic.php?p=117976"
        target="_blank">针对本文的建议∶http://phorum.vbird.org/viewtopic.php?p=117976</a><br />
</span>
</span>
</div>


<!-- 本文的正式部分 -->
<hr /><a NAME="before"></a><img src="images/penguin-m.gif" alt="大标题的图示" height="34" width="25" align="middle" /><span class="text_h1">本章的行前准备工作</span><br />
<div class=block1>
	NTP 伺服器是个很容易设定的服务,你只要熟悉网路基础即可轻易的将他设定好。
	这一章没有什么很重要的预习功课,您可以轻松的学习啊! ^_^<br /><br />
</div>


<hr /><a NAME="theory"></a><img src="images/penguin-m.gif" alt="大标题的图示" height="34" width="25" align="middle" /><span class="text_h1">关于时区与网路校时的通讯协定</span><br />
<div class=block1>
	时间对于现代人来说是很重要的,因为『 Time is money !』。既然时间如此重要,对于 Internet 来说应该也是很重要吧?
	为什么呢?还记得我们在基础学习篇里面谈到的『<a href="../linux_basic/0570syslog.php#syslogd_server">登录档分析</a>』吧?
	如果你架设了一个登录档记录伺服器的话,那么总得要分析每个主机所传来的资讯吧?如果每一部主机的时间都不相同,
	那如何判断问题发生的时间点?所以棉,『<span class=text_import2>每一部主机的时间同步化</span>』就很重要了。<br /><br />

	每一部主机时间的同步化重要性当然不只如此,包括之前谈到的 DHCP 用户端/伺服器端所需要的租约时间限制、
	网路侦测时所需要注意的时间点、刚刚谈到的登录档分析功能、具有相关性的主机彼此之间的错误侦测等等,
	都需要具有相同的时间才能够捉出问题呢。好了,底下咱们就来聊一聊,如何利用网路来进行主机的时间同步化吧!<br /><br />

	<hr /><a NAME="theory_timezone"></a><img src="../images/penguin-s.gif" alt="小标题的图示" height="23" width="16" align="middle" /><span class="text_h2">什么是时区?全球有多少时区?GMT 
	在那个时区?</span><br />
	<div class=block2>
		因为地球是圆的,所以同一个时刻,在地球的一边是白天,一边是黑夜。而因为人类使用一天 24 
		小时的制度,所以,在地球对角的两边就应该差了 12 的小时才对。由于同一个时间点上面,
		整个地球的时间应该都不一样,为了解决这个问题,所以可以想见的,地球就被分成 24 个时区了!<br /><br />

		那么这 24 个时区是依据什么来划分的呢?由于地球被人类以『经纬度』座标来进行定位,
		而经度为零的地点在英国『格林威治』这个城市所在纵剖面上,
		(注∶所谓的纵剖面就是由南极切到北极的直线,而横切面就是与赤道平行的切线),如下图所示∶<br /><br />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -