把華爲交換機設置成(NTP)時鐘源服務器,提供給下面客戶端Linux服務器使用,
1,先設置交換機的時區,和正確時間
假設地理位置在中國北京,設置本地時區名稱爲BJ。
如果系統默認的UTC是倫敦時間,倫敦當地時間爲2012年12月1日0時0分0秒,想要得到對應的北京時間的方法是:北京處於+8時區,時間偏移量增加了8。在配置時,就是在系統默認的UTC時區的基礎上,加上偏移量8,才能得到預期的BJ時區。
clock timezone BJ add 08:00:00
設置時區並在現在的UTC基礎上偏移8
clock datetime 0:0:0 2012-12-01
這是設置時間的命令,設置成對應的北京時間就行。
2,開啓交換機的NTP服務
使能NTP服務器功能。
[~HUAWEI] undo ntp server disable 開啓NTP服務(默認關閉)
[*HUAWEI] commit
配置NTP主時鐘,層數爲2。
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
3,下面的是NTP設置的更多功能,可以不配置
配置NTP認證功能,配置認證密鑰並聲明該密鑰可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
廣播模式
配置NTP主時鐘,層數爲2。
system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
配置NTP認證功能,配置認證密鑰並聲明該密鑰可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
配置NTP廣播服務器,從接口10GE1/0/1發送NTP廣播報文,並指定使用密鑰ID 42加密。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp broadcast-server authentication-keyid 42
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
使能NTP服務器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit
組播模式
配置NTP主時鐘,層數爲2。
system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
配置NTP認證功能,配置認證密鑰並聲明該密鑰可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
配置NTP組播服務器,從接口10GE1/0/1發送NTP組播報文,並指定使用密鑰ID 42加密。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp multicast-server authentication-keyid 42
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
使能NTP服務器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit
多播模式
配置NTP主時鐘,層數爲2。
system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
配置NTP認證功能,配置認證密鑰並聲明該密鑰可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
配置NTP多播服務器,從接口10GE1/0/1發送NTP多播報文。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp manycast-server
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
使能NTP服務器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit