GoNTPd is an experimental high-performance NTP server written in Go. It does NOT implement a full NTP client and relies on another NTP client and server to be running on the system instead. It periodically updates its state to mirror the real NTP client/server and uses multiple threads to serve the current system time. Inspired by rsntp
# require go1.11
go get github.com/mengzhuo/gontpd/cmd/gontpd
gontpd -c config.yml
# listen: gontpd service listen port (UDP)
listen: ':123'
# worker_num: goroutines per connection
worker_num: 1
# metric: prometheus stat listen port
metric: ':7370'
# peer_list: upstream peer list that sync to
up_state: 127.0.0.1:123
up_state_sec: 16
# acl: remote address within this list will be drop
# suggest to drop private net request(mostly are spoof request)
acl:
- "192.168.0.0/16"
- "172.16.0.0/12"
- "10.0.0.0/8"
- "100.64.0.0/10"
iptables
-A PREROUTING -p udp -m udp -t raw --dport 123 -j NOTRACK
-A OUTPUT -p udp -m udp -t raw --sport 123 -j NOTRACK
sysctl
net.core.rmem_default = 5129920
net.core.rmem_max = 5129920
net.core.wmem_default = 5129920
net.core.wmem_max = 5129920
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
~180kpps @ GOMAXPROCS=1