{"id":10645,"date":"2013-02-14T23:53:39","date_gmt":"2013-02-14T15:53:39","guid":{"rendered":"http:\/\/ukyoi.wordpress.com\/?p=10645"},"modified":"2013-02-14T23:53:39","modified_gmt":"2013-02-14T15:53:39","slug":"linux%e4%b8%8b%ef%bc%8candroid%e6%89%8b%e6%9c%ba%e5%b9%b3%e6%9d%bf%e4%bd%bf%e7%94%a8usb%e5%8f%8d%e5%90%91%e5%85%b1%e4%ba%ab%ef%bc%88reverse-tethering%ef%bc%89pc%e7%9a%84%e6%9c%89%e7%ba%bf%e7%bd%91","status":"publish","type":"post","link":"https:\/\/ukyoi.info\/wordpress\/?p=10645","title":{"rendered":"Linux\u4e0b\uff0candroid\u624b\u673a\/\u5e73\u677f\u4f7f\u7528USB\u53cd\u5411\u5171\u4eab\uff08reverse tethering\uff09PC\u7684\u6709\u7ebf\u7f51\u7edc"},"content":{"rendered":"<p>\u4ee5\u524d\u7684\u624b\u673a\u5171\u4eab\u95ee\u9898\u6211\u90fd\u662f\u7528hack\u8fc7\u3001\u652f\u6301ad-hoc\u7684wpa_supplicant\u89e3\u51b3\uff0c\u4e0d\u8fc7\u6700\u8fd1\u5347\u7ea7\u4e86android4.2\uff0c\u627e\u4e86\u5f88\u4e45\u4e5f\u627e\u4e0d\u5230\u9002\u7528\u7684wpa_supplicant\u3002\u8e0f\u7834\u94c1\u978b\u4e4b\u540e\uff0c\u5728XDA\u4e0a\u770b\u5230\u4e86<a href=\"http:\/\/forum.xda-developers.com\/showthread.php?t=1824132\">\u8fd9\u6837\u4e00\u4e2a\u7528USB\u53cd\u5411\u5171\u4eab\u7684\u65b9\u6cd5\uff08\u70b9\u51fb\u8fdb\u5165\u539f\u6587\uff09<\/a>\uff0c\u603b\u7ed3\u5982\u4e0b\uff1a<\/p>\n<p>\u9996\u5148\u5efa\u8bae\u8981\u6709adb\uff0c\u6ca1\u6709\u7684\u8bdd\u5c31\u5f97\u5728\u624b\u673a\u7684\u7ec8\u7aef\u6a21\u62df\u5668\u91cc\u7801\u5b57\uff0c\u592a\u7d2f\u3002<\/p>\n<p>\u4e3b\u673a\uff08PC\uff09\u65b9\u9762\uff0c\u4ee5root\u6267\u884c\uff1a<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\niptables -A POSTROUTING -t nat -j MASQUERADE<br \/>\necho 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<br \/>\n[\/sourcecode]<\/p>\n<p>\u8fd9\u4e24\u53e5\u662f\u6253\u5f00\u7f51\u7edc\u5730\u5740\u8f6c\u6362\uff08NAT\uff09\u548cIP\u8f6c\u53d1\u3002<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\nifconfig [\u60a8\u7684\u7f51\u7edc\u63a5\u53e3\u5730\u5740] 12.12.10.1<br \/>\n[\/sourcecode]<\/p>\n<p>\u8fd9\u53e5\u662f\u4e3a\u63a5\u53e3\u8bbe\u7f6eIP\u3002\u7f51\u7edc\u63a5\u53e3\u5730\u5740\u4e0d\u540c\u7684\u673a\u5668\u6709\u6240\u4e0d\u540c\uff0c\u53ef\u4ee5\u7528ifconfig\u547d\u4ee4\u770b\u3002\u6709\u7684\u53d1\u884c\u7248\u662fusb0\uff08\u5982\u679c\u4f7f\u7528usb\u5171\u4eab\u7684\u8bdd\uff09\uff0c\u6211\u6240\u7528\u7684Arch\u4e3a\u4e86\u907f\u514d\u63d2\u4e86\u65b0\u7f51\u5361\u51fa\u73b0\u5730\u5740\u540d\u4e0d\u56fa\u5b9a\u7684\u95ee\u9898\uff0c\u7528\u7684\u662f\u53e6\u4e00\u79cd\u547d\u540d\uff0c\u6bd4\u5982\u6211\u7684\u63a5\u53e3\u540d\u662fenp0s26f7u1\u3002<\/p>\n<p>IP\u5730\u5740\u5e76\u4e0d\u4e00\u5b9a\u975e\u8981\u662f12.12.10.1\uff0c192.168.0.1\u4e4b\u7c7b\u7684\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u4f46\u8981\u548c\u4e0b\u9762\u624b\u673a\u8bbe\u7f6e\u7684\u57df\u4fdd\u6301\u4e00\u81f4\u3002<\/p>\n<p>\u624b\u673a\u65b9\u9762\uff0c\u9996\u5148\u8981\u6253\u5f00\u79fb\u52a8\u7f51\u7edc\uff0c\u56e0\u4e3a\u6709\u4e9b\u8f6f\u4ef6\u4f3c\u4e4e\u5fc5\u9700\u5728\u201c\u5f62\u5f0f\u4e0a\u6709\u7f51\u7edc\u8fde\u63a5\u201d\u7684\u72b6\u51b5\u4e0b\u624d\u80fd\u4f7f\u7528\u3002<br \/>\n\u5728adb shell\u6216\u7ec8\u7aef\u6a21\u62df\u5668\u91cc\uff0croot\u73af\u5883\u4e0b\uff1a<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\nifconfig rmnet0 0.0.0.0<br \/>\n[\/sourcecode]<\/p>\n<p>\u6b64\u4e3a\u5173\u95ed\u624b\u673a\u4fe1\u53f7\u8fde\u63a5\u3002<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\nifconfig usb0 12.12.10.2<br \/>\nroute add default gw 12.12.10.1 dev usb0<br \/>\n[\/sourcecode]<\/p>\n<p>\u4e3a\u624b\u673a\u7684usb0\u63a5\u53e3\u914d\u7f6eIP\u5730\u5740\uff0812.12.10.2\uff09\uff0c\u5e76\u8bbe\u7f6e\u8def\u7531\u4e3a\u4e3b\u673a\uff0812.12.10.1\uff09\u3002\u6ce8\u610fIP\u8fd9\u91cc\u7684\u57df\u8981\u548c\u4e3b\u673a\u7684\u5339\u914d\u3002<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\nsetprop net.dns1 8.8.8.8<br \/>\n[\/sourcecode]<\/p>\n<p>\u8bbe\u7f6eDNS\u670d\u52a1\u5668\u30028.8.8.8\u662f\u4e00\u4e2a\u8457\u540d\u7684DNS\u670d\u52a1\u5668\uff0c\u5f52Google\u6240\u6709\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u624b\u673a\u5c31\u5e94\u8be5\u80fd\u591f\u6b63\u5e38\u8054\u7f51\u4e86\u3002android4.0\u540e\u5b98\u65b9\u52a0\u5165\u4e86wifi-tether\uff0c\u6211\u6ca1\u6709\u6d4b\u8bd5\uff0c\u4f46\u7406\u8bba\u4e0a\u5e94\u8be5\u4e5f\u80fd\u5982\u6cd5\u70ae\u5236\uff08\u751a\u81f3\u4e0d\u9700\u8981\u5206\u914dIP\u8fd9\u4e00\u6b65\uff0c\u56e0\u4e3aPC\u8fde\u63a5\u4e0a\u4e4b\u540eIP\u4f1a\u88ab\u8bbe\u7f6e\u4e3a192.168.x.x\uff09\uff0c\u53ea\u9700\u628a\u4e3b\u673a\u7684\u63a5\u53e3\u5730\u5740\u6362\u6210\u65e0\u7ebf\u7f51\u5361\u7684\uff0c\u518d\u628a\u624b\u673a\u7aef\u7684usb0\u6362\u6210wlan0\u5373\u53ef\u3002\u6b22\u8fce\u5927\u5bb6\u5c1d\u8bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u7684\u624b\u673a\u5171\u4eab\u95ee\u9898\u6211\u90fd\u662f\u7528hack\u8fc7\u3001\u652f\u6301ad-hoc\u7684wpa_supplicant\u89e3\u51b3\uff0c\u4e0d\u8fc7\u6700\u8fd1\u5347\u7ea7\u4e86and &#8230; <a title=\"Linux\u4e0b\uff0candroid\u624b\u673a\/\u5e73\u677f\u4f7f\u7528USB\u53cd\u5411\u5171\u4eab\uff08reverse tethering\uff09PC\u7684\u6709\u7ebf\u7f51\u7edc\" class=\"read-more\" href=\"https:\/\/ukyoi.info\/wordpress\/?p=10645\" aria-label=\"\u9605\u8bfb Linux\u4e0b\uff0candroid\u624b\u673a\/\u5e73\u677f\u4f7f\u7528USB\u53cd\u5411\u5171\u4eab\uff08reverse tethering\uff09PC\u7684\u6709\u7ebf\u7f51\u7edc\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,12],"tags":[],"class_list":["post-10645","post","type-post","status-publish","format-standard","hentry","category-9","category--internet"],"_links":{"self":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10645"}],"version-history":[{"count":0,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10645\/revisions"}],"wp:attachment":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}