導航:首頁 > IDC知識 > ubuntuntp伺服器

ubuntuntp伺服器

發布時間:2020-11-14 05:10:11

1、如何在Ubuntu和LinuxMint設置時間同步伺服器

編輯 /etc/ntp.conf ,並更改以下緩沖池根據您的選擇。默認情況下,這些伺服器的配置:

# 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

刷新NTP伺服器
在ntp.conf更改後,重新載入你的 ntp 服務
$ sudo service ntp reload
打開防火牆埠
NTP伺服器使用埠123的服務請求。因此,我們需要在防火牆中打開123埠。
iptables的用戶:
$ sudo iptables -A INPUT -m state --state NEW -p tcp --dport 123 -j ACCEPT
UFW用戶:
$ sudo ufw allow 123/tcp
在客戶端同步時間
使所有配置重啟生效後,現在通過同步客戶端系統驗證伺服器配置。例如,如果你的伺服器的IP是192.168.1.100,然後通過客戶端系統上運行的終端下面的命令。
$ ntpdate -s 192.168.1.100

2、linux怎樣自動校正時間?

linux可以通過命令去取世界時間,命令格式如下ntpdate -s time.windows.com前提是需要該linux能夠上網,需要自動更內新的話,加入系統計劃任務容即可。按照你需要的每小時或者每分鍾去校準即可。若在內網,你可以自己搭建一個時間伺服器,有windows的,也有linux的。這里就不再說了。

3、系統時間錯亂如何使用NTP進行系統時間調整

解決方法:

1. 創建一個文件/etc/cron.daily/timeupdate:

___FCKpd___0nbsp;sudo nano /etc/cron.daily/timeupdate

2. 輸入以下內容:回

ntpdate ntp.ubuntu.com

3. 保存文件後,還需要賦予其可執行權答限:

___FCKpd___2nbsp;sudo chmod 755 /etc/cron.daily/timeupdate

這樣,系統就可以每天獲取時間(/etc/cron.daily/目錄下的所有任務都會被每天執行一次),並校準伺服器本身的時間。如果你擔心時間獲取失敗,則可以將多個NTP伺服器添加到/etc/cron.daily/timeupdate文件中:

ntpdate ntp.ubuntu.com pool.ntp.org

4、如何在ubuntu和linuxmint設置時間同步伺服器

首先安裝ntp service的安裝包 安裝完成後,運行ntp命令同步時間就可以了 ntp -d serverIP

5、如何在Ubuntu中使用NTP進行時間同步

修改注冊表,提高時間同步精度

由於系統默認的時間同步間隔是7天,我們無法自由版選擇,使得這個功能權在靈活性方面大打折扣。其實,我們也可以通過修改注冊表來手動修改它的自動同步間隔以提高同步精度,以下以XP系統為例。
1. 在「開始」菜單→「運行」項下輸入「Regedit」進入注冊表編輯器
2. 展開[
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/W32Time/TimeProviders/NtpClient
] 分支,並雙擊 SpecialPollInterval 鍵值,將對話框中的「基數欄」選擇到「十進制」上
3.
對話框中顯示的數字正是自動對時的間隔(以秒為單位),比如默認的604800就是由7(天)×24(時)×60(分)×60(秒)計算來的。設定時間同步周期(建議設為900=15分鍾或3600=1小時等周期值),填入對話框,點擊確定保存關閉對話框。
4.
在Parameters列表中,將NtpServer鍵值修改為NTP伺服器的IP地址(1.cn.pool.ntp.org),然後點擊「確定」按鈕保存。

6、linux怎麼添加ntp伺服器

個人linux系統比如ubuntu、deepin等都已經安裝了,只需要勾選同步網路時間即可。
如果是伺服器可以參考:

[root@localhost /]# yum install ntp -y

2.修改NTP配置文件,添加NTP伺服器的網路位置 /etc/ntp.conf

# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.1.1 iburst #目標伺服器網路位置
#server 1.CentOS.pool.ntp.org iburst #一下三個是CentOS官方的NTP伺服器,我們注釋掉
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats

# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor

保存退出

3.啟動服務並設置開啟自啟

[root@localhost /]# systemctl start ntpd.service#啟動服務
[root@localhost /]# systemctl enable ntpd.service#設置為開機啟動

7、LINUX中,網路校時ntpdate用法

ntpdate簡單用法:

# ntpdate ip
# ntpdate 210.72.145.44

以下是一些可用的NTP伺服器地址:

Name
IP Location

210.72.145.44 210.72.145.44 中國(國家授時中心)
133.100.11.8 133.100.11.8 日本(福岡大學)
time-a.nist.gov 129.6.15.28 NIST,Gaithersburg,Maryland
time-b.nist.gov 129.6.15.29 NIST,Gaithersburg,Maryland
time-a.timefreq.bldrdoc.gov 132.163.4.101 NIST,Boulder,Colorado
time-b.timefreq.bldrdoc.gov 132.163.4.102 NIST,Boulder,Colorado
time-c.timefreq.bldrdoc.gov 132.163.4.103 NIST,Boulder,Colorado
utcnist.colorado.e 128.138.140.44 UniversityofColorado,Boulder
time.nist.gov 192.43.244.18 NCAR,Boulder,Colorado
time-nw.nist.gov 131.107.1.10 Microsoft,Redmond,Washington
nist1.symmetricom.com 69.25.96.13 Symmetricom,SanJose,California
nist1-dc.glassey.com 216.200.93.8 Abovenet,Virginia
nist1-ny.glassey.com 208.184.49.9 Abovenet,NewYorkCity
nist1-sj.glassey.com 207.126.98.204 Abovenet,SanJose,California
nist1.aol-ca.truetime.com 207.200.81.113 TrueTime,AOLfacility,Sunnyvale,California
nist1.aol-va.truetime.com 64.236.96.53 TrueTime,AOLfacility,Virginia

8、如何在ubuntu server 搭建ntp伺服器

1、安裝ntp軟體
sudo apt-get install ntp
2、修改配置文件
sudo vim /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
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
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 192.168.10.0 mask 255.255.255.0 nomodify
restrict 127.0.0.1
restrict ::1
主要是在配置文件中的:
restrict -6 default kod notrap nomodify nopeer noquery
語句後面加入:
restrict 192.168.10.0 mask 255.255.255.0 nomodify
restrict 192.168.10.0 mask 255.255.255.0 nomodify---主要是允許能同步的伺服器所在的內部網段

9、ubuntu系統如何與使用sntp協議的gps對時

幾乎所有抄的Linux發行版本都有現成的,你找一下NTP相關的包,通常是ntpd之類的名字,裝上,設定好htp伺服器(所有的Linux發行版也都提供自己的ntp伺服器),保證服務開啟就好了。

ntp說白了是同步Unix時間,你說的北京時間用時區設定就好了,與ntp無關。可以參考下《Linux就該這么學》詳細了解相關知識

10、用ubuntu桌面版做伺服器嗎

Ubuntu系統做伺服器,不同的服務需要安裝不同的軟體,例如:WEb服務需要安裝Apache,FTP服務需要安裝VSFTP,時間服務需要安裝NTP,下面以Ubuntu作為FTP伺服器為例:
1.安裝vsftpd
sudo apt-get install vsftpd

2.配置vsftpd
#修改vsftpd的配置文件。此類配置文件通常位於 /etc 目錄下
sudo gedit /etc/vsftpd.conf
#配置文件中具體說明
listen=YES # 伺服器監聽
#anonymous_enable=YES # 匿名訪問允許 很危險,默認不要開啟,
local_enable=YES # 本地主機訪問允許
write_enable=YES # 寫允許
#anon_upload_enable=YES
# 匿名上傳允許,默認是NO,嫌麻煩的可以開起來。出了問題我不負責~
#anon_mkdir_write_enable=YES # 匿名創建文件夾允許
dirmessage_enable=YES # 進入文件夾允許
xferlog_enable=YES # ftp 日誌記錄允許
connect_from_port_20=YES # 允許使用20號埠作為數據傳送的埠
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem3.啟動FTP服務sudo service vsftpd start

與ubuntuntp伺服器相關的知識