【検証】CiscoルータをNTPサーバにして配下機器で時刻同期してみた

ネットワーク

今回はCiscoルータをNTPサーバにして時刻同期しようと思います。

 

 

検証環境

 

前回の記事でCiscoルータをNTPサーバと同期させました。

【検証】CiscoルータをNTPサーバに接続し、時刻同期させてみた
今回はCiscoルータをNTPサーバに接続し、時刻同期をしてみたいと思います。  検証環境 Ciscoルータ1台、NTP用のサーバ1台用意しました。NTPサーバのIPアドレスは「19...

 

今回はさらにもう1台Ciscoルータを準備して、NTPサーバと時刻同期したCiscoルータをNTPサーバとして動作をさせて、配下機器で時刻同期できるかを試していきたいと思います。

 

スポンサーリンク

 

 

Ciscoルータ(NTPサーバ)の設定

まずは前回と同様で、下記コマンドを投入してCiscoルータ(NTPサーバ)をNTPサーバと時刻同期できるようにします。

Router(config)#
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown 
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#
Router(config)#
Router(config)#ntp server 192.168.1.100
Router(config)#

 

配下のネットワーク機器と接続するためのインタフェースを作ります。

FE0/1に「192.168.2.1/24」を設定し、「no shutdown」で解放します。

Router(config)#
Router(config)#inter
Router(config)#interface fa
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip add
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shu
Router(config-if)#no shutdown 
Router(config-if)#
*Dec 14, 14:51:33.5151: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#
Router(config-if)#

 

CiscoルータをNTPサーバとして動作させる設定を行うため「ntp master」を投入します。ストラタムを「1〜15」の中から選ぶこともできますし、そのままエンターを押してデフォルトの「8」に設定することもできます。今回はデフォルトの「8」でいきたいと思います。

Router(config)#ntp master ?
  <1-15>  Act as NTP master clock
  <cr>
Router(config)#ntp master 
Router(config)#

 

 

配下機器の設定

Ciscoルータ(NTPサーバ)と時刻同期を行う配下機器の設定を行います。内容としては、前回の記事と同様です。

【検証】CiscoルータをNTPサーバに接続し、時刻同期させてみた
今回はCiscoルータをNTPサーバに接続し、時刻同期をしてみたいと思います。  検証環境 Ciscoルータ1台、NTP用のサーバ1台用意しました。NTPサーバのIPアドレスは「19...

 

まずはインタフェースの設定を行います。

FE0/0に「192.168.2.2/24」の設定を行い、「no shutdown」をしてインタフェースを解放します。

Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.2.2 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#
Router(config-if)#

 

その後、NTPサーバとしてCiscoルータ(NTPサーバ)のIPアドレス「192.168.2.1」を設定します。

Router(config)#
Router(config)#ntp server 192.168.2.1
Router(config)#

 

 

動作確認

配下機器で時刻同期できることを確認します。

 

時刻同期できていることを確認するコマンドとして「show ntp associations」、時刻同期後のシステムクロックを確認するコマンドとして「show clock」を入力した結果は下記の通りです。

Router#show ntp associations 
address         ref clock       st   when     poll    reach  delay          offset            disp
*~192.168.2.1   127.127.1.1     8    13       16      277    0.00           0.00              0.12
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
Router#
Router#show clock 
15:53:17.183 UTC Wed Dec 14 2022
Router#

 

スポンサーリンク

 

 

設定後のコンフィグ

設定を行ったCiscoルータのコンフィグは下記の通りです。

 

Ciscoルータ(NTPサーバ)の設定済みコンフィグ

Router#show running-config 
Building configuration...

Current configuration : 612 bytes
!
version 12.4
no service timestamps log datetime msec
service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
ntp server 192.168.1.100
ntp master
!
end

 

配下機器の設定済みコンフィグ

Router#show running-config
Building configuration...

Current configuration : 589 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 192.168.2.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
ntp server 192.168.2.1
!
end

 

 

最後に

NTPの機能だけを持ったサーバは少なく、RADIUSやDNS、DHCP、Syslogといった複数のサービスを動かしていることがほとんどです。

 

そのため、配下のネットワーク機器が全てNTPサーバに時刻同期をする設定をしているとサーバの負荷が高くなってしまうため、ネットワークの中心に位置しているコアスイッチがNTPサーバの代行をするパターンがよくあります。

 

そのため、今回使用した「ntp master」コマンドは知っていて損はないと思います。

 

 

勉強教材

コメント

タイトルとURLをコピーしました