# Cisco IOS NTP Server Tutorial
Network Time Protocol (NTP) is a networking protocol used to synchronize the clocks of computers and network devices over packet-switched networks. This tutorial will guide you through configuring a Cisco router or switch as an NTP server using terminal examples.
## Objectives
- Understand the NTP architecture.
- Configure a Cisco IOS device as an NTP server.
- Verify NTP configuration and synchronization.
## Prerequisites
- Access to a Cisco router or switch with IOS.
- Basic knowledge of Cisco IOS commands and configuration modes.
## NTP Architecture Overview
NTP operates in a hierarchical system of time sources, where each level is called a stratum. Stratum 0 represents high-precision timekeeping devices (like atomic clocks), while Stratum 1 represents primary servers directly connected to Stratum 0 devices. Cisco devices can be configured as Stratum 2 or lower.
## Step 1: Access the Device
1. Connect to your Cisco router or switch via console or SSH.
2. Enter privileged EXEC mode:
```plaintext
Router> enable
```
## Step 2: Configure the Device as an NTP Server
### 2.1. Enter Global Configuration Mode
To configure NTP, you need to enter global configuration mode.
```plaintext
Router# configure terminal
```
### 2.2. Set the NTP Server's Stratum Level
You can configure your device as an NTP server. Use the command to specify its stratum level. For example, to configure it as a Stratum 2 server:
```plaintext
Router(config)# ntp master 2
```
### 2.3. Configure NTP Authentication (Optional)
If you want to use authentication for NTP, you can set a key and configure authentication. Here’s how:
1. Set the key number and key string:
```plaintext
Router(config)# ntp authentication-key 1 md5 myNTPkey
```
2. Enable NTP authentication:
```plaintext
Router(config)# ntp authenticate
```
3. Configure the trusted key:
```plaintext
Router(config)# ntp trusted-key 1
```
### 2.4. Configure NTP Peers (Optional)
If your NTP server will synchronize time with other NTP servers, use the following command:
```plaintext
Router(config)# ntp server <NTP_SERVER_IP> key 1
```
Replace `<NTP_SERVER_IP>` with the IP address of the upstream NTP server.
### 2.5. Exit Configuration Mode
After configuring NTP settings, exit configuration mode:
```plaintext
Router(config)# exit
Router#
```
## Step 3: Configure NTP Client on Other Devices
To synchronize time on other devices in the network, configure them as NTP clients. For example, on another Cisco router:
### 3.1. Enter Global Configuration Mode
```plaintext
Router# configure terminal
```
### 3.2. Specify the NTP Server
Use the following command to configure the NTP server's IP address:
```plaintext
Router(config)# ntp server <NTP_SERVER_IP>
```
Replace `<NTP_SERVER_IP>` with the IP address of your NTP server.
### 3.3. Exit Configuration Mode
```plaintext
Router(config)# exit
Router#
```
## Step 4: Verify NTP Configuration
### 4.1. Check NTP Status
To verify that your NTP server is running and synchronized, use the following command:
```plaintext
Router# show ntp status
```
### 4.2. Check NTP Associations
To see which NTP servers your device is associated with, use:
```plaintext
Router# show ntp associations
```
### 4.3. Check NTP Clients
If your router is acting as an NTP server, you can check its clients:
```plaintext
Router# show ntp associations detail
```
## Step 5: Troubleshooting NTP Issues
If you encounter issues with NTP synchronization, consider the following troubleshooting steps:
1. **Check Clock Settings**: Ensure the local clock is set correctly. Use:
```plaintext
Router# show clock
```
2. **Check NTP Configuration**: Review the NTP configuration using:
```plaintext
Router# show run | include ntp
```
3. **Check NTP Reachability**: Ensure that the NTP server is reachable. Use:
```plaintext
Router# ping <NTP_SERVER_IP>
```
4. **Debug NTP**: Enable NTP debugging for further diagnosis:
```plaintext
Router# debug ntp packets
```
## Conclusion
In this tutorial, you learned how to configure a Cisco IOS device as an NTP server and how to configure other devices as NTP clients. You also learned how to verify the NTP configuration and troubleshoot common issues. Proper time synchronization is crucial for network operations, and configuring NTP correctly will help maintain time accuracy across your network.
Rate This Article
Thanks for reading: Cisco IOS NTP Server Tutorial, Sorry, my English is bad:)