{"id":41,"date":"2010-07-21T20:36:50","date_gmt":"2010-07-21T20:36:50","guid":{"rendered":"https:\/\/shan.info\/new\/pptpd-ppp-vpn-log\/"},"modified":"2010-07-21T20:36:50","modified_gmt":"2010-07-21T20:36:50","slug":"pptpd-ppp-vpn-log","status":"publish","type":"post","link":"https:\/\/shan.info\/new\/pptpd-ppp-vpn-log\/","title":{"rendered":"pptpd PPP VPN LOG"},"content":{"rendered":"<p>vpn \u670d\u52a1\uff0c\u4f46\u901a\u8fc7last\u67e5\u770b\u7684\u65f6\u5019\uff0c\u53ea\u6709\u767b\u5f55\u7684IP\u4fe1\u606f\uff0c<\/p>\n<div>\u00a0<\/div>\n<div>\u65e0\u6cd5\u67e5\u770bVPN\u5ba2\u6237\u7aef\u767b\u5f55\u7684\u7528\u6237\u540d\uff0c\u767b\u5f55\u5730\u5740\uff0c\u65ad\u5f00\u65f6\u95f4\u7b49\u4fe1\u606f\u3002<\/div>\n<div>\u00a0<\/div>\n<div>\u8bf7\u540c\u4e8b\u5199\u4e86\u4e24\u4e2a\u811a\u672c\u3002\u7528\u4e8e\u8bb0\u5f55\u767b\u5f55\u4fe1\u606f\u53ca\u767b\u51fa\u4fe1\u606f\u3002\u8bb0\u4e00\u4e0b\uff0c\u4ee5\u5907\u540e\u7528<\/div>\n<div>\u00a0<\/div>\n<div>\u4fee\u6539ip-up ,ip-down\u6587\u4ef6\uff0c\u589e\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff08export PATH \u884c\u540e\u9762\uff09\uff0c\u5c06\u65e5\u5fd7\u4fe1\u606f\u8bb0\u5f55\u5230<\/div>\n<div>\/var\/log\/pptpd.log\u6587\u4ef6 \u4e2d<\/div>\n<div>\u00a0<\/div>\n<div>\n<div style=\"padding: 4px; line-height: 16px; background-color: #eeeeee; width: 98%; font-family: verdana,\u5b8b\u4f53; color: #000000; font-size: 10pt;\"><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">vim \/etc\/ppp\/ip-up\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">echo &#8220;&#8221; &gt;&gt; \/var\/log\/pptpd.log\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">echo &#8220;IP UP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0`date -d today +%F_%T`\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$PEERNAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$5&#8243; &gt;&gt; \/var\/log\/pptpd.log<\/span><\/div>\n<\/div>\n<div>\u00a0<\/div>\n<div>vim \/etc\/ppp\/ip-down\u6587\u4ef6\u3002ip-down\u5199\u5165pptpd.log\u4e0e\u6700\u540e\u4e00\u4e2a ip-up\u8fdb\u884c\u914d\u5bf9\uff0c\u4ee5\u65b9\u4fbf\u67e5\u770b<\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">tac \/var\/log\/pptpd.log | while read line\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">do\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmphead=$(echo $line | cut -d&#8221; &#8221; -f1,2)\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmptime=$(echo $line | cut -d&#8221; &#8221; -f3)\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmpuser=$(echo $line | cut -d&#8221; &#8221; -f5)\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if [ &#8220;IP UP&#8221; = &#8220;$_tmphead&#8221; -a &#8220;$PEERNAME&#8221; = &#8220;$_tmpuser&#8221; ]\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0then\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_rep_line=&#8221;$line&#8221;\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sed -i &#8220;s\/$line\/$_rep_linenIP DOWN\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">`date -d today +%F_%T`\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$PEERNAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">$5\/&#8221; \/var\/log\/pptpd.log\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0break\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0fi\u00a0<\/span><br style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px;\" \/><span style=\"font-family: verdana, \u5b8b\u4f53; font-size: 13px; line-height: 16px; background-color: #eeeeee;\">done<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>vpn \u670d\u52a1\uff0c\u4f46\u901a\u8fc7last\u67e5\u770b\u7684\u65f6\u5019\uff0c\u53ea\u6709\u767b\u5f55\u7684IP\u4fe1\u606f\uff0c \u00a0 \u65e0\u6cd5\u67e5\u770bVPN\u5ba2\u6237\u7aef\u767b\u5f55\u7684\u7528\u6237\u540d\uff0c\u767b\u5f55\u5730\u5740\uff0c\u65ad\u5f00\u65f6\u95f4\u7b49\u4fe1\u606f\u3002 \u00a0 \u8bf7\u540c\u4e8b\u5199\u4e86\u4e24\u4e2a\u811a\u672c\u3002\u7528\u4e8e\u8bb0\u5f55\u767b\u5f55\u4fe1\u606f\u53ca\u767b\u51fa\u4fe1\u606f\u3002\u8bb0\u4e00\u4e0b\uff0c\u4ee5\u5907\u540e\u7528 \u00a0 \u4fee\u6539ip-up ,ip-down\u6587\u4ef6\uff0c\u589e\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff08export PATH \u884c\u540e\u9762\uff09\uff0c\u5c06\u65e5\u5fd7\u4fe1\u606f\u8bb0\u5f55\u5230 \/var\/log\/pptpd.log\u6587\u4ef6 \u4e2d \u00a0 vim \/etc\/ppp\/ip-up\u00a0echo &#8220;&#8221; &gt;&gt; \/var\/log\/pptpd.log\u00a0echo &#8220;IP UP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0`date -d today +%F_%T`\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$PEERNAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$5&#8243; &gt;&gt; \/var\/log\/pptpd.log \u00a0 vim \/etc\/ppp\/ip-down\u6587\u4ef6\u3002ip-down\u5199\u5165pptpd.log\u4e0e\u6700\u540e\u4e00\u4e2a ip-up\u8fdb\u884c\u914d\u5bf9\uff0c\u4ee5\u65b9\u4fbf\u67e5\u770b \u00a0 \u00a0 \u00a0 tac \/var\/log\/pptpd.log | while read line\u00a0do\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmphead=$(echo $line | cut -d&#8221; &#8221; -f1,2)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmptime=$(echo $line | cut -d&#8221; &#8221; -f3)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_tmpuser=$(echo $line | cut -d&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-vpn"],"_links":{"self":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}