{"id":3868,"date":"2016-10-15T09:18:53","date_gmt":"2016-10-15T00:18:53","guid":{"rendered":"http:\/\/www.nkozawa.com\/blog\/?p=3868"},"modified":"2016-10-15T09:18:53","modified_gmt":"2016-10-15T00:18:53","slug":"%e5%b0%8f%e7%b1%b3%e3%83%ab%e3%83%bc%e3%82%bf%e3%83%bc%e9%9d%92%e6%98%a5%e7%89%88-openwrt-relayd-%e3%83%aa%e3%83%94%e3%83%bc%e3%82%bf%e3%83%bc%e9%80%9f%e5%ba%a6%e6%94%b9%e5%96%84","status":"publish","type":"post","link":"http:\/\/www.nkozawa.com\/blog\/archives\/3868","title":{"rendered":"\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u9752\u6625\u7248 + OpenWrt + relayd \u30ea\u30d4\u30fc\u30bf\u30fc(\u901f\u5ea6\u6539\u5584)"},"content":{"rendered":"<p>\u4ee5\u524d\u3001<a href=\"http:\/\/www.nkozawa.com\/blog\/archives\/3793\">\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u9752\u6625\u7248\u3092\u30ea\u30d4\u30fc\u30bf\u30fc<\/a>\u3068\u3057\u3066\u7c21\u5358\u306b\u69cb\u6210\u3057\u305f\u6642\u306f\u304b\u306a\u308a\u9045\u304f\u3066\u4f7f\u3046\u6c17\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f(\u6570\u5024\u306f\u53d6\u3063\u3066\u3044\u307e\u305b\u3093\u304c)\u3002<\/p>\n<p>\u3082\u3046\u3061\u3087\u3063\u3068\u6539\u5584\u3057\u306a\u3044\u3082\u306e\u304b\u3068relayd\u3092\u4f7f\u7528\u3057\u305f\u69cb\u6210\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u901f\u5ea6\u3082\u3060\u3044\u3076\u30de\u30b7\u306b\u306a\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u69cb\u6210\u65b9\u6cd5\u306b\u3064\u3044\u3066\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/wiki.openwrt.org\/doc\/recipes\/relayclient\">\u516c\u5f0f\u30ac\u30a4\u30c9<\/a>\u306b\u5f93\u3044\u307e\u3059\u304cOpenWrt\u306e\u30ec\u30d9\u30eb\u306e\u5dee\u306b\u3088\u308b\u3082\u306e\u304b\u3001\u591a\u5c11\u30a2\u30ec\u30f3\u30b8\u304c\u5fc5\u8981\u3067\u3057\u305f\u306e\u3067\u5168\u3066\u306e\u6295\u5165\u30b3\u30de\u30f3\u30c9\u3092\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u524d\u63d0\u3068\u3057\u3066\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u306e\u521d\u671f\u8a2d\u5b9a\u72b6\u614b\u304b\u3089\u69cb\u6210\u3092\u958b\u59cb\u3059\u308b\u3082\u306e\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u64cd\u4f5c\u306fPC\u304b\u3089Ethernet\u30b1\u30fc\u30d6\u30eb\u3092\u767d\u3044Ethernet\u30b3\u30cd\u30af\u30bf\u30fc\u306b\u63a5\u7d9a\u3057&#8221;ssh root@192.168.1.1&#8243;\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u884c\u3044\u307e\u3059\u3002<\/p>\n<p><strong>[ wifi\u306e\u6d3b\u6027\u5316 ]<\/strong><br \/>\n<code># uci set wireless.@wifi-device[0].disabled=0<br \/>\n# uci commit wireless<br \/>\n# wifi<\/code><\/p>\n<p><strong>[ \u63a5\u7d9a\u5148\u306eWifi\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u78ba\u8a8d ]<\/strong><br \/>\n\u516c\u5f0f\u30ac\u30a4\u30c9\u306b\u3042\u308biwlist scan\u306e\u65b9\u306f\u52d5\u304b\u306a\u304b\u3063\u305f\u3067\u3059\u3002<br \/>\n<code># iw dev wlan0 scan<\/code><\/p>\n<p><strong>[ wwan\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u69cb\u6210 ]<\/strong><br \/>\n<code># uci set network.wwan=interface<br \/>\n# uci set network.wwan.proto=dhcp<br \/>\n# uci commit network<\/code><\/p>\n<p>\/etc\/config\/network\u306b\u8a72\u5f53\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>[ Wireless\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u65e2\u5b58\u306eWifi\u30eb\u30fc\u30bf\u30fc\u306b\u63a5\u7d9a\u3059\u308b ]<\/strong><br \/>\n<code># uci set wireless.radio0.channel=11<br \/>\n# uci set wireless.@wifi-iface[0].network=wwan<br \/>\n# uci set wireless.@wifi-iface[0].mode=sta<br \/>\n# uci set wireless.@wifi-iface[0].ssid=xmff-relay<br \/>\n# uci set wireless.@wifi-iface[0].encryption=psk2<br \/>\n# uci set wireless.@wifi-iface[0].key=secret-key<br \/>\n# uci commit wireless<\/code><\/p>\n<p>&#8211; &#8220;ssid=&#8221;\u306b\u306f\u81ea\u5206\u306eWifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u306eSSID\u3092\u8a18\u5165\u3057\u307e\u3059\u3002<br \/>\n&#8211; &#8220;encryption=&#8221;\u306f\u30b5\u30f3\u30d7\u30eb\u3067\u306fpsk\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u308f\u305f\u3057\u306e\u5834\u5408\u306fpsk2\u306b\u3057\u306a\u3044\u3068\u30c0\u30e1\u3067\u3057\u305f\u3002<br \/>\n&#8211; &#8220;key=&#8221;\u306b\u306f\u81ea\u5206\u306eWifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a18\u5165\u3057\u307e\u3059\u3002<\/p>\n<p>\u69cb\u6210\u306f\/etc\/config\/wireless\u306b\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><code># wifi down; wifi<\/code><br \/>\n\u3067\u69cb\u6210\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002\u3057\u3070\u3089\u304f\u3057\u3066ifconfig\u3092\u6295\u5165\u3059\u308b\u3068wlan0\u306b\u65e2\u5b58\u306ewifi\u30eb\u30fc\u30bf\u30fc\u304b\u3089\u5272\u308a\u5f53\u3066\u3089\u308c\u305fIP address\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>[ relayd\u306e\u5c0e\u5165 ]<\/strong><\/p>\n<p>\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u304c\u65e2\u5b58\u306ewifi\u30eb\u30fc\u30bf\u30fc\u3092\u7d4c\u7531\u3057\u3066\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u63a5\u7d9a\u3055\u308c\u305f\u306e\u3067relyd\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5c0e\u5165\u3057\u307e\u3059\u3002<br \/>\n<code># opkg update<br \/>\n# opkg install relayd<\/code><\/p>\n<p>\u30eb\u30fc\u30bf\u30fc\u306e\u30d6\u30fc\u30c8\u6642\u306brelayd\u304c\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br \/>\n<code># \/etc\/init.d\/relayd enable<\/code><\/p>\n<p><strong>[ relay\u7528\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u4f5c\u6210 ]<\/strong><br \/>\n<code># uci set network.stabridge=interface<br \/>\n# uci set network.stabridge.proto=relay<br \/>\n# uci set network.stabridge.network=\"lan wwan\"<br \/>\n# uci commit network<\/code><\/p>\n<p>\/etc\/config\/network\u306b\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>[ \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9LAN\u306bgateway\u3068\u3000dns\u3092\u8a2d\u5b9a ]<\/strong><br \/>\n<code># route -n | grep UG<\/code><br \/>\n\u3053\u308c\u306f\u65e2\u5b58\u306e\u30eb\u30fc\u30bf\u30fc\u306egateway\u30a2\u30c9\u30ec\u30b9\u306e\u78ba\u8a8d\u305f\u3081\u3067\u3059\u3002\u5206\u304b\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u5fc5\u8981\u306a\u3057\u3002<\/p>\n<p><code># uci set network.lan.gateway=192.168.1.1<br \/>\n# uci set network.lan.dns=192.168.1.1<br \/>\n# uci commit network<\/code><\/p>\n<p>192.168.1.1\u306e\u90e8\u5206\u306f\u81ea\u5206\u306eWifi\u30eb\u30fc\u30bf\u30fc\u306eIP address\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>[ DHCP\u3092\u7121\u52b9\u306b\u3059\u308b ]<\/strong><\/p>\n<p>\u65e2\u5b58\u306eWifi\u30eb\u30fc\u30bf\u30fc\u306eDHCP\u3092\u4f7f\u7528\u3057\u307e\u3059\u306e\u3067\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u306eDHCP\u306f\u7121\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><code># uci set dhcp.lan.ignore=1<br \/>\n# uci commit dhcp<\/code><\/p>\n<p><strong>[ firewall\u3092\u8abf\u6574 ]<\/strong><br \/>\n<code># uci set firewall.@zone[0].forward=ACCEPT<br \/>\n# uci set firewall.@zone[0].network=\"lan wwan\"<br \/>\n# uci commit firewall<\/code><\/p>\n<p>\u3053\u3053\u307e\u3067\u306e\u8a2d\u5b9a\u3067\u767d\u3044Ethernet\u30b3\u30cd\u30af\u30bf\u30fc\u306b\u63a5\u7d9a\u3057\u305fPC\u304b\u3089\u65e2\u5b58\u306eWifi\u30eb\u30fc\u30bf\u30fc\u3092\u901a\u3057\u3066\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u63a5\u7d9a\u53ef\u80fd\u3067\u3059\u3002\u5f15\u304d\u7d9a\u304dWifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u3092\u8a2d\u5b9a\u3057\u3001Wifi\u304b\u3089Wifi\u3078\u306e\u30ea\u30d4\u30fc\u30bf\u30fc\u3068\u3057\u3066\u6a5f\u80fd\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>[ Wifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u306e\u8a2d\u5b9a ]<\/strong><br \/>\n<code># uci set wireless.@wifi-iface[1].device=radio0<\/code><br \/>\n\u516c\u5f0f\u30ac\u30a4\u30c9\u3067\u306f\u4e0a\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u30ac\u30a4\u30c9\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001&#8221;uci: Invalid argument&#8221;\u3068\u8a00\u308f\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u6b63\u3057\u3044\u30b3\u30de\u30f3\u30c9\u304c\u5206\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u7de8\u96c6\u3057\u307e\u3057\u305f\u3002<br \/>\n<code># vim \/etc\/config\/wireless<\/code><br \/>\n\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<br \/>\n<code>config wifi-iface<br \/>\n    option device 'radio0'<br \/>\n    option mode 'ap'<br \/>\n    option ssid 'RepeaterWirelessNetwork'<br \/>\n    option encryption 'psk2'<br \/>\n    option key 'RepeaterWirelessPassword'<br \/>\n    option network 'lan'<\/code><br \/>\n&#8216;RepeaterWirelessNetwork&#8217;\u3068&#8217;RepeaterWirelessPassword&#8217;\u306f\u3001\u9069\u5f53\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>[ \u8a2d\u5b9a\u306e\u6709\u52b9\u5316 ]<\/strong><br \/>\n<code>\/etc\/init.d\/dnsmasq restart<br \/>\n\/etc\/init.d\/firewall restart<br \/>\nwifi down; wifi<\/code><\/p>\n<p><strong>[ \u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u306eIP address\u5909\u66f4\u3000]<\/strong><br \/>\n\u308f\u305f\u3057\u306e\u5834\u5408\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u3082\u3057\u65e2\u5b58\u306eWifi\u3068\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u306eIP address\u30b5\u30d6\u30cd\u30c3\u30c8\u304c\u540c\u3058\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u9055\u3046\u30b5\u30d6\u30cd\u30c3\u30c8\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n<code># uci set network.lan.ipaddr=192.168.2.1<br \/>\n# uci commit network<br \/>\n# reboot<\/code><\/p>\n<p><strong>[ \u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u3078\u306e\u30ed\u30b0\u30a4\u30f3 ]<\/strong><br \/>\nWifi\u3001Ethernet\u63a5\u7d9a\u3068\u3082\u306bDHCP\u3067\u65e2\u5b58\u306eWifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u304b\u3089IP Address\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u307e\u3059\u3002\u3053\u306e\u305f\u3081\u3001\u305d\u306e\u307e\u307e\u3067\u306f\u5143\u3005\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u304c\u6301\u3063\u3066\u3044\u308bIP Address\u306b\u306f\u30a2\u30af\u30bb\u30b9\u51fa\u6765\u307e\u305b\u3093\u3002\u308f\u305f\u3057\u306e\u5834\u5408\u306f\uff12\u3064\u306e\u65b9\u6cd5\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n&#8211; PC\u306eIP Address\u3092\u624b\u52d5\u3067\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u306e\u30b5\u30d6\u30cd\u30c3\u30c8\u306b\u5408\u308f\u305b\u3066\u8a2d\u5b9a\u3059\u308b\u3002\u308f\u305f\u3057\u306e\u5834\u5408\u306f192.168.1.10\u306b\u8a2d\u5b9a\u3057\u3066ssh root@192.168.1.1\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n&#8211; \u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u81ea\u8eab\u3082wlan0\u304c\u65e2\u5b58\u306eWifi\u30eb\u30fc\u30bf\u30fc\u304b\u3089DHCP\u3067IP Address\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u306b\u5bfe\u3057\u3066\u5225\u306ePC\u304b\u3089ssh\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002Wifi\u30eb\u30fc\u30bf\u30fc\u306a\u3069\u3067\u9759\u7684\u306bIP Address\u3092\u8a2d\u5b9a\u3067\u304d\u308c\u3070\u3001\u3053\u306e\u65b9\u6cd5\u304c\u7c21\u5358\u3067\u826f\u3044\u3067\u3059\u3002<\/p>\n<p><strong>[ \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9 ]<\/strong><br \/>\n\u6c7a\u3057\u3066\u901f\u3044\u3068\u306f\u8a00\u3048\u307e\u305b\u3093\u304c\u3001\u305d\u308c\u3092\u627f\u77e5\u306e\u4e0a\u3067\u4f7f\u7528\u3059\u308c\u3070\u5b9f\u7528\u7684\u306b\u4f7f\u3046\u3053\u3068\u306f\u51fa\u6765\u307e\u3059\u3002iPod touch\u306eSpeedtest\u3067\u8a66\u3057\u305f\u3068\u3053\u308d\u3001\u76f4\u63a5\u65e2\u5b58\u306eWifi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u306b\u63a5\u7d9a\u3057\u306630Mbps\u304f\u3089\u3044\u51fa\u3066\u3044\u308b\u72b6\u614b\u3067\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u9752\u6625\u7248\u306e\u30ea\u30d4\u30fc\u30bf\u30fc\u304b\u3089\u63a5\u7d9a\u3059\u308b\u306810Mbps\u304f\u3089\u3044\u304c\u9650\u754c\u306e\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u3001\u5c0f\u7c73\u30eb\u30fc\u30bf\u30fc\u9752\u6625\u7248\u3092\u30ea\u30d4\u30fc\u30bf\u30fc\u3068\u3057\u3066\u7c21\u5358\u306b\u69cb\u6210\u3057\u305f\u6642\u306f\u304b\u306a\u308a\u9045\u304f\u3066\u4f7f\u3046\u6c17\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f(\u6570\u5024\u306f\u53d6\u3063\u3066\u3044\u307e\u305b\u3093\u304c)\u3002 \u3082\u3046\u3061\u3087\u3063\u3068\u6539\u5584\u3057\u306a\u3044\u3082\u306e\u304b\u3068relayd\u3092\u4f7f\u7528\u3057\u305f\u69cb\u6210\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u901f\u5ea6\u3082\u3060\u3044\u3076\u30de\u30b7\u306b\u306a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[43,42],"tags":[],"class_list":["post-3868","post","type-post","status-publish","format-standard","hentry","category-wifi","category-42"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/3868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/comments?post=3868"}],"version-history":[{"count":9,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/3868\/revisions"}],"predecessor-version":[{"id":3885,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/3868\/revisions\/3885"}],"wp:attachment":[{"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/media?parent=3868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/categories?post=3868"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/tags?post=3868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}