1. 程式人生 > >linux 搭建 NTP 時間服務器

linux 搭建 NTP 時間服務器

2.7 x86 kcon ast load put 重啟 規劃 sam

1搭建DNS 主 從服務器。

1.1環境要求:

Centos 6.5 x86_64

1.2硬件配置:

名稱

IP規劃

cpu

內存

硬盤

主服務器

192.168.0.24

4核

8G

80G

從服務器

192.168.0.34

4核

8G

80G

1.3軟件包安裝:

[root@localhost ~]# yum install -y bind bind-chroot bind-utlis

1.4配置文件:

/etc/named.conf bind 服務主配置文件。

/var/named/ zone 文件。

1.5復制配置文件模板:

[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/

[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/var/*

1.6修改主配置文件:

[root@localhost ~]# vi /var/named/chroot/etc/named.conf

options

{

    // Put files that named is allowed to write in the data/ directory:

    directory               "/var/named";           // "Working" directory

    dump-file               "data/cache_dump.db";

    statistics-file         "data/named_stats.txt";

    memstatistics-file      "data/named_mem_stats.txt";

    //listen-on port 53     { any; };

    listen-on port 53       { any; };

    //listen-on-v6 port 53  { any; };

    listen-on-v6 port 53    { ::1; };

    allow-query             { any; };

    allow-query-cache       { any; };

    forwarders             { 10.0.0.1;114.114.114.114; };

    recursion yes;

    dnssec-enable yes;

    dnssec-validation yes;

};

zone "zabbix.73go.cn"{

  type  master;

  file "zabbix.73go.cn.zone";

};

1.7修改zone 文件:

[root@localhost named]# cd /var/named/chroot/var/named

[root@localhost named]# cat zabbix.73go.cn.zone

$TTL 1D

@ IN SOA @ rname.invalid. (

                                    0       ; serial

                                    1D      ; refresh

                                    1H      ; retry

                                    1W      ; expire

                                    3H )    ; minimum

    NS      @

    A       127.0.0.1

    AAAA    ::1

    IN    A  192.168.0.236

1.8語法檢查:

[root@localhost named]# named-checkconf /var/named/chroot/etc/named.conf

[root@localhost named]# named-checkzone linuxcast.net linuxcast.net.zone

1.9重啟服務:

[root@localhost named]# service named reload

[root@localhost named]# service named restart

2從服務器配置:

2.1軟件包安裝:

[root@localhost ~]# yum install -y bind bind-chroot bind-utlis

2.2復制配置文件模板:

[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/

2.3更改服務器從配置文件

[root@localhost etc]# vi /var/named/chroot/etc/named.conf

options

{

    // Put files that named is allowed to write in the data/ directory:

    directory               "/var/named";           // "Working" directory

    dump-file               "data/cache_dump.db";

    statistics-file         "data/named_stats.txt";

    memstatistics-file      "data/named_mem_stats.txt";

    //listen-on port 53     { any; };

    listen-on port 53       { any; };

    //listen-on-v6 port 53  { any; };

    listen-on-v6 port 53    { ::1; };

    allow-query             { any; };

    allow-query-cache       { any; };

    forwarders             { 10.0.0.1;114.114.114.114; };

    recursion yes;

    dnssec-enable yes;

    dnssec-validation yes;

};

zone "zabbix.73go.cn"{

  type  slave;

 masters{ 192.168.0.24; };

  file "slaves/zabbix.73go.cn.zone";

};

2.4重啟服務:

[root@localhost named]# service named reload

[root@localhost named]# service named restart

2.5保證目錄權限:

[root@localhost named]# ll

drwxrwxrwx. 2 named named 4096 7月 5 17:55 slaves

2.6查看同步zone 文件。

[root@localhost slaves]# cat /var/named/chroot/var/named/slaves

2.7驗證:

C:\Users\admin>nslookup zabbix.73go.cn

服務器: UnKnown

Address: 192.168.0.24

名稱: zabbix.73go.cn

Addresses: ::1

      127.0.0.1

      192.168.0.236

linux 搭建 NTP 時間服務器