我四处搜索,但找不到答案。
我可以将我的树莓派用作NTP服务器(独立(吗?
我想同步 LAN 上的 4 台设备以进行日志记录。他们将位于没有广域网访问权限的局域网上...一个是思科交换机,一个是Pi,另外两个是我想登录的转换盒(它们将是NTP客户端(。
我只需要它们全部系统到 1 个时钟源(Pi(有没有办法做到这一点?我找到的所有答案都是要么使用 GPS 模块设置 Pi(我在这里做不到(,要么将其同步到外部 NTP 服务器以级联时钟(我在这里做不到(......我可以使用 NTP 来发送 Pi 的系统时间吗?
你可以,但最好使用时间源。 您需要编辑 NTP 服务器的代码,因为没有太多理由这样做。
最好的主意是在RPi上使用GPS帽子 http://www.reeve.com/Documents/Articles%20Papers/Reeve_GpsNtp-Pi.pdf
亲爱的未来人士:这是我们到目前为止所发现的......
在树莓派上,运行以下命令:
sudo apt update
sudo apt install ntp
sudo ufw allow ntp # if your firewall is enabled
sudo ufw allow 123
sudo sed --in-place --expression "$aserver 127.127.1.0" /etc/ntp.conf
sudo systemctl start ntpd
在思科交换机上,运行以下命令:
注意- 如果您使用的是思科 IOS,请不要忘记使用clock read-calendar
强制进行 NTP 同步。
configure terminal
ntp server <the IPv4 address of your Raspberry Pi>
end
clock read-calendar
PS- 如果你想关闭一切...
在树莓派上,运行以下命令:
sudo ufw delete allow ntp
sudo ufw delete allow 123
sudo systemctl stop ntpd
sudo sed -i "/server 127.127.1.0/d" /etc/ntp.conf
在思科交换机上,运行以下命令:
configure terminal
no ntp server <the IPv4 address of your Raspberry Pi>
end