xntpd 명령어 (AIX 5.3·6.1)

핵심 정리

  • NTP(Network Time Protocol) 데몬으로 시스템 시각을 인터넷 표준 시간 서버에 맞춰 유지합니다. NTP 버전 3(RFC 1305)을 구현하고 버전 1·2와도 호환합니다.
  • 설정은 /etc/ntp.conf(예: server 10.1.1.123, driftfile /etc/ntp.drift)에 두고 startsrc -s xntpd로 시작, stopsrc -s xntpd로 멈춥니다.
  • 부팅 때 자동으로 시작하려면 /etc/rc.tcpip에서 xntpd 줄의 주석을 풉니다(chrctcp -S -a xntpd).
  • 시각이 1000초 넘게 어긋나 있으면 클라이언트 모드에서 오류로 끝납니다. 먼저 ntpdate 서버로 맞춘 뒤 시작합니다. -x를 주면 시각을 크게 건너뛰지 않고 조금씩(slew) 맞춥니다.
  • 동기 상태는 ntpq -p(동기 대상과 오프셋)나 lssrc -ls xntpd로 확인합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (두 버전의 내용이 같음)
원문 IBM Commands Reference — 5.3 Volume 6, 6.1 Volume 6
파일 /usr/sbin/xntpd, /etc/ntp.conf, /etc/ntp.drift, /etc/ntp.keys
관련 명령어 ntpq, xntpdc, ntpdate, startsrc, lssrc, setclock

목적

NTP(Network Time Protocol) 데몬을 시작합니다.

영어 원문

Starts the Network Time Protocol (NTP) daemon.

구문

text
xntpd [ -a ] [ -b ] [ -d ] [ -D Level ] [ -m ] [ -x ] [ -c ConfigFile ] [ -e AuthenticationDelay ]
      [ -f DriftFile ] [ -k KeyFile ] [ -l LogFile ] [ -o TraceFile ] [ -p pidFile ] [ -r BroadcastDelay ]
      [ -s StatsDirectory ] [ -t TrustedKey ] [ -v SystemVariable ] [ -V SystemVariable ]

설명

xntpd 데몬은 인터넷 표준 시간 서버에 맞춰 UNIX 시스템의 시각을 정하고 유지합니다. RFC 1305에 정의된 NTP 버전 3 표준을 완전히 구현하며, RFC 1059와 RFC 1119의 버전 1·2 서버와도 호환합니다. 모든 계산을 고정 소수점으로 하며 부동 소수점 코드가 필요 없습니다.

시작할 때 구성 파일(기본 /etc/ntp.conf)을 읽습니다. 파일 이름은 명령줄에서 바꿀 수 있습니다. 제한적이지만 구성을 모두 명령줄에서 줘서 구성 파일 없이 동작하게 할 수도 있으며, 실행 중에 브로드캐스트를 들어 상대를 모두 알아내는 브로드캐스트·멀티캐스트 클라이언트로 구성할 때 이 방법을 씁니다. 데몬의 내부 변수는 ntpq(NTP 질의 프로그램)로 보고, 구성 옵션은 xntpdc로 바꿉니다.

xntpd는 대칭 능동·수동, 클라이언트·서버, 브로드캐스트·멀티캐스트 등 여러 모드로 동작합니다. 브로드캐스트·멀티캐스트 클라이언트는 원격 서버를 자동으로 찾고, 단방향 지연 보정 값을 계산해 스스로 구성합니다. 그래서 구성 파일이나 환경별 구성 없이 여러 워크스테이션을 한꺼번에 배치할 수 있습니다.

참고: 클라이언트 모드에서 구성한 서버 가운데 로컬 시각과 1000초 이내인 것이 없으면 오류로 끝납니다. 시각이 크게 어긋난 시스템은 xntpd를 시작하기 전에 date나 ntpdate로 맞춥니다.

영어 원문

The xntpd daemon sets and maintains a UNIX system time-of-day in compliance with Internet standard time servers. The xntpd daemon is a complete implementation of the Network Time Protocol (NTP) version 3 standard, as defined by RFC 1305, and also retains compatibility with version 1 and 2 servers as defined by RFC 1059 and RFC 1119, respectively. The xntpd daemon does all computations in fixed point arithmetic and does not require floating point code.

The xntpd daemon reads from a configuration file (/etc/ntp.conf is the default) at startup time. You can override the configuration file name from the command line. You can also specify a working, although limited, configuration entirely on the command line, eliminating the need for a configuration file. Use this method when configuring the xntpd daemon as a broadcast or multicast client, that determines all peers by listening to broadcasts at runtime. You can display the xntpd daemon internal variables with the ntpq command (Network Time Protocol (NTP) query program). You can alter configuration options with the xntpdc command.

The xntpd daemon operates in several modes, including symmetric active/passive, client/server and broadcast/multicast. A broadcast/multicast client can automatically discover remote servers, compute one-way delay correction factors and configure itself automatically. This mode makes it possible to deploy a group of workstations without specifying a configuration file or configuration details specific to its environment.

Note: When operating in a client mode, the xntpd daemon will exit with an error if no configured servers are within 1000 seconds of local system time. Use the date or ntpdate command to set the time of a bad skewed system before starting xntpd.

플래그

플래그 설명
-a 인증 모드로 실행합니다.
-b 브로드캐스트 NTP를 듣고, 있으면 그것에 동기화합니다.
-c ConfigFile 다른 구성 파일 이름.
-d 디버깅 모드. 최대 10번까지 여러 번 줄 수 있고, 많이 줄수록 자세히 보여 줍니다.
-D Level 디버깅 수준을 직접 정합니다(1~10).
-e AuthenticationDelay 이 컴퓨터에서 NTP 암호화 필드를 계산하는 데 걸리는 시간(초).
-f DriftFile 드리프트 파일 위치.
-k KeyFile NTP 인증 키 파일 위치.
-l LogFile syslog 대신 쓸 로그 파일(소문자 L).
-m 멀티캐스트 메시지를 듣고, 있으면 동기화합니다. 멀티캐스트 주소는 224.0.1.1로 봅니다.
-o TraceFile 추적 파일 이름(기본 표준 오류).
-p pidFile 데몬의 프로세스 ID를 기록할 파일. 기본값은 없습니다.
-r BroadcastDelay 보정 절차가 실패할 때 쓸 기본 지연(초). 보통은 브로드캐스트·멀티캐스트 서버와 클라이언트 사이의 네트워크 지연을 자동으로 보정합니다.
-s StatsDirectory 통계 파일을 만들 디렉터리.
-t TrustedKey 그 키 번호를 신뢰 키 목록에 더합니다.
-v SystemVariable 지정한 시스템 변수를 더합니다.
-V SystemVariable 지정한 시스템 변수를 기본 목록에 나오게 더합니다.
-x 시각을 조금씩 조정합니다(slewing).
영어 원문
  • -a — Runs in authenticate mode
  • -b — Listens for broadcast NTP and synchronizes to them if available.
  • -c ConfigFile — Specifies the name of an alternate configuration file.
  • -d — Specifies debugging mode. This flag may occur multiple times (maximum of 10), with each occurrence indicating greater detail of display.
  • -D Level — Specifies debugging level directly (value from 1 to 10).
  • -e AuthenticationDelay — Specifies the time, in seconds, it takes to compute the NTP encryption field on this computer.
  • -f DriftFile — Specifies the location of the drift file.
  • -k KeyFile — Specifies the location of the file which contains the NTP authentication keys.
  • -l LogFile — (lowercase L) Specifies the use of a log file instead of logging to syslog.
  • -m — Listens for multicast messages and synchronizes to them if available. Assumes multicast address 224.0.1.1.
  • -o TraceFile — Specifies trace file name (default is stderr).
  • -p pidFile — Specifies the name of the file to record the daemon's process id. There is no default.
  • -r BroadcastDelay — Specifies the default delay (in seconds) if the calibration procedure fails. Normally, the xntpd daemon automatically compensates for the network delay between the broadcast/multicast server and the client.
  • -s StatsDirectory — Specifies the directory to use for creating statistics files.
  • -t TrustedKey — Adds the specified key number to the trusted key list.
  • -v SystemVariable — Adds the specified system variable
  • -V SystemVariable — Adds the specified system variable listed by default.
  • -x — Makes small time adjustments. (SLEWING)

Reference Clock Support

구성할 때 xntpd는 참조 시계를 되도록 보통의 NTP 상대처럼 다룹니다. 참조 시계도 주소로 가리키지만 보통 상대와 구분하려고 올바르지 않은 IP 주소를 씁니다. AIX는 시스템 시계를 바탕으로 한 참조 시계 한 종류(유형 1)를 지원합니다.

참조 시계 주소는 127.127.Type.Unit 형식이며, Type은 시계 유형 번호, Unit은 유형별 단위 번호입니다. 구성 파일에서 HostAddress를 시계 주소로 한 server 문으로 구성하며, key, version, ttl 옵션은 쓰지 않습니다.

참조 시계를 특별하게 구성하는 fudge 명령이 있습니다.

text
fudge 127.127.Type.Unit [ time1 Seconds ] [ time2 Seconds ] [ stratum Integer ] [ refid Integer ]
      [ flag1 0|1 ] [ flag2 0|1 ] [ flag3 0|1 ] [ flag4 0|1 ]
옵션 설명
time1, time2 고정 소수점 초. 일부 시계 드라이버에서 보정 상수로 씁니다.
stratum 0~15. 시계에 표준이 아닌 동작 계층(stratum)을 줍니다. xntpd는 상대마다 계층에 1을 더하므로 주 서버는 보통 계층 1로 보입니다. 미리 설계한 백업을 두려면 참조 시계의 계층을 0보다 크게 줍니다.
refid 1~4자의 ASCII 문자열. 시계에 표준이 아닌 참조 식별자를 줍니다.
flag1~flag4 시계 드라이버를 맞춤 설정하는 이진 플래그. 해석과 사용 여부는 드라이버마다 다릅니다.

예를 들어 다른 NTP 서버에 닿지 못할 때 자기 시계를 쓰게 하려면 /etc/ntp.conf에 다음처럼 둡니다.

text
server 127.127.1.0
fudge  127.127.1.0 stratum 10
영어 원문

For the purposes of configuration, the xntpd daemon treats reference clocks in a manner analogous to normal NTP peers as much as possible. It refers to reference clocks by address, same as a normal peer is, though it uses an invalid IP address to distinguish them from normal peers. AIX supports one type of reference clock, based on the system clock (type 1).

Reference clock addresses are of the form 127.127.Type.Unit where Type is an integer denoting the clock type and Unit indicates the type-specific unit number. You configure reference clocks by using a server statement in the configuration file where the HostAddress is the clock address. The key, version and ttl options are not used for reference clock support.

Reference clock support provides the fudge command, which configures reference clocks in special ways. This command has the following format:

fudge 127.127.Type.Unit [ time1 Seconds ] [ time2 Seconds ] [ stratum Integer ] [ refid Integer ] [ flag1 0 | 1 ] [ flag2 0 | 1 ] [ flag3 0 | 1 ] [ flag4 0 | 1 ]

The time1 and time2 options are in fixed point seconds and used in some clock drivers as calibration constants.

The stratum option is a number in the range zero to 15 and used to assign a nonstandard operating stratum to the clock. Since the xntpd daemon adds one to the stratum of each peer, a primary server ordinarily displays stratum one. In order to provide engineered backups, use the stratum option to specify the reference clock stratum as greater than zero. Except where noted, this option applies to all clock drivers.

The refid option is an ASCII string in the range one to four characters and used to assign a nonstandard reference identifier to the clock.

The binary flags: flag1, flag2, flag3 and flag4 are for customizing the clock driver. The interpretation of these values, and whether they are used at all, is a function of the needs of the particular clock driver.

종료 상태

값 뜻
0 성공
0보다 큼 오류
영어 원문

This command returns the following exit values:

  • 0 — Successful completion.
  • >0 — An error occurred.

보안

접근 제어: root 권한이 있어야 실행할 수 있습니다.

감사 이벤트: 해당 없음.

영어 원문

Access Control: You must have root authority to run this command.

Auditing Events: N/A

예제

명령 하는 일
startsrc -s xntpd xntpd를 시작
stopsrc -s xntpd xntpd를 멈춤
/usr/sbin/xntpd -k /etc/ntp.new.keys 인증 키 파일 /etc/ntp.new.keys를 써서 실행

자주 쓰는 형태:

bash
cat /etc/ntp.conf              # server 10.1.1.123 / driftfile /etc/ntp.drift / tracefile /etc/ntp.trace
ntpdate 10.1.1.123             # 시작 전에 크게 어긋난 시각 맞추기
startsrc -s xntpd -a "-x"      # 조금씩 맞추는 모드로 시작
chrctcp -S -a xntpd            # 부팅 때 자동 시작(/etc/rc.tcpip)
ntpq -p                        # 동기 대상(*표시)과 오프셋
lssrc -ls xntpd | grep -i "sys peer"
영어 원문
  1. To start the xntpd daemon, enter:
startsrc -s xntpd
  1. To stop the xntpd daemon, enter:
stopsrc -s xntpd
  1. To use the authentication key file /etc/ntp.new.keys when running the xntpd daemon, enter:
/usr/sbin/xntpd -k /etc/ntp.new.keys

파일

파일 설명
/usr/sbin/xntpd xntpd 데몬
/etc/ntp.conf 기본 구성 파일
/etc/ntp.drift 기본 드리프트 파일
/etc/ntp.keys 기본 키 파일
영어 원문
  • /usr/sbin/xntpd — Contains the xntpd daemon.
  • /etc/ntp.conf — Contains the default configuration file.
  • /etc/ntp.drift — Contains the default drift file.
  • /etc/ntp.keys — Contains the default key file.

Related reference:

  • “xntpdc Command”

Related information:

  • ntpq command

리눅스(GNU)와 다른 점

리눅스에서는 ntpd(ntp 패키지)나 요즘 기본인 chronyd(/etc/chrony.conf, chronyc sources, chronyc tracking), 또는 systemd-timesyncd(timedatectl)를 씁니다. ntpq -p는 chronyc sources -v, 크게 어긋난 시각을 바로 맞추는 ntpdate는 chronyd -q나 chronyc makestep에 해당합니다. 자기 시계를 참조로 쓰는 127.127.1.0 대신 chrony는 local stratum 10을 씁니다.