{"id":2991,"date":"2025-09-07T23:24:43","date_gmt":"2025-09-07T14:24:43","guid":{"rendered":"https:\/\/blog.id774.net\/entry\/?p=2991"},"modified":"2025-10-27T00:35:31","modified_gmt":"2025-10-26T15:35:31","slug":"ntpsec-%e3%81%8c%e5%86%8d%e8%b5%b7%e5%8b%95%e5%be%8c%e3%81%ab%e8%87%aa%e5%8b%95%e8%b5%b7%e5%8b%95%e3%81%97%e3%81%aa%e3%81%84%e5%95%8f%e9%a1%8c%e3%81%ae%e8%aa%bf%e6%9f%bb%e3%81%a8%e8%a7%a3%e6%b1%ba","status":"publish","type":"post","link":"https:\/\/blog.id774.net\/entry\/2025\/09\/07\/2991\/","title":{"rendered":"NTPsec \u304c\u518d\u8d77\u52d5\u5f8c\u306b\u81ea\u52d5\u8d77\u52d5\u3057\u306a\u3044\u554f\u984c\u306e\u8abf\u67fb\u3068\u89e3\u6c7a"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\n\u8907\u6570\u306e\u74b0\u5883\u306b\u304a\u3044\u3066 NTPsec \u3092\u5c0e\u5165\u3057\u904b\u7528\u3057\u3066\u3044\u305f\u304c\u3001<strong><a href=\"https:\/\/www.conoha.jp\/vps\/\">ConoHa VPS<\/a> \u4e0a\u306e <a href=\"https:\/\/blog.id774.net\/entry\/2025\/08\/31\/2974\/\">Debian 13<\/a> \u74b0\u5883\u3067\u306e\u307f<\/strong>\u3001\u518d\u8d77\u52d5\u5f8c\u306b NTPsec \u304c\u81ea\u52d5\u8d77\u52d5\u3057\u306a\u3044\u4e8b\u8c61\u304c\u767a\u751f\u3057\u305f\u3002<br \/>\n\u5c0e\u5165\u624b\u9806\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u3092\u5b9f\u65bd\u3057\u305f\u3002\n<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">sudo systemctl enable --now ntpsec<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\n\u624b\u52d5\u3067\u8d77\u52d5\u3059\u308c\u3070\u6b63\u5e38\u306b\u7a3c\u50cd\u3057\u3001ntpq -pn \u306b\u3088\u308a\u540c\u671f\u3082\u78ba\u8a8d\u3067\u304d\u305f\u3002<br \/>\n\u3057\u304b\u3057\u30b5\u30fc\u30d0\u30fc\u3092\u518d\u8d77\u52d5\u3059\u308b\u3068 ntpsec.service \u304c <strong>inactive (dead)<\/strong> \u306e\u307e\u307e\u3068\u306a\u308a\u3001\n<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">***Socket error; probably ntpd is not running<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\n\u3068\u8868\u793a\u3055\u308c\u308b\u72b6\u614b\u306b\u9665\u3063\u305f\u3002<br \/>\n\u4ed6\u306e\u74b0\u5883\uff08\u30aa\u30f3\u30d7\u30ec\u30df\u30b9 Debian\u3001\u5225\u30af\u30e9\u30a6\u30c9\u74b0\u5883\u306a\u3069\uff09\u3067\u306f\u540c\u3058\u554f\u984c\u306f\u518d\u73fe\u305b\u305a\u3001<strong>ConoHa VPS \u306e Debian 13 \u7279\u6709\u306e\u73fe\u8c61<\/strong>\u3067\u3042\u308b\u3068\u5224\u660e\u3057\u305f\u3002\n<\/p>\n<hr>\n<h2>\u76ee\u7684<\/h2>\n<p>\n\u30b5\u30fc\u30d0\u30fc\u518d\u8d77\u52d5\u5f8c\u3082 NTPsec \u304c\u78ba\u5b9f\u306b\u81ea\u52d5\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u3001NTP \u304c\u505c\u6b62\u3057\u3066\u3044\u308b\u72b6\u614b\u3092\u653e\u7f6e\u305b\u306c\u3053\u3068\u3092\u76ee\u7684\u3068\u3057\u305f\u3002\n<\/p>\n<hr>\n<h2>\u8abf\u67fb\u904e\u7a0b<\/h2>\n<p><strong>1) \u30b5\u30fc\u30d3\u30b9\u72b6\u614b\u306e\u78ba\u8a8d<\/strong><br \/>\nsystemctl status ntpsec \u306f\u5e38\u306b inactive (dead) \u3092\u793a\u3057\u305f\u3002<br \/>\njournalctl -b | grep -i ntp \u306b\u3082 Starting ntpsec.service \u306e\u8a18\u9332\u304c\u5b58\u5728\u305b\u305a\u3001\u8d77\u52d5\u8a66\u884c\u305d\u306e\u3082\u306e\u304c\u884c\u308f\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u5224\u660e\u3057\u305f\u3002<\/p>\n<p><strong>2) \u30e6\u30cb\u30c3\u30c8\u5b9a\u7fa9\u306e\u7cbe\u67fb<\/strong><br \/>\n\/usr\/lib\/systemd\/system\/ntpsec.service \u306b\u306f ConditionCapability=CAP_SYS_TIME \u304a\u3088\u3073 Conflicts=systemd-timesyncd.service \u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u305f\u3002<br \/>\n\u3053\u306e\u6761\u4ef6\u306b\u3088\u308a\u3001\u74b0\u5883\u4f9d\u5b58\u3067 systemd \u304c\u8d77\u52d5\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3068\u63a8\u5b9a\u3055\u308c\u305f\u3002<\/p>\n<p><strong>3) \u8d77\u52d5\u65b9\u5f0f\u306e\u554f\u984c<\/strong><br \/>\nExecStart \u306f ntp-systemd-wrapper \u3092\u547c\u3073\u51fa\u3057\u3001Type=forking \u306b\u3088\u308b PIDFile \u76e3\u8996\u3092\u884c\u3063\u3066\u3044\u305f\u3002<br \/>\n\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u6e96\u5099\u3084 PIDFile \u306e\u751f\u6210\u30bf\u30a4\u30df\u30f3\u30b0\u306b\u4f9d\u5b58\u3059\u308b\u305f\u3081\u3001\u9759\u304b\u306b\u5931\u6557\u3059\u308b\u4f59\u5730\u304c\u5b58\u5728\u3057\u305f\u3002<\/p>\n<p><strong>4) \u88dc\u52a9\u30e6\u30cb\u30c3\u30c8\u306e\u5b58\u5728<\/strong><br \/>\nntpsec-systemd-netif.path \u3084 ntpsec-wait.service \u304c\u5b58\u5728\u3057\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u72b6\u614b\u306b\u3088\u308a\u8d77\u52d5\u5236\u5fa1\u3092\u884c\u3046\u69cb\u9020\u3067\u3042\u3063\u305f\u3002<br \/>\nConoHa VPS (ifupdown \u30d9\u30fc\u30b9) \u74b0\u5883\u3067\u306f\u3053\u308c\u3089\u306e\u30c8\u30ea\u30ac\u304c\u767a\u706b\u305b\u305a\u3001\u7d50\u679c\u3068\u3057\u3066\u8d77\u52d5\u304c\u6291\u6b62\u3055\u308c\u3066\u3044\u305f\u3068\u8003\u3048\u3089\u308c\u308b\u3002<\/p>\n<hr>\n<h2>\u89e3\u6c7a\u65b9\u6cd5<\/h2>\n<p>\n\u7d14\u6b63\u306e ntpsec.service \u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3092\u65ad\u5ff5\u3057\u3001\u72ec\u81ea\u306e systemd \u30e6\u30cb\u30c3\u30c8 \/etc\/systemd\/system\/myntp.service \u3092\u4f5c\u6210\u3057\u305f\u3002<br \/>\nntpd \u3092\u524d\u9762\u5e38\u99d0\uff08-n\uff09\u3067\u8d77\u52d5\u3055\u305b\u3001systemd \u304c\u76f4\u63a5\u30d7\u30ed\u30bb\u30b9\u3092\u76e3\u8996\u3059\u308b\u65b9\u5f0f\u3068\u3057\u305f\u3002\n<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">[Unit]<br \/>\nDescription=My NTPsec (foreground)<br \/>\nAfter=network.target<br \/>\nWants=network.target<br \/>\n<br \/>\n[Service]<br \/>\nType=simple<br \/>\nExecStart=\/usr\/sbin\/ntpd -n -c \/etc\/ntpsec\/ntp.conf -g -u ntpsec:ntpsec<br \/>\nRestart=always<br \/>\nRestartSec=15s<br \/>\n<br \/>\n[Install]<br \/>\nWantedBy=multi-user.target<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\n\u6b21\u306e\u624b\u9806\u3067\u72ec\u81ea\u30e6\u30cb\u30c3\u30c8\u3092\u6709\u52b9\u5316\u3059\u308b\u3002\n<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\"># \u7d1b\u3089\u308f\u3057\u3044\u7d14\u6b63\u30b5\u30fc\u30d3\u30b9\u3092\u6b62\u3081\u3066\u7121\u52b9\u5316\u3057\u3001\u7af6\u5408\u3092\u907f\u3051\u308b<br \/>\nsudo systemctl stop ntpsec<br \/>\nsudo systemctl disable ntpsec<br \/>\nsudo systemctl mask ntpsec<br \/>\n<br \/>\n# \u72ec\u81ea\u30e6\u30cb\u30c3\u30c8\u3092\u30ea\u30ed\u30fc\u30c9\u3057\u3066\u6709\u52b9\u5316<br \/>\nsudo systemctl daemon-reload<br \/>\nsudo systemctl enable --now myntp.service<br \/>\n<br \/>\n# \u72b6\u614b\u78ba\u8a8d<br \/>\nsystemctl status myntp.service<br \/>\nntpq -pn<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\n\u3053\u306e\u30e6\u30cb\u30c3\u30c8\u3092\u6709\u52b9\u5316\u3059\u308b\u3053\u3068\u3067\u3001\u518d\u8d77\u52d5\u5f8c\u3082\u78ba\u5b9f\u306b ntpd \u304c\u8d77\u52d5\u3057\u3001\u6570\u5341\u79d2\u5f85\u3066\u3070 ntpq -pn \u306b * \u30de\u30fc\u30af\u304c\u4ed8\u3044\u3066\u540c\u671f\u304c\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\n<\/p>\n<hr>\n<h2>\u6c7a\u5b9a\u3057\u305f\u904b\u7528<\/h2>\n<ul>\n<li>ConoHa VPS \u4e0a\u306e Debian 13 \u74b0\u5883\u3067\u306f myntp.service \u3092\u63a1\u7528\u3057\u3001\u7d14\u6b63\u306e ntpsec.service \u306f mask \u3057\u305f\u307e\u307e\u3068\u3059\u308b\u3002<\/li>\n<li>\u4ed6\u74b0\u5883\u3067\u306f\u7d14\u6b63\u306e ntpsec.service \u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u305d\u306e\u307e\u307e\u5229\u7528\u3092\u7d99\u7d9a\u3059\u308b\u3002<\/li>\n<li><a href=\"https:\/\/github.com\/id774\/munin-plugins\/blob\/master\/process_monitoring\">\u76e3\u8996<\/a>\u3068\u3057\u3066 ntpq -pn \u3092<a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/cron\/bin\/get_resources\">\u5b9a\u671f\u7684<\/a>\u306b<a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/get_resources.sh\">\u5b9f\u884c<\/a>\u3057\u3001\u540c\u671f\u72b6\u614b\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<li>transitional \u30d1\u30c3\u30b1\u30fc\u30b8\uff08ntpdate \u7b49\uff09\u306f\u524a\u9664\u3057\u3001\u6df7\u4e71\u3092\u907f\u3051\u308b\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\n\u672c\u4ef6\u306f <strong>ConoHa VPS \u4e0a\u306e Debian 13 \u74b0\u5883\u306b\u7279\u6709<\/strong>\u306e\u73fe\u8c61\u3067\u3042\u308a\u3001\u7d14\u6b63\u306e ntpsec.service \u304c systemd \u306e\u6761\u4ef6\u5224\u5b9a\u3084\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4f9d\u5b58\u30c8\u30ea\u30ac\u306b\u3088\u308a\u8d77\u52d5\u3092\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u3066\u3044\u305f\u3053\u3068\u304c\u539f\u56e0\u3067\u3042\u308b\u3002<br \/>\n\u4ed6\u306e\u74b0\u5883\u3067\u306f\u518d\u73fe\u305b\u305a\u3001\u74b0\u5883\u4f9d\u5b58\u306e\u5f37\u3044\u554f\u984c\u3067\u3042\u3063\u305f\u3002\n<\/p>\n<p>\n\u89e3\u6c7a\u7b56\u3068\u3057\u3066\u306f\u3001\u8907\u96d1\u306a\u30e9\u30c3\u30d1\u30fc\u3084\u6761\u4ef6\u3092\u6392\u3057\u3001ntpd \u3092\u5358\u7d14\u306b foreground \u8d77\u52d5\u3055\u305b\u308b\u72ec\u81ea\u30e6\u30cb\u30c3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3001\u5b89\u5b9a\u3057\u3066\u81ea\u52d5\u8d77\u52d5\u3092\u5b9f\u73fe\u3067\u304d\u305f\u3002\n<\/p>\n<p>\n\u3053\u306e\u4e8b\u8c61\u304b\u3089\u5f97\u3089\u308c\u308b\u6559\u8a13\u306f\u3001<strong>\u300csystemd \u30e6\u30cb\u30c3\u30c8\u304c\u8907\u96d1\u306a\u6761\u4ef6\u3084\u88dc\u52a9\u30e6\u30cb\u30c3\u30c8\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u8d77\u52d5\u304c\u6210\u7acb\u3057\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u3002\u5fc5\u8981\u6700\u5c0f\u9650\u306e\u69cb\u6210\u306b\u7acb\u3061\u623b\u308b\u3053\u3068\u304c\u5b89\u5b9a\u7a3c\u50cd\u306b\u3064\u306a\u304c\u308b\u300d<\/strong> \u3068\u3044\u3046\u70b9\u3067\u3042\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u8907\u6570\u306e\u74b0\u5883\u306b\u304a\u3044\u3066 NTPsec \u3092\u5c0e\u5165\u3057\u904b\u7528\u3057\u3066\u3044\u305f\u304c\u3001ConoHa VPS \u4e0a\u306e Debian 13 \u74b0\u5883\u3067\u306e\u307f\u3001\u518d\u8d77\u52d5\u5f8c\u306b NTPsec \u304c\u81ea\u52d5\u8d77\u52d5\u3057\u306a\u3044\u4e8b\u8c61\u304c\u767a\u751f\u3057\u305f\u3002 \u5c0e\u5165\u624b\u9806\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u3092\u5b9f\u65bd\u3057\u305f\u3002 1 &#8230; <a title=\"NTPsec \u304c\u518d\u8d77\u52d5\u5f8c\u306b\u81ea\u52d5\u8d77\u52d5\u3057\u306a\u3044\u554f\u984c\u306e\u8abf\u67fb\u3068\u89e3\u6c7a\" class=\"read-more\" href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/07\/2991\/\" aria-label=\"NTPsec \u304c\u518d\u8d77\u52d5\u5f8c\u306b\u81ea\u52d5\u8d77\u52d5\u3057\u306a\u3044\u554f\u984c\u306e\u8abf\u67fb\u3068\u89e3\u6c7a \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,14],"tags":[],"class_list":["post-2991","post","type-post","status-publish","format-standard","hentry","category-diary","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/2991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/comments?post=2991"}],"version-history":[{"count":0,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/2991\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/media?parent=2991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/categories?post=2991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/tags?post=2991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}