Ubuntu as an NTP server
1. Installing NTP
sudo apt-get install NTP
2. NTP server
Vim/etc/ntp.conf
The following parameters are mainly included in the configuration file/etc/ntp.conf
The following parameter 1 is mainly included in the configuration file/etc/ntp.conf. Restrict <ip address >< subnet mask >|< network segment > < subnet mask > [Ignore|nomodify|noquery|notrap|notrust|nokod]: Specify an IP address or network segment that can be used for NTP communication 1.1 ignore: Turns off all NTP services 1.2 nomodify: Indicates that the client cannot change the time parameters of the NTP server, but can be time-proofing through the NTP server 1.3 noquery: no NTP service 1.4 Notrap: does not provide a trap remote event logon function 1.5 Notrust: Poly Not authenticated client 1.6 Kod:kod technology can organize the "Kiss of Death" package (a Dos attack) on the server's destruction, using this parameter will turn on the function 1.7 Nopeer: No time synchronization with other NTP servers on the same layer if no option is specified, the specified client does not have any limit of 2 access to the NTP server. Server [ip| FQDN] [prefer]: Specifies the NTP server upper layer NTP server, if there are multiple upper NTP servers, then refer to the priority of prefer for time synchronization, prefer the smaller the priority of the higher 3. Broadcast Mesh Mask: Specifies the network segment for NTP time broadcasts, and when this parameter is not specified, the NTP server broadcasts to all the network segments that can be accessed
Driftfile//used to set the file to save the drift time. #解决NTP服务器校准时间时的传送延迟
server [IP] [prefer]///upper server Ip,prefer indicates priority usage
The following definition is to keep the NTP server in sync with itself, and if the server defined in/ntp.conf is not available, the local time will be used as the NTP service for the NTP client.
Server 127.127.1.0
Fudge 127.127.1.0 Stratum 8
The fudge item is used to set the level for this clock. It is desirable to treat the internal system clock as if the time source is treated as a level 10来, so that clients accessing the true NTP server will synchronize with these servers
2.1 Client Connection Management
Restrict default nomodify notrap Nopeer//defaults to deny all IP sync requests
Restrict 192.168.122.0 mask 255.255.255.0 nomodify
2.2
Restrict default nomodify//Allow all users to sync
3. Server-side Boot
/ETC/INIT.D/NTPD start [stop] [restart]
Service NTP Stop/start
Watch Ntpq-q//view NTP vs. Upper State
Ps-ef | grep ntpd//View client Run
4. Client Synchronization
ntpdate-d [IP]
5. View the synchronization log
You can also view/var/log/ntp/ntp.log
tcpdump UDP port 123
Ubuntu Configuration NTP Service