我有一台运行 Linux ( 3.12 ) 版本的笔记本电脑。我已经安装并配置了 ntpd 以与 time.google.com 同步。我遇到的问题是,如果我插入一个只提供 IPV4 地址的网络,ntp 的 dns 使用的是 ipv6 地址:
root@Node00b01973d6cc:~# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 7 64 1 0.000 0.000 0.002
ff0e::101 .MCST. 16 M - 64 0 0.000 0.000 0.002
2001:4860:4806: .INIT. 16 u - 64 0 0.000 0.000 0.000
Run Code Online (Sandbox Code Playgroud)
现在,如果我强制 ntpd 仅使用带有 -4 选项的 ipv4 DNS,则一切正常
root@Node00b01973d6cc:~# ntpq -pn 172.16.17.111
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 60 64 1 0.000 0.000 0.002
216.239.35.12 .GOOG. 1 u 57 64 1 29.278 341.883 0.002
Run Code Online (Sandbox Code Playgroud)
但我不想这样做,因为如果我去一个只提供 ipv6 地址的网络,这将失败。如果我的接口实际上在该系列中有一个 ip 地址,有没有办法将 ntp 配置为仅使用 ipv4(或 ipv6)?
ntpd 的版本是 4.2.8p12。这是 ntp.conf 文件:
tinker panic 0
driftfile /usr/local/etc/ntp.drift
disable auth
# Update the realtime clock and override its default
# stratum of 0.
server time.google.com prefer #Real Time Clock
server 127.127.1.0 #Real Time Clock
server 127.127.1.0 #Real Time Clock
fudge 127.127.1.0 stratum 10
broadcast ff0e::101 iburst ttl 7
Run Code Online (Sandbox Code Playgroud)
我已经弄清楚了为什么会发生这种情况的根本原因。我最近在我的系统上禁用了 ipv6 转发。一旦我重新打开 ipv6 转发,ntp 就会按照我的预期开始使用 ipv4 地址。
为什么要开启 ipv6 转发呢?
默认情况下,系统启动时禁用 ipv6 转发。要打开它,在其中一个启动脚本中,我有一行:
sysctl -w net.ipv6.conf.all.forwarding=1
Run Code Online (Sandbox Code Playgroud)
小智 0
localhost
从主机文件中删除或注释掉 IPv6 :
#::1 localhost6.localdomain6 localhost6
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2136 次 |
最近记录: |