ãNUROå ãã°ãã¼ãã«IPã¢ãã¬ã¹ãLINEã§éç¥ããä»çµã¿ãã¤ãã£ã¦ã¿ã
å¤é¨ããVPNã§å
¥ã£ããããããã«ãã¾ãã¯èªåã¡ã®ã°ãã¼ãã«IPã¢ãã¬ã¹ãç¥ãå¿
è¦ãããã¾ãã
NUROå
ã¯ã°ãã¼ãã«IPã¢ãã¬ã¹ã¯ã»ã¨ãã©å¤ãããªãååºå®ã¨ããæ
å ±ãããã¾ãããä¸å¿åçIPã
IPãå¤æ´ããã¦ã大ä¸å¤«ãªããã«ããå¿
è¦ãããã¾ãã
Dynamic DNS(DDNS)ã使ã£ããã¨ããããã¾ãããã¾ãã¯IPã¢ãã¬ã¹ãç´æ¥å
¥åã§ããããã«ã°ãã¼ãã«IPã®ã¢ãã¬ã¹ãéç¥ããä»çµã¿ãä½ãã¾ãã
éç¥ããæ¹æ³ãè²ã ããã¾ãããã°ããã«IPã«ã¤ãªãã®ã¯å¤åºæã«ãªãããã§ããããã¹ããã«éç¥ãæ¥ãLINEãä¸çªããã¨æãã¾ãã
- å¦çã®æ¦è¦
- 常æé»æºONã®ãµã¼ãï¼lubuntuï¼ããå®æçã«ã°ãã¼ãã«IPã¢ãã¬ã¹ãåå¾ãã
- ã°ãã¼ãã«IPã¢ãã¬ã¹ãå¤åãããLINEã«å¤æ´ããIPã¢ãã¬ã¹ãéç¥ãã
- ï¼æªå®è£ ï¼ãã®éç¥ã·ã¹ãã èªä½ãã¡ããã¨åãã¦ããããæã LINEã«éç¥ããï¼ããã¦ãã§ã¼ï¼
- ä¸å®å¨æï¼ä¸æéãããããï¼ã§èµ·åãã
- æºå
- å®è£
- åä½çµæ
å¦çã®æ¦è¦
ã¨ããããã§ã以ä¸ã®ãããªå½¢ã§ã°ãã¼ãã«IPãå¤ãã£ããLINEã«éç¥ããããã«ãã¾ãã
ã»å¸¸æé»æºONã®ãµã¼ãï¼lubuntuï¼ããå®æçã«ã°ãã¼ãã«IPã¢ãã¬ã¹ãåå¾ãã
ã»ã°ãã¼ãã«IPã¢ãã¬ã¹ãå¤åãããLINEã«å¤æ´ããIPã¢ãã¬ã¹ãéç¥ãã
ã»æ¬¡åèµ·åã®æ¯è¼ç¨ã«ç¾å¨ã®IPã¢ãã¬ã¹ãè¦ãã¦ãã
ã»ï¼æªå®è£
ï¼ãã®éç¥ã·ã¹ãã èªä½ãã¡ããã¨åãã¦ããããæã
LINEã«éç¥ããï¼ããã¦ãã§ã¼ï¼
ã»ä¸å®å¨æï¼ä¸æéãããããï¼ã§èµ·åãã
常æé»æºONã®ãµã¼ãï¼lubuntuï¼ããå®æçã«ã°ãã¼ãã«IPã¢ãã¬ã¹ãåå¾ãã
ã¨ããããæã£åãæ©ãã°ãã¼ãã«IPãæãã¦ãããå¤é¨ãµã¼ãã¹ãå©ç¨ãã
ãã
inet-ip.info
ãã®ãã¼ã¸ã«ãæ¸ãã¦ããã¾ãããcurlã³ãã³ãã§çã°ãã¼ãã«IPã¢ãã¬ã¹ãã®ãã®ãåå¾ã§ãã¾ãã
curl inet-ip.info
ããã¡ã
å¤é¨ãµã¼ãã¹ä¾åã«ãªãããF660Aã®ç®¡çç»é¢ãã¹ã¯ã¬ã¤ãã³ã°ãã¦åå¾ï¼æªå®è£ ï¼
ãã¯ãå¤é¨ãµã¼ãã¹ãªã®ã§ããµã¼ãã¹ã®åæ¢ãå»æ¢ã«å½±é¿ãããã®ãæãã§ãã
F660Aã®ç®¡çç»é¢ãããã¹ãã¼ã¿ã¹>>ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹æ
å ±>>WANæ¥ç¶æ
å ±ã
ã§ã°ãã¼ãã«IPãã¨ããã®ã§åå¾ã§ããã¯ã
ã°ãã¼ãã«IPã¢ãã¬ã¹ãå¤åãããLINEã«å¤æ´ããIPã¢ãã¬ã¹ãéç¥ãã
åååå¾ããIPã¢ãã¬ã¹ã¨éãå ´åã¯LINEã«éç¥ãã¾ãã
LINEéç¥ã®ä»çµã¿ãLINE notifyãã¤ã±ã¦ãã®ã§ããã使ãã¾ã
ãã¡ãã¡ã§ç´¹ä»ããã¦ããã®ã§ãããããããªã¨ããã§ããããåç
§
djeeeno.blogspot.com
è¨å®ã¯ãããã®ã®ãcurlã³ãã³ãä¸çºã§LINEã«éç¥ã§ãã¾ãã
è¶
ã¯ã¼ã«ï¼
ã°ãã¼ãã«IPãå¤åããã®ãæ¤åºããï¼ãããã¯ååï¼
IPã¢ãã¬ã¹ãé©å½ãªãã¡ã¤ã«ã«æ¸ãè¾¼ãã§ã次åã¯åå¾ããIPã¨ãããæ¯è¼ãã¾ãã
ãã¡ã¤ã«ããªãå ´åã¯ååã ã¨ããäºã§IPãéç¥ãã¾ãã
ä»åã¯ã/tmp/global_ip.txtãã«æ¸ãè¾¼ãäºã«ãã¾ãã
ã°ãã¼ãã«IPã¢ãã¬ã¹ã®åå¾ã«å¤±æããããLINEã«ãåããªãã£ããã£ã¦éç¥
inet-ip.infoãè½ã¡ã¦ããããããLINEã«éç¥ãã¾ãã
ã¨ããããè½ã¡ã¦ãããã ã¯æ¯åLINEéç¥è¡ã£ã¡ãããã©ã¾ãããã
ï¼æªå®è£ ï¼ãã®éç¥ã·ã¹ãã èªä½ãã¡ããã¨åãã¦ããããæã LINEã«éç¥ããï¼ããã¦ãã§ã¼ï¼
ä¸å®ééï¼ãããã¯IPã¢ãã¬ã¹ãä¸å®æéããããªãã£ããï¼LINEéç¥ããä»çµã¿ã欲ããã¨æãã¾ãã
ç¹ã«NUROã¯ã°ãã¼ãã«IPãã»ã¨ãã©å¤ãããªãã¨ããåã ããæ°ãä»ããããã§ãã¯ãã¦ãªãã£ããã¿ãããªäºã¯é¿ãããã
LINE notifyã®ãµã¼ãã¹ããã¤é害起ãããçµäºãããããããªããã
ä¸é±éã«ä¸åã¨ãä¸ãæã«ä¸åã¨ãéç¥ãããã°ããããªããããããï¼ããããã°æ¥ã¦ãªãããããã£ã¦æ°ãä»ãã¾ã
IPæ¸ãè¾¼ãã ãã¡ã¤ã«ï¼global_ip.txtï¼ã®æ¥ä»ãè¦ã¦å¤æããããglobal_ip.txtã«æ¸ãè¾¼ããã§ååéç¥ãã¦ããã©ããããçµã£ããããããããå®ç¾ã¯ã§ãããã§ãã
ä¸å®å¨æï¼ä¸æéãããããï¼ã§èµ·åãã
æã£åãæ©ãCRONã使ãã¾ãã
ã¯ã¼ãã³ã®æ¸ãæ¹ã¯ã©ããã®è§£èª¬ãµã¤ããè¦ã¦ãããã¨ãã¦ãï¼æéå¨æã§èµ·åããããã«ãã¾ã
æºå
å®è£
ã·ã§ã«ã®ã½ã¼ã¹
ã¨ã©ã¼å¦çã¨ãããå æ¸ï¼ã¨ãããç¡ãï¼ã§ããããããªæãã§
GlobaIPNotify.sh ã£ã¦ååã§ä½æãã¾ãï¼ãªãã§ããããã©ï¼
#!/bin/bash FILE_NAME="/tmp/global_ip.txt" LINE_TOKEN="åå¾ãããã¼ã¯ã³" function send_message() { curl -s -X POST -H "Authorization: Bearer ${LINE_TOKEN}" -F "message=$1" https://notify-api.line.me/api/notify } # åååå¾ã®Global IPããã¡ã¤ã«ããåãåºã # ãã¡ã¤ã«ãåå¨ããªãå ´åãGlobal IPæªåå¾ã¨ã¿ãªã if [ -e $FILE_NAME ]; then last_IP=`cat $FILE_NAME` else last_IP="" fi # ç¾å¨ã®Global IPãåå¾ now_IP=`curl -s inet-ip.info` if [ "${now_IP}" = "" ]; then echo "curl error?" send_message "ã°ãã¼ãã«IPã®åå¾ã«å¤±æãã¾ãã(${last_IP})" elif [ "${now_IP}" = "${last_IP}" ]; then echo "same ip" else echo "change ${last_IP} -> ${now_IP}" # LINEã¸IPã¢ãã¬ã¹å¤æ´ãéç¥ if [ "${last_IP}" = "" ]; then send_message "åæèµ·åã¾ãã¯åèµ·åãããã¼(${now_IP})" else send_message "IPãããã£ããã¼(${last_IP} -> ${now_IP})" fi echo "" # å¤æ´ããIPãè¦ãã echo $now_IP > $FILE_NAME fi
CRONè¨å®
crontabã®ç·¨é
crontab -e
ã¨ãã£ã¿ã§ä»¥ä¸ã追å ãã¾ã
MAILTO="" 00 * * * * ~/tools/GlobaIPNotify.sh
ã»ã¡ã¼ã«éç¥ããªãè¨å®
MAILTOã¯cronå¦ççµæãã¡ã¼ã«ã§éç¥ãããã®è¨å®ã§ãã
ã¡ã¼ã«éç¥ããã«ããã¨postfixãå
¥ã£ã¦ããªãã®ã§
ã(CRON) info (No MTA installed, discarding output)ã
ã¨ããã¡ãã»ã¼ã¸ã/var/log/syslogã«åºã¾ã
ã»æ¯æ00åã«ã«ã¬ã³ããã£ã¬ã¯ããªä¸ã®tools/GlobaIPNotify.shãå®è¡ãã¾ã
åä½çµæ
LINEã«éç¥ãæ¥ã¾ã