Форум русскоязычного сообщества Ubuntu


Хотите сделать посильный вклад в развитие Ubuntu и русскоязычного сообщества?
Помогите нам с документацией!

Автор Тема: Помогите настроить NTP сервер  (Прочитано 10294 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн winmasta

  • Автор темы
  • Активист
  • *
  • Сообщений: 348
    • Просмотр профиля
Помогите настроить NTP сервер
« : 01 Декабря 2012, 13:08:43 »
Добрый день. Ubuntu 12.10 установил ntp, сам сервер синхронизируется но с ним Windows синхрониться не хочет пишет Ошибка при выполнении синхронизации с 192.168.1.1. Этот узел не доступен.

вот мой ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
restrict 192.168.1.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

вывод ntpq -pn

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-193.124.4.177   248.34.202.6     3 u  117  128  377   65.787   40.351   4.142
+85.21.78.8      193.79.237.14    2 u   44  128  377  146.302   -8.001   2.025
+84.23.34.85     193.67.79.202    2 u   34  128  377   82.754   -9.511   0.958
-95.172.152.243  62.117.76.141    2 u  125  128  377    9.230    4.815   3.094
*91.189.94.4     193.79.237.14    2 u   51  128  377  134.853   -3.713   2.029

netstat -tulpan

Proto Recv-Q Send-Q Local Address Foreign Address State       PID/Program name
tcp        0      0 0.0.0.0:366             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      -
tcp        0      0 192.168.1.1:3128        192.168.1.2:51191       ESTABLISHED -
tcp        1      0 195.208.161.154:41291   91.189.89.144:80        CLOSE_WAIT  -
tcp        0    492 192.168.1.1:366         192.168.1.2:50508       ESTABLISHED -
tcp        0      0 192.168.0.100:3128      192.168.0.2:4349        ESTABLISHED -
tcp6       0      0 :::366                  :::*                    LISTEN      -
tcp6       0      0 :::53                   :::*                    LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
tcp6       0      0 ::1:6010                :::*                    LISTEN      -
tcp6       0      0 195.208.161.154:36569   213.108.252.153:80      TIME_WAIT   -
tcp6       0      0 195.208.161.154:55268   77.234.41.55:80         ESTABLISHED -
tcp6       0      0 195.208.161.154:55272   77.234.41.55:80         ESTABLISHED -
udp        0      0 0.0.0.0:10000           0.0.0.0:*                           -
udp        0      0 0.0.0.0:51215           0.0.0.0:*                           -
udp        0      0 0.0.0.0:53              0.0.0.0:*                           -
udp        0      0 0.0.0.0:42045           0.0.0.0:*                           -
udp        0      0 195.208.161.154:123     0.0.0.0:*                           -
udp        0      0 192.168.0.100:123       0.0.0.0:*                           -
udp        0      0 192.168.1.1:123         0.0.0.0:*                           -
udp        0      0 127.0.0.1:123           0.0.0.0:*                           -
udp        0      0 0.0.0.0:123             0.0.0.0:*                           -
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -
udp6       0      0 :::58861                :::*                                -
udp6       0      0 :::53                   :::*                                -
udp6       0      0 :::3130                 :::*                                -
udp6       0      0 fe80::5604:a6ff:fed:123 :::*                                -
udp6       0      0 fe80::86c9:b2ff:fe4:123 :::*                                -
udp6       0      0 fe80::be5f:f4ff:fe1:123 :::*                                -
udp6       0      0 ::1:123                 :::*                                -
udp6       0      0 :::123                  :::*                                -
udp6       0      0 :::40673                :::*                                -
udp6       0      0 :::5353                 :::*                                -

iptables-save

# Generated by iptables-save v1.4.12 on Sat Dec  1 16:08:13 2012
*mangle
:PREROUTING ACCEPT [14642:4361384]
:INPUT ACCEPT [12397:4280637]
:FORWARD ACCEPT [2227:79851]
:OUTPUT ACCEPT [14238:7030369]
:POSTROUTING ACCEPT [16647:7124428]
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
COMMIT
# Completed on Sat Dec  1 16:08:13 2012
# Generated by iptables-save v1.4.12 on Sat Dec  1 16:08:13 2012
*nat
:PREROUTING ACCEPT [568:37051]
:INPUT ACCEPT [557:30622]
:OUTPUT ACCEPT [907:57168]
:POSTROUTING ACCEPT [241:14075]
-A PREROUTING -i eth0 -p tcp -m multiport --dports 80,8080 -j REDIRECT --to-ports 3128
-A PREROUTING -i eth1 -p tcp -m multiport --dports 80,8080 -j REDIRECT --to-ports 3128
-A PREROUTING -s 217.18.140.129/32 -i eth2 -p tcp -m tcp --dport 46654 -j DNAT --to-destination 192.168.1.50
-A POSTROUTING -o eth2 -j SNAT --to-source 195.208.161.154
COMMIT
# Completed on Sat Dec  1 16:08:13 2012
# Generated by iptables-save v1.4.12 on Sat Dec  1 16:08:13 2012
*filter
:INPUT DROP [583:40691]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [14247:7031773]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 366,3128 -j ACCEPT
-A INPUT -s 192.168.0.0/24 -p tcp -m multiport --dports 366,3128 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -p udp -m multiport --dports 53,123 -j ACCEPT
-A INPUT -s 192.168.0.0/24 -p udp -m multiport --dports 53,123 -j ACCEPT
-A INPUT -p tcp -m tcp --tcp-flags SYN,ACK SYN,ACK -m conntrack --ctstate NEW -j REJECT --reject-with tcp-reset
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j LOG --log-prefix "NEW not SYN: "
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j DROP
-A INPUT -d 195.208.161.154/32 -i eth2 -p tcp -m multiport --dports 366 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m limit --limit 3/min --limit-burst 3 -j LOG --log-prefix "IPT INPUT packet died: " --log-level 7
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 192.168.1.0/24 -i eth0 -j ACCEPT
-A FORWARD -s 192.168.0.0/24 -i eth1 -j ACCEPT
-A FORWARD -d 192.168.1.50/32 -i eth2 -p tcp -m tcp --dport 46654 -j ACCEPT
-A FORWARD -m limit --limit 3/min --limit-burst 3 -j LOG --log-prefix "IPT FORWARD packet died: " --log-level 7
COMMIT
# Completed on Sat Dec  1 16:08:13 2012

заранее спасибо за помощь

Оффлайн Alex Gluck

  • Участник
  • *
  • Сообщений: 166
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #1 : 01 Декабря 2012, 23:10:17 »
Я когда настраивал с похожей проблемой столкнулся. В конце /etc/ntp.conf добавь:
# а это волшебная штука, которая выставляет уровень доверия серверу (strata) самому себе равный 3
# в двух словах чем выше уровень-тем меньше число. 0 - это атомные часы,
# 1 - это синхронизированные с ними, 2 - с первым, и так далее.
server 127.127.1.1
fudge   127.127.1.1 stratum 2

Не помню уже где вычитал, но проблема в том, что уровень доверия твоему нтп серверу слишком низкий. Нормальное значение strata у нтп сервера должно быть от 2 до 4, а у тебя сейчас наверняка 16.
На всякий случай покажи выводы:
ntpdate -q pool.ntp.org
ntpdate -q 127.0.0.1
« Последнее редактирование: 01 Декабря 2012, 23:12:47 от AlexGluck »

Оффлайн winmasta

  • Автор темы
  • Активист
  • *
  • Сообщений: 348
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #2 : 02 Декабря 2012, 11:57:59 »
ntpdate снес сразуже, вот вывод ntpdc -c sysinfo -n

system peer:          95.172.152.243
system peer mode:     client
leap indicator:       00
stratum:              3
precision:            -22
root distance:        0.05867 s
root dispersion:      0.07268 s
reference ID:         [95.172.152.243]
reference time:       d4658573.95897b6b  Sun, Dec  2 2012 14:44:51.584
system flags:         auth monitor ntp kernel stats
jitter:               0.004791 s
stability:            0.000 ppm
broadcastdelay:       0.000000 s
authdelay:            0.000000 s

тут стратум 3, я делал и 2 но это не помогло


Пользователь решил продолжить мысль 02 Декабря 2012, 12:05:19:
сделал с удаленного компа на свой нтп сервер ntpdate -q МОЙ_НТП_ИП и вот вывод

server МОЙ_НТП_ИП, stratum 3, offset 0.010288, delay 0.02672
 2 Dec 15:03:12 ntpdate[6161]: adjust time server 195.208.161.154 offset 0.010288 sec

а виндовые (Win7 и Win6CE) машины не хотят синхронизироваться из локалки ни в какую
« Последнее редактирование: 02 Декабря 2012, 12:05:19 от winmasta »

Оффлайн Alex Gluck

  • Участник
  • *
  • Сообщений: 166
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #3 : 02 Декабря 2012, 16:21:44 »
Вот весь мой файл настройки /etc/ntp.conf:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

#driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

#statistics loopstats peerstats clockstats
#filegen loopstats file loopstats type day enable
#filegen peerstats file peerstats type day enable
#filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#server 0.ubuntu.pool.ntp.org
#server 1.ubuntu.pool.ntp.org
#server 2.ubuntu.pool.ntp.org
#server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
#server pool.ntp.org
#server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page
# <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
#restrict -4 default kod notrap nomodify nopeer noquery
#restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
#restrict 127.0.0.1
#restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 10.10.10.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 10.10.10.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

# локальный сервер
server         10.10.10.1
# интернет-сервера
server          1.ru.pool.ntp.org
server          ntp.ubuntu.com
#server          0.europe.pool.ntp.org
#server          2.europe.pool.ntp.org

# файлы
driftfile       /var/lib/ntp/ntp.drift
logfile         /var/log/ntp

# по умолчанию игнорируем все
restrict        default ignore
# локалхост без параметров - значит разрешено все. Параметры идут только на
# запреты.
restrict        127.0.0.1
# далее описываются сервера с которых получаем данные. Разрешаем им все кроме
# трапов и запросов к нам
restrict        172.22.128.8    noquery notrap
restrict        1.ru.pool.ntp.org       noquery notrap
# для локалки так же разрешаем все, кроме трапов и модификаций
restrict        10.10.10.1 mask 255.255.255.0 nomodify notrap nopeer

# а это волшебная штука, которая выставляет уровень доверия серверу (strata)
# самому себе равный 3
# в двух словах чем выше уровень-тем меньше число. 0 - это атомные часы,
# 1 - это синхронизированные с ними, 2 - с первым, и так далее.
server 127.127.1.1
fudge   127.127.1.1 stratum 2



У меня работает.

Оффлайн winmasta

  • Автор темы
  • Активист
  • *
  • Сообщений: 348
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #4 : 08 Декабря 2012, 06:57:03 »
Вот весь мой файл настройки /etc/ntp.conf:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

#driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

#statistics loopstats peerstats clockstats
#filegen loopstats file loopstats type day enable
#filegen peerstats file peerstats type day enable
#filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#server 0.ubuntu.pool.ntp.org
#server 1.ubuntu.pool.ntp.org
#server 2.ubuntu.pool.ntp.org
#server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
#server pool.ntp.org
#server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page
# <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
#restrict -4 default kod notrap nomodify nopeer noquery
#restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
#restrict 127.0.0.1
#restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 10.10.10.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 10.10.10.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

# локальный сервер
server         10.10.10.1
# интернет-сервера
server          1.ru.pool.ntp.org
server          ntp.ubuntu.com
#server          0.europe.pool.ntp.org
#server          2.europe.pool.ntp.org

# файлы
driftfile       /var/lib/ntp/ntp.drift
logfile         /var/log/ntp

# по умолчанию игнорируем все
restrict        default ignore
# локалхост без параметров - значит разрешено все. Параметры идут только на
# запреты.
restrict        127.0.0.1
# далее описываются сервера с которых получаем данные. Разрешаем им все кроме
# трапов и запросов к нам
restrict        172.22.128.8    noquery notrap
restrict        1.ru.pool.ntp.org       noquery notrap
# для локалки так же разрешаем все, кроме трапов и модификаций
restrict        10.10.10.1 mask 255.255.255.0 nomodify notrap nopeer

# а это волшебная штука, которая выставляет уровень доверия серверу (strata)
# самому себе равный 3
# в двух словах чем выше уровень-тем меньше число. 0 - это атомные часы,
# 1 - это синхронизированные с ними, 2 - с первым, и так далее.
server 127.127.1.1
fudge   127.127.1.1 stratum 2



У меня работает.
круто,а у меня нет

Оффлайн Alex Gluck

  • Участник
  • *
  • Сообщений: 166
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #5 : 08 Декабря 2012, 07:13:14 »
Тогда это на форум винды тебе. там где то обсуждалось.

Оффлайн winmasta

  • Автор темы
  • Активист
  • *
  • Сообщений: 348
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #6 : 10 Декабря 2012, 09:31:49 »
приехал через неделю - работает, венда берет время, видимо надо было подождать )

Оффлайн Alex Gluck

  • Участник
  • *
  • Сообщений: 166
    • Просмотр профиля
Re: Помогите настроить NTP сервер
« Ответ #7 : 10 Декабря 2012, 11:04:32 »
Вот ты жук.

 

Страница сгенерирована за 0.025 секунд. Запросов: 21.