簡介
本文檔介紹用於充當網路時間協定(NTP)伺服器和客戶端的Nexus 9000平台的簡單配置和驗證。
必要條件
需求
思科建議您瞭解以下主題:
- Nexus NX-OS軟體。
- 網路時間協定(NTP)。
採用元件
本檔案中的資訊是根據搭載NXOS版本10.2(5)的Cisco Nexus 9000。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
設定
NTP是一種網路協定,用於將網路內一組裝置的時間同步到 當您從多個網路裝置接收系統日誌和其他特定時間事件時,關聯事件。
網路圖表
組態
步驟 1.啟用NTP。
feature ntp
步驟 2.將時鐘協定設定為NTP。
clock protocol ntp
步驟 3.將Nexus定義為NTP客戶端和伺服器。
警告:即使從伺服器到客戶端交換資料包,此協定仍可能需要幾分鐘才能同步。
註:NTP使用層的概念來表示機器與權威時間源之間的距離(以NTP跳為單位)。當在Nexus上使用「ntp master <stratix>」命令啟用NTP伺服器時,可以配置此值。
N9K-1# show running-config ntp
ntp source 10.0.0.1
ntp master 1
N9K-2# show running-config ntp
ntp server 10.0.0.1 use-vrf default
ntp source 10.0.0.2
ntp master 8
N9K-3# show running-config ntp
ntp server 172.16.0.1 use-vrf default
ntp source 172.16.0.2
驗證
注意:為了進行驗證,驗證僅集中在N9K-2上,因為它同時運行NTP伺服器和客戶端角色。
1.確認時鐘已配置有NTP協定。
N9K-2# show clock
12:32:51.528 UTC Thu Sep 28 2023
Time source is NTP <<<<<
2.確認NTP伺服器和Nexus IP已列出。
註:IP地址為127.127.1.0的條目是一個本地IP,表示Nexus已與其自身同步,表示作為NTP伺服器角色一部分的本地生成的參考時鐘源。
N9K-2# show ntp peers
--------------------------------------------------
Peer IP Address Serv/Peer
--------------------------------------------------
10.0.0.1 Server (configured)
127.127.1.0 Server (configured) <<<
3.確認已選擇要同步的NTP伺服器。
註:第16層表示伺服器當前未與可靠的時間源同步,因此絕不會選擇伺服器進行同步。從Cisco NX-OS版本10.1(1)開始,只有13個或更低層可以同步。
N9K-2# show ntp peer-status
Total peers : 2
* - selected for sync, + - peer mode(active),
- - peer mode(passive), = - polled in client mode
remote local st poll reach delay vrf
-----------------------------------------------------------------------------------------------------------------------
=127.127.1.0 10.0.0.2 8 16 0 0.00000
*10.0.0.1 10.0.0.2 2 32 377 0.00107default <<< server selected for sync (*)
4.驗證是否接收了NTP資料包並將其傳送到伺服器。
註:命令「show ntp statistics peer ipaddr <ntp-server>」僅適用於NTP客戶端。如果計數器上有非預設值,可以使用命令「clear ntp statistics all-peers」清除這些值。
N9K-2# show ntp statistics peer ipaddr 10.0.0.1
remote host: 10.0.0.1
local interface: 10.0.0.2
time last received: 28s
time until next send: 5s
reachability change: 876s
packets sent: 58 <<<<<
packets received: 58 <<<<<
bad authentication: 0
bogus origin: 0
duplicate: 0
bad dispersion: 0
bad reference time: 0
candidate order: 6
雙向NTP資料包流的資料包捕獲示例:
N9K-2# ethanalyzer local interface inband display-filter ntp limit-captured-frames 0
Capturing on 'ps-inb'
4 2024-01-01 03:23:47.900233043 172.16.0.2 → 172.16.0.1 NTP 90 NTP Version 4, client
2 5 2024-01-01 03:23:47.900863464 172.16.0.1 → 172.16.0.2 NTP 90 NTP Version 4, server
6 2024-01-01 03:23:52.926382561 10.0.0.2 → 10.0.0.1 NTP 90 NTP Version 4, client
4 7 2024-01-01 03:23:52.927169592 10.0.0.1 → 10.0.0.2 NTP 90 NTP Version 4, server
5.搜尋從Nexus傳送到其NTP客戶端的資料包,以使用配置的NTP伺服器作為參考確認該資料包:
N9K-2# ethanalyzer local interface inband display-filter ntp limit-captured-frames 0 detail
Capturing on 'ps-inb'
...
6.運行ELAM以驗證是否正確將資料包分配到Supervisor(COPP)重定向ACL的統計資訊:
註意:NTP流量必須傳送到CPU,因此它設定了sup_hit標誌。
N9K-2# debug platform internal tah elam
N9K-2(TAH-elam)# trigger init
Slot 1: param values: start asic 0, start slice 0, lu-a2d 1, in-select 6, out-select
N9K-2(TAH-elam-insel6)# reset
N9K-2(TAH-elam-insel6)# set outer ipv4 next-protocol 17 packet-len 76 src_ip 10.0.0.1 dst_ip 10.0.0.2
N9K-2(TAH-elam-insel6)# start
N9K-2(TAH-elam-insel6)# report
SUGARBOWL ELAM REPORT SUMMARY
slot - 1, asic - 0, slice - 0
============================
Incoming Interface: Eth1/48
Src Idx : 0xbd, Src BD : 4147
Outgoing Interface Info: dmod 0, dpid 0
Dst Idx : 0x5bf, Dst BD : 4147
Packet Type: IPv4
Dst MAC address: D4:77:98:2B:4C:87
Src MAC address: D4:77:98:2B:43:27
Sup hit: 1, Sup Idx: 2753 <<<<< packet punt identifier, use below CLI to resolve its meaning
Dst IPv4 address: 10.0.0.2
Src IPv4 address: 10.0.0.1
Ver = 4, DSCP = 0, Don't Fragment = 0
Proto = 17, TTL = 255, More Fragments = 0
Hdr len = 20, Pkt len = 76, Checksum = 0xae26
L4 Protocol : 17
UDP Dst Port : 123
UDP Src Port : 123
Drop Info:
----------
LUA:
LUB:
LUC:
LUD:
Final Drops:
vntag:
vntag_valid : 0
vntag_vir : 0
vntag_svif : 0
ELAM not triggered yet on slot - 1, asic - 0, slice - 1
N9K-2(TAH-elam-insel6)# show system internal access-list sup-redirect-stats | i 2753
2753 copp-system-p-acl-ntp 462 <<<<< correct ACL assigned
相關資訊
Cisco Nexus 9000系列NX-OS系統管理配置指南10.2(x)版