Category Archives: HTTP Concepts

How to sync server time with Network Time Protocol server

Sync server time on Linux with NTP

What is NTP?

An Internet protocol is used to synchronise clocks of computers, for instance linux server. This protocol is known as NTP (Network Time Protocol).

Following steps shows how to sync time using the terminal. Before we start login to the server via terminal and follow the steps given below.

Step 1: Check whether NTP is installed

Use the ntpstat command to view the status of the NTP service on the instance. It may happen that you get an error message prompting that NTP is not installed. In that case you have to install it on the server.

# sudo ntpstat
-bash: ntpstat: command not found

Step 2: Install NTP

Use the following command to install NTP on server.

# sudo yum install ntp

Step 3: Start NTP

After the installation is complete we need to start NTP by using the following command.

# sudo systemctl start ntpd

Note!

Enable NTP to start at boot:

# sudo systemctl enable ntpd

Stop NTP:

# sudo systemctl stop ntpd

Restart NTP:

# sudo systemctl restart ntpd

Step 4: Sync Time

For this use the following command.

# sudo ntpdate -q 0.rhel.pool.ntp.org

And restart NTP

# sudo systemctl restart ntpd

…and the server time will be synced.

Sync server time on Windows with SNTP

What is SNTP?

Simple Network Time Protocol (SNTP) is a simplified version of Network Time Protocol (NTP).  This is used to synchronize computer clocks on a network. As name defines simplified version of NTP is generally used when full implementation of NTP is not needed.

SNTP is a simplified access strategy for servers and clients using NTP. This simplified protocol is widely used to synchronizes a computer’s system time with a server that has already been synchronized by a source such as a radio, satellite receiver or modem. 

Interestingly, SNTP supports unicast, multicast and anycast operating modes. In unicast mode, the client sends a request to a dedicated server by referencing its unicast address. Once a reply is received from the server, the client determines the time, roundtrip delay and local clock offset in reference to the server. In multicast mode, the server sends an unsolicited message to a dedicated IPv4 or IPv6 local broadcast address. Generally, a multicast client does not send any requests to the service because of the service disruption caused by unknown and untrusted multicast servers. The disruption can be avoided through an access control mechanism that allows a client to select a designated server he or she knows and trusts.

Use below code to sync server time on windows machine

@echo on & @setlocal enableextensions

@echo =========================
@echo Turn off the time service
net stop w32time

@echo =========================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server

w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"

@echo =========================
@echo ... and then turn on the time service back on

net start w32time

@echo =========================
@echo Tell the time sync service to use the changes

w32tm /config /update

@echo =========================
@echo Reset the local computer's time against the time server

w32tm /resync /rediscover

@endlocal & @goto :EOF
'Coz sharing is caring

External command

An external command is an MS-DOS command that is not included in command.com. External commands are commonly external either because they require large requirements or are not commonly used commands. The illustration shows each of the external commands are separate files. However, the internal commands are all included in the command.com file.

external command, internal command

Listing of external commands

Below are examples of MS-DOS and Windows command line external commands currently listed on Computer Hope.

  • Append
  • Arp
  • Assign
  • At
  • Attrib
  • Backup
  • Bcdedit
  • Bootsect
  • Cacls
  • Chcp
  • Chkdsk
  • Chkntfs
  • Choice
  • Cipher
  • Clip
  • Comp
  • Compact
  • Convert
  • Debug
  • Defrag
  • Delpart
  • Deltree
  • Diskcomp
  • Diskcopy
  • Doskey
  • Dosshell
  • Driverquery
  • Dumpchk
  • Edit
  • Edlin
  • Expand
  • Extract
  • Fasthelp
  • Fc
  • Fciv
  • Fdisk
  • Find
  • Forfiles
  • Format
  • FTP
  • Gpupdate
  • Graftabl
  • Help
  • Hostname
  • ICacls
  • Ipconfig
  • Label
  • Loadfix
  • logoff
  • Mem
  • Mode
  • More
  • Move
  • Msav
  • Msbackup
  • Mscdex
  • Mscdexnt
  • Mwbackup
  • Msd
  • Msg
  • Nbtstat
  • Net
  • Netsh
  • Netstat
  • Nlsfunc
  • Nslookup
  • Pathping
  • Ping
  • Power
  • Print
  • Reg
  • Robocopy
  • Route
  • Runas
  • Sc
  • Scandisk
  • Scanreg
  • Schtasks
  • Setver
  • Sfc
  • Share
  • Shutdown
  • Smartdrv
  • Sort
  • Subst
  • Sys
  • Systeminfo
  • Taskkill
  • Tasklist
  • Telnet
  • Tracert
  • Tree
  • Tskill
  • Undelete
  • Unformat
  • Wmic
  • Xcopy

Where are the external command files stored?

Many of the external commands are located in the Windows\system32 or Winnt\system32 directories. If you need to locate the external file to delete it, rename it or replace it, you can also find the file through MS-DOS.

How do you run an external command?

As long as the file exists and you have the proper paths, an external command runs just like an internal command by typing the command name at the prompt. However, if the paths are not set properly or they are missing because the command line would not know where to look for the external command, you would get an error. Unless of course you were in the same directory as the command.

'Coz sharing is caring