+ Responder ao Tópico



  1. #1

    Padrão Problema com o NTP

    Bom dia pessoal.
    Estou tendo dificuldades para fazer funcionar um servidor NTP na minha rede e gostaria de saber se vocês podem me ajudar.
    Segue abaixo o meu /etc/ntp.conf

    # Permit time synchronization with our time source, but do not
    # permit the source to query or modify the service on this system.

    restrict default kod notrap nomodify nopeer noquery

    # Permit all access over the loopback interface. This could
    # be tightened as well, but to do so would effect some of
    # the administrative functions.
    restrict 127.0.0.1 nomodify

    # -- CLIENT NETWORK -------
    # Permit systems on this network to synchronize with this
    # time service. Do not permit those systems to modify the
    # configuration of this service. Also, do not use those
    # systems as peers for synchronization.
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap


    # --- OUR TIMESERVERS -----
    server ntp.on.br
    server ntp.usp.br
    server ntp.cais.rnp.br


    # --- NTP MULTICASTCLIENT ---
    #multicastclient # listen on default 224.0.1.1
    # restrict 224.0.1.1 mask 255.255.255.255 nomodify notrap
    # restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap



    # --- GENERAL CONFIGURATION ---
    #
    # Undisciplined Local Clock. This is a fake driver intended for backup
    # and when no outside source of synchronized time is available. The
    # default stratum is usually 3, but in this case we elect to use stratum
    0. Since the server line does not have the prefer keyword, this driver
    # is never used for synchronization, unless no other other
    # synchronization source is available. In case the local host is
    # controlled by some external source, such as an external oscillator or
    # another protocol, the prefer keyword would cause the local host to
    # disregard all other synchronization sources, unless the kernel
    # modifications are in use and declare an unsynchronized condition.
    #
    server 127.127.1.0 # local clock
    fudge 127.127.1.0 stratum 10

    #
    # Drift file. Put this in a directory which the daemon can write to.
    # No symbolic links allowed, either, since the daemon updates the file
    # by creating a temporary in the same directory and then rename()'ing
    # it to the file.
    #
    driftfile /etc/ntp/ntp.drift
    broadcastdelay 0.008

    #
    # Keys file. If you want to diddle your server at run time, make a
    # keys file (mode 600 for sure) and define the key number to be
    # used for making requests.
    #
    # PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
    # systems might be able to reset your clock at will. Note also that
    # ntpd is started with a -A flag, disabling authentication, that
    # will have to be removed as well.
    #
    #keys /etc/ntp/keys

    Quando eu inicio o daemon ntpd, está aparecendo as seguintes mensagens em /var/log/messages.

    May 31 10:41:39 micro-5 ntpd[3613]: sendto(200.144.121.33): Bad file descriptor
    May 31 10:41:39 micro-5 ntpd[3613]: sendto(143.107.255.184): Bad file descriptor
    May 31 10:41:39 micro-5 ntpd[3613]: sendto(200.20.186.75): Bad file descriptor
    May 31 10:44:08 micro-5 ntpd[3628]: ntpd [email protected] Thu Apr 14 07:47:25 EDT 2005 (1)
    May 31 10:44:08 micro-5 ntpd[3628]: precision = 3.000 usec
    May 31 10:44:08 micro-5 ntpd[3628]: Listening on interface wildcard, 0.0.0.0#123
    May 31 10:44:08 micro-5 ntpd[3628]: Listening on interface wildcard, ::#123
    May 31 10:44:08 micro-5 ntpd[3628]: Listening on interface lo, 127.0.0.1#123
    May 31 10:44:08 micro-5 ntpd[3628]: Listening on interface eth0, 192.168.1.105#123
    May 31 10:44:08 micro-5 ntpd[3628]: kernel time sync status 0040
    May 31 10:44:08 micro-5 ntpd[3628]: Frequency format error in /etc/ntp/ntp.drift

  2. #2

    Padrão Re: Problema com o NTP

    andunno,
    verifique as permissões dos arquivos do ntpd, em especial o "ntp.drift".
    Estou lhe postando o meu arquivo de configuração para stratum2

    Código :
    # ntpd
     
    # server (stratum 1)
    server ntps1.pads.ufrj.br # (UFRJ), Rio de Janeiro, Brazil
    server ntp1.rnp.br    # Rede Nacional de Pesquisa (RNP)
    server clock.via.net   # ViaNet Communications, Palo Alto, CA, USA
     
    # server (stratum 2)
    server ntp.pads.ufrj.br # UFRJ, Rio de Janeiro, Brazil (PADS)
    server ntp2.pads.ufrj.br # UFRJ, Rio de Janeiro, Brazil (PADS)
    server ntp.pop-mg.rnp.br # POP-ES (RNP)
    server ntp.pop-es.rnp.br # POP-MG (RNP)
     
    server 127.127.1.0
    fudge 127.127.1.0 stratum 13
     
    restrict default kod notrap nomodify nopeer noquery
     
    restrict 127.0.0.1 nomodify
     
    broadcast 192.168.1.255
     
    logfile /var/log/ntp/ntp.log
    driftfile /var/lib/ntp/ntp.drift
     
    disable auth
    broadcastclient

    Outra coisa, leia uma boa documentação (pt_BR) arrespeito desse daemon no link a seguir.

    Link: http://www.rnp.br/ntp/

  3. #3

    Padrão Re: Problema com o NTP

    Caro amigo,

    Acho que agora consegui fazer o meu servidor NTP funcionar. Foi pelo menos o que eu entendi o log do NTP.

    31 May 15:38:42 ntpd[2294]: system event 'event_peer/strat_chg' (0x04) status 'sync_alarm, sync_local_proto, 5 events, event_clock_reset' (0xc555)
    31 May 15:38:42 ntpd[2294]: synchronized to LOCAL(0), stratum 10
    31 May 15:38:42 ntpd[2294]: system event 'event_sync_chg' (0x03) status 'leap_none, sync_local_proto, 6 events, event_peer/strat_chg' (0x564)
    31 May 15:38:42 ntpd[2294]: system event 'event_peer/strat_chg' (0x04) status 'leap_none, sync_local_proto, 7 events, event_sync_chg' (0x573)
    31 May 15:39:46 ntpd[2294]: kernel time sync enabled 0001
    31 May 15:40:50 ntpd[2294]: synchronized to 200.20.186.75, stratum 1
    31 May 15:58:43 ntpd[6170]: system event 'event_restart' (0x01) status 'sync_alarm, sync_unspec, 1 event, event_unspec' (0xc010)
    31 May 15:58:45 ntpd[6170]: peer 200.20.186.75 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014)
    31 May 15:58:46 ntpd[6170]: peer 143.107.151.2 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014)
    31 May 15:58:46 ntpd[6170]: peer 200.144.121.33 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014)
    31 May 15:58:46 ntpd[6170]: peer LOCAL(0) event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014)

    Gostaria de aproveitar e tirar algumas dúvidas com relacão ao seu ntp.conf

    - Em restrict o que significa o kod e o nopeer?
    - Em broadcast signifca que o seu servidor vai ficar dando broadcast de pacotes ntp na rede?
    - E o broadcastclient?

    Outra coisa no meu ntp.conf eu coloquei as seguintes configuracões no restrict

    restrict default nomodify notrap noquery
    restrict 127.0.0.1 nomodify
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

    Dessa forma, pelo que eu entedi, somente as máquinas da minha rede podem sincronizar o horário através do meu servidor. É isso mesmo ou dessa forma qualquer máquina na Internet também conseguiria utilizar o meu servidor para sincronizar o horário?

  4. #4

    Padrão Re: Problema com o NTP

    Gostaria de aproveitar e tirar algumas dúvidas com relacão ao seu ntp.conf

    - Em restrict o que significa o kod e o nopeer?
    - Em broadcast signifca que o seu servidor vai ficar dando broadcast de pacotes ntp na rede?
    - E o broadcastclient?
    * kod: Essa foi retirada da página official. esse parametro está em alguns exemplos de configuração.

    * nopeer: Prove serviço de hora sem estado isso quer dizer que ele não aloca memoria.

    * broadcastclient: Escuta as mensagens enviadas pelo servidor de rede local.

    * broadcast: Especifica que o servidor local operará em modo broadcast, onde o servidor local envia mensagens periodicas para uma população cliente no endereço broadcast/multicast especificado. Ordinariamente esta especificação aplica-se somente a um servidor local operando como "enviador"; para operar como cliente de broadcast.

    Outra coisa no meu ntp.conf eu coloquei as seguintes configuracões no restrict

    restrict default nomodify notrap noquery
    restrict 127.0.0.1 nomodify
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

    Dessa forma, pelo que eu entedi, somente as máquinas da minha rede podem sincronizar o horário através do meu servidor. É isso mesmo ou dessa forma qualquer máquina na Internet também conseguiria utilizar o meu servidor para sincronizar o horário?
    Acrecente a restrict default "ignore notrust"

  5. #5

    Padrão Re: Problema com o NTP

    Caro chacara
    Ainda não entendi uma coisa: qual seria o benefício de utilizar o broadcast e o broadcastclient?