{"id":41,"date":"2006-06-26T04:01:00","date_gmt":"2006-06-26T04:01:00","guid":{"rendered":"http:\/\/www.houquner.com\/?p=122"},"modified":"2006-06-26T04:01:00","modified_gmt":"2006-06-26T04:01:00","slug":"%e8%af%95%e7%9d%80%e5%81%9a%e4%b8%aa%e5%8f%8cadsl%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1","status":"publish","type":"post","link":"https:\/\/www.houquner.com\/index.php\/archives\/41","title":{"rendered":"\u8bd5\u7740\u505a\u4e2a\u53ccadsl\u8d1f\u8f7d\u5747\u8861"},"content":{"rendered":"<p>\u516c\u53f8\u642c\u5bb6\u540e\u9700\u8981\u5728\u4e24\u8defadsl\u540c\u65f6\u62e8\u53f7\u589e\u52a0\u6240\u8c13\u7684\u5e26\u5bbd,\u6211\u9009\u62e9\u4e86Openbsd\u7cfb\u7edf.\u76ee\u524d\u7cfb\u7edf\u8fd0\u884c\u7a33\u5b9a,\u8d1f\u8f7d\u5982\u4e0b:<\/p>\n<h1>uptime<\/h1>\n<p>6:11AM? up 3 days, 12:04,?1 users, load averages: 0.11, 0.10, 0.12<\/p>\n<p>\u53c2\u8003:<a href=\"http:\/\/bbs.chinaunix.net\/viewthread.php?tid=746001&amp;extra=page%3D1%26filter%3Ddigest\">http:\/\/bbs.chinaunix.net\/viewthread.php?tid=746001&amp;extra=page%3D1%26filter%3Ddigest<\/a><br \/>\n?<br \/>\n \u4f7f\u7528OpenBSD 3.9 \u53ccADSL \u67b6\u8bbe \u8d1f\u8f7d\u5747\u8861 NAT\u670d\u52a1\u5668 \u914d\u7f6e\u6587\u4ef6\u5927\u81f4\u76f8\u540c.\u53c2\u8003pf-faq\u4e2dAddress Pools and Load Balancing \u7ae0\u8282.\u8ba1\u5212\u8fc7\u4e9b\u5929\u8bd5\u7740\u505a2\u8def\u7f51\u901aadsl,1\u8def\u7535\u4fe1\u7684adsl\u7684\u8d1f\u8f7d\u5747\u8861.(\u8981\u8bbe\u7f6e\u9ed8\u8ba4\u8def\u7531)<br \/>\n\u76d1\u63a7\u811a\u672c\u6709\u4e9b\u4e0d\u540c,\u5982\u4e0b:<br \/>\n?<\/p>\n<h1>!\/bin\/sh<\/h1>\n<p>sleep 10<br \/>\nflag=0<br \/>\nwhile :<br \/>\ndo<br \/>\nif_add0=&#8221;<code>ifconfig tun0 | grep netmask | awk '{printf $2}'<\/code>&#8220;<br \/>\nif_add1=&#8221;<code>ifconfig tun1 | grep netmask | awk '{printf $2}'<\/code>&#8220;<\/p>\n<p>if? [ $flag != 2 ]<br \/>\nthen<br \/>\n if [[ ! -z &#8220;$if_add0&#8221; &amp;&amp; &#8220;$if_add0&#8243; != &#8221; &amp;&amp; ! -z &#8220;$if_add1&#8221; &amp;&amp; &#8220;$if_add1&#8243; != &#8221;? ]]<br \/>\n then<br \/>\n \/sbin\/pfctl -d<br \/>\n \/sbin\/pfctl -F all -e? -f \/etc\/pf1.conf ;<br \/>\n echo <code>date<\/code> &#8221; &#8211;&gt;? chang to? \/etc\/pf1.conf &#8211;&gt;&#8221; tun0:$if_add0? tun1:$if_add1<br \/>\n flag=2<br \/>\n sleep 30<br \/>\n fi<br \/>\nfi<br \/>\n? if [[ ! -z &#8220;$if_add0&#8221; &amp;&amp; &#8220;$if_add0&#8243; != &#8221; &amp;&amp;? -z &#8220;$if_add1&#8221; &amp;&amp; &#8220;$if_add1&#8243; = &#8221;? ]]<br \/>\n then<br \/>\n \/sbin\/pfctl -d<br \/>\n \/sbin\/pfctl -F all -e? -f \/etc\/pf.conf ;<br \/>\n echo <code>date<\/code> &#8221; &#8211;&gt;? chang to? \/etc\/pf.conf &#8211;&gt;&#8221; tun0:$if_add0? tun1:$if_add1<br \/>\n sleep 30<br \/>\n fi<br \/>\n? if [[? -z &#8220;$if_add0&#8221; &amp;&amp; &#8220;$if_add0&#8243; = &#8221; &amp;&amp; ! -z &#8220;$if_add1&#8221; &amp;&amp; &#8220;$if_add1&#8243;! = &#8221;? ]]<br \/>\n then<br \/>\n \/sbin\/pfctl -d<br \/>\n \/sbin\/pfctl -F all -e? -f \/etc\/pf2.conf ;<br \/>\n echo <code>date<\/code> &#8221; &#8211;&gt;? chang to? \/etc\/pf2.conf &#8211;&gt;&#8221; tun0:$if_add0? tun1:$if_add1<br \/>\n sleep 30<br \/>\n fi<\/p>\n<p>if [[? -z &#8220;$if_add1&#8221; &amp;&amp; &#8220;$if_add1&#8243; = &#8221;? ]]<br \/>\n then<br \/>\n PID=<code>ps -x | grep 'unit 1' | grep ppp1 | awk '{print $1}'<\/code><br \/>\n kill $PID<br \/>\n ifconfig tun1 down<br \/>\n ifconfig tun1 up<br \/>\n \/usr\/sbin\/ppp -unit 1 -auto ppp1<br \/>\n echo &#8216;dial ppp1&#8217;<br \/>\n sleep? 5<br \/>\n flag=0<br \/>\n fi<\/p>\n<p>if [[? -z &#8220;$if_add0&#8221; &amp;&amp; &#8220;$if_add0&#8243; = &#8221;? ]]<br \/>\n then<br \/>\n PID=<code>ps -x | grep 'unit 0' | grep ppp0 | awk '{print $1}'<\/code><br \/>\n kill $PID<br \/>\n ifconfig tun0 down<br \/>\n ifconfig tun0 up<br \/>\n \/usr\/sbin\/ppp -unit 0 -auto ppp0<br \/>\n echo &#8216;dial ppp0&#8217;<br \/>\n sleep? 5<br \/>\n flag=0<br \/>\n fi<br \/>\n? sleep 30<\/p>\n<p>done<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.houquner.com\">Kermit\u7684\u7f51\u7ad9<\/a> &raquo; <a href=\"https:\/\/www.houquner.com\/index.php\/archives\/41\">\u8bd5\u7740\u505a\u4e2a\u53ccadsl\u8d1f\u8f7d\u5747\u8861<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u516c\u53f8\u642c\u5bb6\u540e\u9700\u8981\u5728\u4e24\u8defadsl\u540c\u65f6\u62e8\u53f7\u589e\u52a0\u6240\u8c13\u7684\u5e26\u5bbd,\u6211\u9009\u62e9\u4e86Openbsd\u7cfb\u7edf.\u76ee\u524d\u7cfb\u7edf\u8fd0\u884c\u7a33\u5b9a,\u8d1f\u8f7d\u5982\u4e0b: uptime 6:11AM? up 3 days, 12:04,?1 users, load averages: 0.11, 0.10, 0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts\/41"}],"collection":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}