{"id":188,"date":"2021-11-17T17:30:07","date_gmt":"2021-11-17T08:30:07","guid":{"rendered":"https:\/\/blog.chatagiriii.com\/?p=188"},"modified":"2025-12-10T17:16:55","modified_gmt":"2025-12-10T08:16:55","slug":"google-domains%e3%81%a7ddns%e3%81%97%e3%81%a6%e6%9b%b4%e6%96%b0%e6%99%82%e3%81%abslack%e3%81%ab%e9%80%9a%e7%9f%a5%e3%81%99%e3%82%8b%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88","status":"publish","type":"post","link":"https:\/\/blog.chatagiriii.com\/?p=188","title":{"rendered":"Google Domains\u3067DDNS\u3057\u3066\u66f4\u65b0\u6642\u306bSlack\u306b\u901a\u77e5\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8"},"content":{"rendered":"\n<p><strong>\u8ffd\u8a18: 2023\u5e746\u6708\u306bGoogle Domains\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u306e\u3067\u672c\u8a18\u4e8b\u306fit doesnt works\u3067\u3059<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3053\u306e\u8a18\u4e8b\u30923\u884c\u3067<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Google Domains\u306bDDNS\u3092\u8a2d\u5b9a\u3057\u3066\u3001IP\u5909\u66f4\u901a\u77e5\u304c\u8d77\u304d\u305f\u3089Slack\u306b\u901a\u77e5\u3057\u305f\u3044<\/li>\n\n\n\n<li>\u65e2\u5b58DDNS\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u3092\u4f7f\u3046\u3068\u51e6\u7406\u7d44\u307f\u3053\u3080\u306e\u304c\u96e3\u3057\u3044\u306e\u3067\u3001ShellScript + cron \u3067\u5b9a\u671f\u51e6\u7406\u3057\u3066\u66f4\u65b0\u51e6\u7406\u3068\u901a\u77e5\u51e6\u7406\u3092\u6df7\u305c\u8fbc\u3093\u3060<\/li>\n\n\n\n<li>\u6210\u679c\u7269: <a href=\"https:\/\/gitlab.chatagiriii.com\/open\/google-domains-ddns\/-\/tree\/main\" data-type=\"URL\" data-id=\"https:\/\/gitlab.chatagiriii.com\/open\/google-domains-ddns\/-\/tree\/main\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/gitlab.chatagiriii.com\/open\/google-domains-ddns\/-\/tree\/main<\/a> <\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Google Domains\u3044\u3044\u3067\u3059\u3088<\/h2>\n\n\n\n<p>chatagiri\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/blog.chatagiriii.com\/?p=11\" data-type=\"URL\" data-id=\"https:\/\/blog.chatagiriii.com\/?p=11\">\u304a\u540d\u524d\u30c9\u30c3\u30c8\u30b3\u30e0\u306eddns client script\u306e\u8a18\u4e8b<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3055\u308c\u308b\u65b9\u3084\u305f\u3089\u591a\u3044\u3088\u3046\u306a\u306e\u3067\u3001google domains\u7248\u306e\u8a18\u4e8b\u3082\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u30d6\u30ed\u30b0\u3082\u914d\u4e0b\u306b\u3042\u308bchatagiriii.com\u306e\u30c9\u30e1\u30a4\u30f3\u306f\u67d0\u540d\u524d\u30c9\u30c3\u30c8\u30b3\u30e0\u3067\u53d6\u5f97\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3067\u3059\u304c\u3001\u67d0\u540d\u524d\u30b3\u30e0\u306e\u7ba1\u7406UI\u306f\u3042\u307e\u308a\u3088\u3044\u3068\u306f\u601d\u3048\u305a\u3001\u30ed\u30b0\u30a4\u30f3\u306b\u3084\u305f\u3089\u6642\u9593\u639b\u304b\u3063\u305f\u308a\u3001\u753b\u9762\u9077\u79fb\u306b\u3084\u305f\u3089\u6642\u9593\u639b\u304b\u3063\u305f\u308a\u3001\u6319\u53e5\u306e\u679c\u3066\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u5fc5\u305a\u30c9\u30e1\u30a4\u30f3\u66f4\u65b0\u30da\u30fc\u30b8\u306b\u98db\u3070\u3055\u308c\u305f\u308a\u3068\u3001\u30a6\u30a6\u30fc\u30f3\u3068\u306a\u308b\u90e8\u5206\u304c\u591a\u3044\u3082\u306e\u3067\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u30c9\u30e1\u30a4\u30f3\u306f\u30ec\u30b8\u30b9\u30c8\u30e9\u9593\u3067\u306e\u79fb\u7ba1\u304c\u53ef\u80fd\u3067\u3059\u304b\u3089\u3001chatagiriii.com\u3082Google Domains\u306b\u79fb\u7ba1\u3057\u3066\u3001\u3081\u3067\u305f\u304f1\u5e74\u307b\u3069\u7d4c\u904e\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u30b5\u30a4\u30c8\u306f\u8efd\u3044\u3001\u5909\u306a\u5e83\u544a\u898b\u305b\u3089\u308c\u308b\u4e8b\u3082\u306a\u3044\u3001\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6\u3082\u3057\u3084\u3059\u3044\u3068\u3042\u3063\u3066\u3001\u304b\u306a\u308a\u5feb\u9069\u306b\u5229\u7528\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DDNS\u3068\u3044\u3046\u4ed5\u7d44\u307f<\/h2>\n\n\n\n<p>Google Domains\u306b\u306f\u3001\u81ea\u52d5\u3067\u7279\u5b9aDNS\u30ec\u30b3\u30fc\u30c9\u66f8\u304d\u63db\u3048\u3066\u304f\u308c\u308bDDNS\u3068\u3044\u3046\u4ed5\u7d44\u307f\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7c21\u5358\u306b\u8a00\u3048\u3070\u3001\u5404\u7a2e\u30b5\u30fc\u30d0\u306b\u4ed8\u3044\u3066\u3044\u308b\u5916\u898b\u3048\u306eIP\u30a2\u30c9\u30ec\u30b9\u3068\u3001DNS\u30ec\u30b3\u30fc\u30c9\u306b\u66f8\u3044\u3066\u3042\u308bIP\u30a2\u30c9\u30ec\u30b9\u3092\u6bd4\u8f03\u3057\u3066\u3001\u5dee\u5206\u304c\u3042\u308c\u3070\u81ea\u52d5\u3067DNS\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3059\u308b\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/e-words.jp\/w\/DDNS.html#:~:text=DDNS%E3%81%A7%E3%81%AF%E5%B0%82%E7%94%A8%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%A4%E3%82%A2%E3%83%B3%E3%83%88,IP%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9%E3%82%92%E6%9B%B4%E6%96%B0%E3%81%99%E3%82%8B%E3%80%82&amp;text=%E3%81%93%E3%82%8C%E3%81%AF%E4%BA%8B%E6%A5%AD%E8%80%85%E5%81%B4,%E3%82%92%E5%8B%95%E7%9A%84%E3%81%AB%E7%B5%90%E3%81%B3%E3%81%A4%E3%81%91%E3%82%8B%E3%80%82\" data-type=\"URL\" data-id=\"https:\/\/e-words.jp\/w\/DDNS.html#:~:text=DDNS%E3%81%A7%E3%81%AF%E5%B0%82%E7%94%A8%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%A4%E3%82%A2%E3%83%B3%E3%83%88,IP%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9%E3%82%92%E6%9B%B4%E6%96%B0%E3%81%99%E3%82%8B%E3%80%82&amp;text=%E3%81%93%E3%82%8C%E3%81%AF%E4%BA%8B%E6%A5%AD%E8%80%85%E5%81%B4,%E3%82%92%E5%8B%95%E7%9A%84%E3%81%AB%E7%B5%90%E3%81%B3%E3%81%A4%E3%81%91%E3%82%8B%E3%80%82\" target=\"_blank\">\u8abf\u3079\u308c\u3070\u6ca2\u5c71\u3067\u308b\u306e\u3067<\/a>\u3001\u8a73\u7d30\u306f\u8272\u3005\u8abf\u3079\u3066\u307f\u3066\u8cb0\u3048\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Google Domains\u3067DDNS\u3059\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>Google Domains\u306bDDNS\u901a\u77e5\u3059\u308b\u306b\u306f<a href=\"https:\/\/support.google.com\/domains\/answer\/6147083?hl=ja\" data-type=\"URL\" data-id=\"https:\/\/support.google.com\/domains\/answer\/6147083?hl=ja\" target=\"_blank\" rel=\"noreferrer noopener\">\u4e3b\u306b\u4e0b\u8a182\u901a\u308a\u306e\u65b9\u6cd5<\/a>\u304c\u3042\u308a\u307e\u3059\u3002<br>  1. DDNS\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8a2d\u5b9a\u3059\u308b(\u4f8b: DDclient, INADYN) <br>  2. GoogleDomains\u63d0\u4f9b\u306eAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306bHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6295\u3052\u308b<\/p>\n\n\n\n<p>1.\u306eDDNS\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u306f\u975e\u5e38\u306b\u304a\u624b\u8efd\u3067\u3001pkg\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3042\u3052\u3066\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7f6e\u304f\u3053\u3068\u3067\u7c21\u5358\u306bDDNSready\u306a\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u306e2.\u306fcURL\u3084HTTPie\u7b49\u306eHTTP\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b3\u30de\u30f3\u30c9\u304b\u3089\u6295\u3052\u3066\u3042\u3052\u308b\u306e\u304c\u4e00\u822c\u7684\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u3001Python, Ruby\u306eHTTP\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u4f7f\u3063\u3066\u3082\u540c\u3058\u4e8b\u304c\u53ef\u80fd\u3067\u3042\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DDNS\u306e\u4ed5\u7d44\u307f\u4f5c\u3063\u3068\u3044\u3066\u3088\u304b\u3063\u305f\u4f8b<\/h2>\n\n\n\n<p>DDNS\u306e\u4ed5\u7d44\u307f\u304c\u5f79\u306b\u7acb\u3063\u305f\u4f8b\u3067\u8a00\u3046\u3068\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>chatagiri\u304c\u5b9f\u5bb6\u306b\u5e30\u7701\u3057\u3066\u308b\u6700\u4e2d\u306b\u3001\u81ea\u5b85\u30b5\u30fc\u30d0\u3092\u7e4b\u3044\u3067\u3044\u308b\u30eb\u30fc\u30bf\u304c\u518d\u8d77\u52d5\u3002<\/li>\n\n\n\n<li>\u3059\u308b\u3068\u30d7\u30ed\u30d0\u30a4\u30c0\u304b\u3089\u5272\u308a\u5f53\u3066\u3089\u308c\u305fIPv4 Global IP\u304c\u5909\u308f\u3063\u3066\u3001\u81ea\u5b85\u9bd6\u306bLAN\u5916\u304b\u3089\u30a2\u30af\u30bb\u30b9\u51fa\u6765\u306a\u304f\u306a\u3063\u305f\u3002<\/li>\n\n\n\n<li>DDNS\u3067chatagiriii.com\u306eA\u30ec\u30b3\u30fc\u30c9\u81ea\u52d5\u66f4\u65b0\u306e\u4ed5\u7d44\u307f\u4f5c\u3063\u3066\u304a\u3044\u305f\u306e\u3067\u300130\u5206\u5f8c\u3050\u3089\u3044\u306b\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u78ba\u4fdd\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3057\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u611f\u8b1d\u3001\u4ed5\u8fbc\u3093\u3067\u304a\u3044\u305f\u904e\u53bb\u306e\u81ea\u5206\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DDNS\u767a\u706b\u3057\u305f\u66f4\u65b0\u6642\u306bSlack\u306b\u901a\u77e5\u3057\u305f\u3044\u3093\u3067\u3059..<\/h2>\n\n\n\n<p>\u3044\u304f\u3089DDNS\u306e\u4ed5\u7d44\u307f\u3092\u6574\u3048\u305f\u3068\u306f\u8a00\u3048\u3001IP\u304c\u5909\u308f\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u306f\u3042\u308b\u7a0b\u5ea6\u628a\u63e1\u3057\u3066\u304a\u304d\u305f\u3044\u3082\u306e\u3002<\/p>\n\n\n\n<p>slack\u306bIP\u5909\u308f\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u901a\u77e5\u3057\u3066\u3042\u3052\u3066\u3001\u3064\u3044\u3067\u30b5\u30fc\u30d0\u6a5f\u306e\u5916\u898b\u3048IP\u30a2\u30c9\u30ec\u30b9\u3082\u4e00\u7dd2\u306b\u6295\u3052\u3066\u3042\u3052\u308c\u3070\u6700\u60aaIP\u30a2\u30c9\u30ec\u30b9\u3067SSH\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u8a2d\u5b9a\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u3001\u524d\u9805, 1.\u306eDDNS\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u4f7f\u3046\u65b9\u6cd5\u3067\u306f\u8a00\u3046\u306a\u308c\u3070\u81ea\u7531\u306b\u51e6\u7406\u7d44\u307f\u8fbc\u3093\u3067\u3042\u3052\u308b\u3053\u3068\u304c\u96e3\u3057\u304f\u3001\u300c\u51e6\u7406\u5f8c\u306bSlack\u306b\u901a\u77e5\u3059\u308b\u300d\u3053\u3068\u3092\u8ffd\u52a0\u5b9f\u88c5\u3059\u308b\u306e\u306f\u4eca\u306e\u81ea\u5206\u306b\u306f\u53b3\u3057\u3044\u306a\u3041\u3068\u3044\u3046\u304a\u304d\u3082\u3061\u3002<\/p>\n\n\n\n<p>\u306e\u3067\u30012.\u306eHTTP\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b3\u30de\u30f3\u30c9\u304b\u3089Google Domains\u306eAPI\u3092\u53e9\u3044\u3066\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3057\u3066\u3001\u51e6\u7406\u5f8c\u306b\u5225\u9014Slack\u306eWebhook\u5b9b\u306b\u901a\u77e5\u3057\u3066\u3042\u3052\u308bshellscript\u306a\u4ed5\u7d44\u307f\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6e96\u5099: DDNS\u30a2\u30ab\u30a6\u30f3\u30c8, Slack Webhook\u6e96\u5099<\/h2>\n\n\n\n<p>\u4eca\u56de\u4f5c\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u5fc5\u8981\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Google Domains\u306e DDNS\u7528\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/support.google.com\/domains\/answer\/6147083?hl=ja\" data-type=\"URL\" data-id=\"https:\/\/support.google.com\/domains\/answer\/6147083?hl=ja\">https:\/\/support.google.com\/domains\/answer\/6147083?hl=ja<\/a><\/li>\n\n\n\n<li>\u300c\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u7528\u306b\u4f5c\u6210\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8868\u793a\u3059\u308b\u306b\u306f\u3001[\u8a8d\u8a3c\u60c5\u5831\u3092\u8868\u793a] \u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\u300d\u306e\u3042\u305f\u308a<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Slack \u30c1\u30e3\u30f3\u30cd\u30eb\u901a\u77e5\u7528\u306eWebhook URL(\u3068\u5927\u5143\u306eslack)\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/qiita.com\/vmmhypervisor\/items\/18c99624a84df8b31008\" data-type=\"URL\" data-id=\"https:\/\/qiita.com\/vmmhypervisor\/items\/18c99624a84df8b31008\">https:\/\/qiita.com\/vmmhypervisor\/items\/18c99624a84df8b31008<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u5916\u90e8\u30b5\u30a4\u30c8\u306b\u305d\u308c\u305e\u308c\u53d6\u5f97\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u9802\u3044\u3066\u3044\u308b\u5148\u4eba\u306e\u65b9\u304c\u3044\u3089\u3063\u3057\u3083\u308b\u306e\u3067\u3001\u304a\u624b\u6570\u3067\u3059\u304c\u305d\u3061\u3089\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u88c5: DDNS\u66f4\u65b0 -&gt;Slack\u901a\u77e5 <\/h2>\n\n\n\n<p>\u524d\u6e96\u5099\u3068\u5b9f\u884c\u4f8b\u3001\u30b3\u30fc\u30c9\u306f\u3053\u3093\u306a\u611f\u3058\u3067<\/p>\n\n\n\n<p><strong>0.\u524d\u6e96\u5099\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6301\u3063\u3066\u6765\u308b<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/gitlab.chatagiriii.com\/open\/google-domains-ddns\" data-type=\"URL\" data-id=\"https:\/\/gitlab.chatagiriii.com\/open\/google-domains-ddns\" target=\"_blank\" rel=\"noreferrer noopener\">\u3053\u3061\u3089\u306egit<\/a>\u306b\u7f6e\u3044\u3066\u3042\u308a\u307e\u3059<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git clone {URL}.git<\/code><\/pre>\n\n\n\n<p><strong>1.ddns.conf\u30d5\u30a1\u30a4\u30eb\u3092\u5f04\u308b\u3002<br><\/strong>  \u65e5\u672c\u8a9e\u306a\u90e8\u5206\u3092\u5168\u90e8\u6d88\u3057\u3066\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># ddns.conf\nTARGET_DOMAIN=\"\u3053\u3053\u306b\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u5165\u308c\u3066\u304f\u3060\u3055\u3044\"\nSLACK_PAYLOAD_URL=\"\u3053\u3053\u306bslack\u901a\u77e5\u7528WebhookURL\u3092\u5165\u308c\u3066\u304f\u3060\u3055\u3044\"\nGD_USERNAME=\"\u3053\u3053\u306bGoogleDomainDDNS\u306e\u30e6\u30fc\u30b6\u540d\u3092\u5165\u308c\u3066\u304f\u3060\u3055\u3044\"\nGD_PASSWORD=\"\u3053\u3053\u306bGoogleDomainDDNS\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u308c\u3066\u304f\u3060\u3055\u3044\"<\/code><\/pre>\n\n\n\n<p><strong>2.\u30b9\u30af\u30ea\u30d7\u30c8\u5b9f\u884c<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ update_google_ddns.sh\n\/\/ slack\u306b\u901a\u77e5\u304c\u98db\u3093\u3067\u3044\u308b\u3053\u3068\n\/\/ dig \u3057\u305f\u7d50\u679c\u304c\u65b0IP\u3092\u5411\u3044\u3066\u3044\u308b\u3053\u3068<\/code><\/pre>\n\n\n\n<p><strong>3. \u554f\u984c\u306a\u3051\u308c\u3070cron\u8a2d\u5b9a\u3092\u8ffd\u52a0(\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u7f6e\u304d\u5148\u30d1\u30b9\u306f\u5404\u3005\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># vim \/etc\/cron.d\/update_google_ddns\n\nSHELL=\/bin\/bash\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin\n*\/5 * * * * root bash -c '\/etc\/tools\/update_google_ddns.sh'\n\/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30d1\u30b9\u306f\u5404\u3005\u304c\u9069\u5207\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u2191 <\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u30b3\u30fc\u30c9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">#!\/bin\/bash\nDOMAIN=test.example.com\n\n# \u5909\u6570\u8aad\u307f\u8fbc\u307f\nsource $(cd $(dirname $0); pwd)\/ddns.conf\n\nIP_TMP_FILE=\"\/var\/tmp\/.${TARGET_DOMAIN}_recent_ip\"\n\nfunction check_ipaddr(){\n  touch \"${IP_TMP_FILE}\"\n  MYIP=$(curl -s4G ip-addr.net)\n  OLDIP=$(cat ${IP_TMP_FILE})\n  if [[ ${MYIP} == ${OLDIP} &amp;&amp; ${MYIP} != \"\" ]]; then\n      return 0\n    else\n      return 1\n  fi\n}\n\nfunction update_ddns() {\n  # IP\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u691c\u77e5\u3092slack\u306b\u901a\u77e5\n  curl -XPOST -s --data-urlencode \"payload={\\\"text\\\":\\\"Differed IP address found in $DOMAIN OLD: ${OLDIP} NOW: ${MYIP} \\\"}\" \"${SLACK_PAYLOAD_URL}\"\n\n  # Google Domains API\u306b\u5bfe\u3057\u3066\u30ec\u30b3\u30fc\u30c9\u66f4\u65b0\u30ea\u30af\u30a8\u30b9\u30c8\n  local GD_RES=$(curl -s -H \"Content-Type: application\/json\" -H \"Content-Length: 0\" -H \"User-Agent: $DOMAIN\" --user \"${GD_USERNAME}:${GD_PASSWORD}\" -XPOST \"https:\/\/domains.google.com\/nic\/update?hostname=$DOMAIN&amp;myip=${MYIP}\")\n  # \u53cd\u6620\u5f85\u3061 \n  sleep 5;\n\n  # \u30ec\u30b3\u30fc\u30c9\u66f4\u65b0\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u5b9f\u884c\u7d50\u679c\u3068dig\u3063\u305f\u7d50\u679c\u3092slack\u306b\u901a\u77e5\n  curl -XPOST -s  --data-urlencode \"payload={\\\"text\\\":\\\"Google Responce: ${GD_RES}, dig result: $(dig +short @8.8.8.8 ${TARGET_DOMAIN}) \\\"}\" \"${SLACK_PAYLOAD_URL}\"\n \n  # IP\u5dee\u5206\u78ba\u8a8d\u7528\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\n  echo \"${MYIP}\" &gt; \"${IP_TMP_FILE}\"\n}\n\nfunction main(){\n \n    # check_ipaddr\u3067ip\u30a2\u30c9\u30ec\u30b9\u5dee\u5206\u304c\u5224\u660e\u3057\u305f\u5834\u5408,update_ddns\n    check_ipaddr || {\n      update_ddns\n    }\n}\n\nmain\n\n<\/code><\/pre>\n\n\n\n<p>\u7279\u306b\u96e3\u3057\u3044\u51e6\u7406\u306f\u3057\u3066\u3044\u307e\u305b\u3093\u3057\u52d5\u3051\u3070\u826f\u3044\u3068\u601d\u3063\u3066\u66f8\u3044\u3066\u3044\u308b\u7a81\u8cab\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<s>\u8ab0\u304b\u7dba\u9e97\u306b\u66f8\u304d\u76f4\u3057\u3066\u304f\u3060\u3055\u3044<\/s><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u4f5c\u3059\u308b\u30b5\u30fc\u30d0\u306e\u5916\u306b\u51fa\u308b\u3001\u5b9f\u884c\u6642\u73fe\u5728\u306eIPv4\u30a2\u30c9\u30ec\u30b9\u3092public\u306a\u30b5\u30fc\u30d3\u30b9(ip-addr.net)\u3067\u53d6\u5f97\u3057\u3066\u4fdd\u6301\u3002<\/li>\n\n\n\n<li>\u4fdd\u6301\u3057\u3066\u305f\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u3044\u3066\u3042\u308b\u3001\u904e\u53bb\u306eIP\u30a2\u30c9\u30ec\u30b9\u3068\u5b9f\u884c\u6642\u73fe\u5728\u306eIP\u30a2\u30c9\u30ec\u30b9\u306b\u5dee\u5206\u304c\u3042\u308c\u3070main\u5b9f\u884c\u3002\n<ul class=\"wp-block-list\">\n<li>Google Domains\u306eAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306b\u6bce\u5ea6\u6bce\u5ea6\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6295\u3052\u308b\u3068RateLimit\u306b\u5f15\u3063\u639b\u304b\u3063\u3066\u3044\u3056\u3068\u3044\u3046\u6642\u306b\u66f4\u65b0\u3067\u304d\u306a\u3044\u8a71\u3092\u805e\u3044\u305f\u306e\u3067\u3053\u3046\u3044\u3046\u611f\u3058\u306b\u3057\u3066\u3044\u307e\u3059<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5b9f\u884c\u7d50\u679c\u3092slack\u306b\u901a\u77e5<\/li>\n\n\n\n<li>\u5168\u51e6\u7406\u5b8c\u4e86\u5f8c\u3001\u65b0\u65e7IP\u30a2\u30c9\u30ec\u30b9\u5dee\u5206\u78ba\u8a8d\u7528\u30d5\u30a1\u30a4\u30eb\u3092\u66f4\u65b0<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u3053\u308c\u3067\u30eb\u30fc\u30bf\u518d\u8d77\u52d5\u3057\u3066\u3082\u6016\u304f\u306a\u3044\u305e\u30a9<\/h2>\n\n\n\n<p>\u3053\u308c\u3067cron\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u305f\u305f\u3044\u3066\u304f\u308c\u308b\u306e\u3067\u3001Google Domain\u306eDNS\u30ec\u30b3\u30fc\u30c9\u3068\u3001\u30b5\u30fc\u30d0\u6a5f\u306e\u4eca\u73fe\u5728\u306e\u5916\u898b\u3048IP\u30a2\u30c9\u30ec\u30b9\u306b\u5dee\u5206\u304c\u3042\u308c\u3070DNS\u30ec\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u66f4\u65b0\u3057\u3066\u3001\u304b\u3064slack\u306b\u901a\u77e5\u304c\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3082\u3068\u3082\u3068internal use\u306a\u3082\u306e\u3060\u3063\u305f\u306e\u3067\u304d\u305f\u306d\u3048\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u307e\u3059\u304c\u3001\u3082\u3063\u3068\u7dba\u9e97\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u66f8\u3051\u308b\u69d8\u306b\u7cbe\u9032\u3044\u305f\u3057\u3084\u3059\u3002\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8ffd\u8a18: 2023\u5e746\u6708\u306bGoogle Domains\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u306e\u3067\u672c\u8a18\u4e8b\u306fit doesnt works\u3067\u3059 \u3053\u306e\u8a18\u4e8b\u30923\u884c\u3067 Google Domains\u306bDDNS\u3092\u8a2d\u5b9a\u3057\u3066\u3001IP\u5909\u66f4\u901a\u77e5\u304c\u8d77\u304d &#8230; <\/p>\n","protected":false},"author":1,"featured_media":19,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188"}],"version-history":[{"count":0,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=\/wp\/v2\/media\/19"}],"wp:attachment":[{"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chatagiriii.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}