{"id":510,"date":"2010-05-16T23:02:54","date_gmt":"2010-05-16T15:02:54","guid":{"rendered":"http:\/\/www.kumouse.com\/?p=510"},"modified":"2010-05-16T23:02:54","modified_gmt":"2010-05-16T15:02:54","slug":"linux-%e5%91%bd%e4%bb%a4%e8%a1%8c-%e5%85%b1%e4%ba%ab-%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c","status":"publish","type":"post","link":"https:\/\/www.kumouse.com\/?p=510","title":{"rendered":"linux \u547d\u4ee4\u884c \u5171\u4eab \u65e0\u7ebf\u7f51\u7edc"},"content":{"rendered":"<p>\u8fd9\u51e0\u5929\u6539\u4e86\u8def\u7531\u5668\uff0c\u524d\u9762\u7684\u8d34\u5b50\u91cc\u5199\u4e86\u3002\u5237\u4e86TOMATO DUALWAN\u7684\u56fa\u4ef6\uff0c\u53ef\u4ee5\u53cc\u5361\u5408\u5e76\uff0c\u4f46\u662f\u8fd9\u4e2a\u56fa\u4ef6\u4e0d\u652f\u6301\u4e2d\u7ee7\uff0c\u6211\u7684\u7b14\u8bb0\u672c\u8fd8\u8981\u7528\u65e0\u7ebf\u3002\u600e\u4e48\u80fd\u5408\u5e76\u65e0\u7ebf\u7f51\u548c\u6709\u7ebf\u7f51\uff0c\u53c8\u80fd\u8ba9\u7b14\u8bb0\u672c\u4e0a\u5408\u5e76\u540e\u7684\u65e0\u7ebf\u7f51\u5462\uff1f<\/p>\n<p>\u7b54\u6848\u662f\uff0c\u5171\u4eab\u4e00\u53f0\u7535\u8111\u4e0a\u7684\u65e0\u7ebf\u7f51\u5361\uff0c\u8f6c\u6210\u6709\u7ebf\uff0c\u63d2\u5728\u8def\u7531\u7684WAN2\u4e0a\uff0c\u8fd9\u6837\u8def\u7531\u7684\u65e0\u7ebf\u5c31\u53ef\u4ee5AP\u4e86\u3002<\/p>\n<p>\u4e0b\u9762\u6765\u8bf4\u8bf4\u5982\u4f55\u5728LINUX\u4e0b\u5171\u4eab\u65e0\u7ebf\u7f51\u7edc\u3002<\/p>\n<p>\u5177\u4f53\u8fc7\u7a0b<br \/>\n\t1. \u6253\u5f00\u65e0\u7ebf\u7f51\u5361<\/p>\n<p>ifup&nbsp;wlan0 <br \/>\n\t2. \u5217\u51fa\u533a\u57df\u5185\u7684\u65e0\u7ebf\u7f51\u7edc<\/p>\n<p>iwlist wlan0 scan<br \/>\n\t3. \u5047\u8bbe\u8981\u8fde\u63a5\u5230\u7f51\u7edcMyHome\uff08\u5373essid\u4e3aMyHome\u7684\u7f51\u7edc\uff09\uff0c\u90a3\u4e48\u8f93\u5165\u547d\u4ee4<\/p>\n<p>iwconfig wlan0 essid &quot;MyHome&quot; <br \/>\n\t\u5982\u679c\u7f51\u7edc\u662f\u52a0\u5bc6\u7684\uff0c\u5bc6\u7801\u662f0123456789\uff0c\u90a3\u4e48\u5c31\u8f93\u5165\u547d\u4ee4<\/p>\n<p>iwconfig wlan0 essid &quot;MyHome&quot; key 0123456789<br \/>\n\t4. \u5982\u679c\u6b63\u5e38\u7684\u8bdd\uff0c\u8f93\u5165<\/p>\n<p>iwconfig wlan0<br \/>\n\t\u5c31\u53ef\u4ee5\u770b\u5230\u8fde\u63a5\u6b63\u5e38\u7684\u5404\u9879\u53c2\u6570\u4e86\u3002<\/p>\n<p>5. \u5982\u679c\u662f\u7528DHCP\u83b7\u53d6IP\u7684\uff0c\u90a3\u4e48\u7528dhclient\u6216dhcpcd\u83b7\u53d6ip<\/p>\n<p>dhclient wlan0<br \/>\n\t\u6216<\/p>\n<p>dhcpcd wlan0<br \/>\n\t6. \u73b0\u5728\u65e0\u7ebf\u7f51\u5361\u5e94\u8be5\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u4e86<\/p>\n<p>7.\u8bbe\u7f6e\u8f6c\u53d1<\/p>\n<p>#!\/bin\/sh&nbsp;&nbsp; <br \/>\n\t# Name: nat.sh&nbsp;&nbsp; <br \/>\n\t# Author: Bixuan&nbsp;&nbsp; <br \/>\n\t# Date: 2003\/04\/04&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp; <br \/>\n\techo &quot;Your user the iptables firewall.&quot;;&nbsp;&nbsp; <br \/>\n\tETH=&quot;wlan0&quot;&nbsp; #\u5916\u7f51\u7684\u7f51\u5361<br \/>\n\tSRC=&quot;192.168.3.0\/24&quot; #\u5185\u7f51\u7684IP\u6bb5<br \/>\n\t&nbsp;&nbsp;&nbsp;<br \/>\n\t&nbsp;&nbsp; <br \/>\n\tcase $1 in&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp; start)&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe ip_tables&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe iptable_filter&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe iptable_nat&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe ip_conntrack&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe ip_conntrack_ftp&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/modprobe ip_nat_ftp&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -F INPUT&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -F FORWARD&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -F POSTROUTING -t nat&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -P FORWARD DROP&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -t nat -A POSTROUTING -o $ETH -s $SRC -j MASQUERADE&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -A FORWARD -i $ETH -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/sbin\/iptables -A FORWARD -s $SRC -j ACCEPT&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;Nat is strating &#8230;&#8230; [ OK ]&quot;&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp; stop)&nbsp;&nbsp; <br \/>\n\techo 0 &gt; \/proc\/sys\/net\/ipv4\/ip_forward&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp; *)&nbsp;&nbsp; <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $&quot;Usage: $0 {start|stop}&quot;;&nbsp;&nbsp; <br \/>\n\tesac<br \/>\n\t&nbsp;<\/p>\n<p>\u6211\u4ee5\u5199\u6210\u811a\u672c<a href=\"http:\/\/www.kumouse.com\/wp-content\/uploads\/2010\/05\/nat.rar\">nat<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u51e0\u5929\u6539\u4e86\u8def\u7531\u5668\uff0c\u524d\u9762\u7684\u8d34\u5b50\u91cc\u5199\u4e86\u3002\u5237\u4e86TOMATO DUALWAN\u7684\u56fa\u4ef6\uff0c\u53ef\u4ee5\u53cc\u5361\u5408\u5e76\uff0c\u4f46\u662f\u8fd9\u4e2a\u56fa\u4ef6\u4e0d\u652f\u6301\u4e2d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=510"}],"version-history":[{"count":0,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/510\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}