{"id":3780,"date":"2025-04-12T09:16:32","date_gmt":"2025-04-12T00:16:32","guid":{"rendered":"https:\/\/okamoto3.com\/?p=3780"},"modified":"2025-04-29T08:19:15","modified_gmt":"2025-04-28T23:19:15","slug":"raspi-wifi-router","status":"publish","type":"post","link":"https:\/\/okamoto3.com\/index.php\/2025\/04\/12\/raspi-wifi-router\/3780\/","title":{"rendered":"raspberry pi os wlan0\u3068wlan1\u3067WiFi router\u306e\u3084\u308a\u65b9"},"content":{"rendered":"<p><strong>wlan0\u3092LAN\u5074\u3001wlan1\u3092WAN\u5074<\/strong>\u3068\u3057\u3066router\u4f5c\u308b\u3067\u3002\u306a\u305c\uff1f\u3068\u805e\u304b\u308c\u3066\u3082\u3001\u308f\u3057\u306b\u3082\u308f\u304b\u3089\u3093\u3002<\/p><h2 class=\"wp-block-heading\">\u4f7f\u3046\u30e9\u30ba\u30d1\u30a4<\/h2><p><a href=\"https:\/\/www.raspberrypi.com\/products\/raspberry-pi-3-model-b\/\">raspberry pi 3<\/a><\/p><p>\u7406\u7531\u306f\u6d88\u8cbb\u96fb\u529b\u304c\u6bd4\u8f03\u7684\u5c11\u306a\u3044\u304b\u3089\u3002<\/p><h2 class=\"wp-block-heading\">wan\u5074\u306b\u4f7f\u3046NIC(wlan1)<\/h2><p><a href=\"https:\/\/www.tp-link.com\/jp\/home-networking\/adapter\/tl-wn725n\/\">TP-Link WIFI \u7121\u7ddaLAN \u5b50\u6a5f 11n\/11g\/b \u30c7\u30e5\u30a2\u30eb\u30e2\u30fc\u30c9\u5bfe\u5fdc\u30e2\u30c7\u30eb \u82f1\u8a9e\u30d1\u30c3\u30b1\u30fc\u30b8 TL-WN725N(EU)<\/a><\/p><p>\u7406\u7531\u306f\u5b89\u3044\u304b\u3089\u3002\u3042\u3068\u3001DHCP\u3068\u3057\u3066\u4f7f\u3048\u306a\u3044\u3002\u307b\u3093\u307e\u304b\uff01\uff1f\u3068\u3044\u3046\u3001\u30cd\u30c3\u30c8\u306e\u60c5\u5831\u3092\u4fe1\u3058\u3066wan\u5074\u306b\u3057\u305f\u3002<\/p><h2 class=\"wp-block-heading\">lan\u5074\u306b\u4f7f\u3046NIC(wan0)<\/h2><p><a href=\"https:\/\/www.raspberrypi.com\/products\/raspberry-pi-3-model-b\/\">raspberry pi 3<\/a>\u5185\u81d3\u306e\u3084\u3064<\/p><p>\u7406\u7531\u306fTL-WN725N\u306bdhcp\u5272\u308a\u5f53\u3066\u3088\u3046\u3068\u3057\u305f\u3089\u3001\u3046\u307e\u304f\u52d5\u304b\u306a\u304b\u3063\u305f\u3002<\/p><h2 class=\"wp-block-heading\">\uff2f\uff33\u30d0\u30fc\u30b8\u30e7\u30f3\u78ba\u8a8d<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>lsb_release -a<\/li><\/ul><p>\u308f\u3057\u306e\u3084\u3064<\/p><p class=\"has-pale-cyan-blue-background-color has-background\">Distributor ID: Raspbian<br>Description:&nbsp;&nbsp;&nbsp; Raspbian GNU\/Linux 12 (bookworm)<br>Release:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12<br>Codename:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong> bookworm<\/strong><\/p><h2 class=\"wp-block-heading\">WAN\u5074\u306eWiFi\u306b\u63a5\u7d9a<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo rfkill unblock wifi<\/li>\n\n<li>sudo nmcli radio wifi on<\/li>\n\n<li>sudo nmcli device set wlan1 managed yes<\/li>\n\n<li>sudo nmcli device wifi connect <strong>&#8220;<em>4G-UFI-484<\/em>&#8220;<\/strong> password <strong>&#8220;<em>1234567890<\/em>&#8220;<\/strong> ifname wlan1<\/li><\/ul><p>SSID\uff1a4G-UFI-484\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\uff1a1234567890\u306f\u3054\u81ea\u5206\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p><h2 class=\"wp-block-heading\">\u70b9\u691c<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>nmcli connection show<\/li>\n\n<li>ip a show wlan1<\/li><\/ul><h2 class=\"wp-block-heading\">\u3053\u3053\u304b\u3089\u306f\u3001wlan1\u3092eth0\u306b\u8aad\u307f\u66ff\u3048\u3066\u3082\u3089\u3063\u305f\u3089\u3001wan\u5074\u304c\u6709\u7dda\u306b\u306a\u308a\u307e\u3059\u3002<\/h2><h2 class=\"wp-block-heading\">LAN\u5074\u306e\u8a2d\u5b9a<\/h2><p>(1)open(\u30d1\u30b9\u30ef\u30fc\u30c9\u7121)\u306e\u5834\u5408<\/p><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo nmcli connection add type wifi ifname wlan0 con-name wlan0 autoconnect yes ssid <em><strong>PiWiFi<\/strong><\/em> mode ap<\/li><\/ul><p>(2)\u30d1\u30b9\u30ef\u30fc\u30c9\u4ed8\u304d\u306e\u5834\u5408<\/p><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo nmcli connection add type wifi ifname wlan0 mode ap con-name wlan0 ssid <strong><em>PiWiFi<\/em><\/strong> \\wifi.channel 6 \\wifi-sec.key-mgmt wpa-psk \\wifi-sec.psk raspberry<\/li><\/ul><p>(3)LAN\u5074IP\u306e\u8a2d\u5b9a<\/p><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo nmcli connection modify wlan0 ipv4.addresses <em><strong>192.168.63.1\/24<\/strong><\/em> ipv4.method manual<\/li>\n\n<li>sudo nmcli connection modify wlan0 ipv4.dns <strong>&#8220;<\/strong><strong><em>8.8.8.8 8.8.4.4<\/em><\/strong><strong>&#8220;<\/strong><\/li><\/ul><p>PiWiFi\u3001192.168.63.1\/24\u30848.8.8.8 8.8.4.4\u306e\u90e8\u5206\u306f\u3054\u81ea\u5206\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p><p>(3)\u56fa\u5b9a IP \u3092\u8a2d\u5b9a<\/p><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo nmcli connection modify wlan0 ipv4.addresses <em>192.168.63.1\/24<\/em><\/li>\n\n<li>sudo nmcli connection modify wlan0 ipv4.method manual<\/li><\/ul><p>192.168.63.1\/24\u306e\u90e8\u5206\u306f\u3054\u81ea\u5206\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p><h2 class=\"wp-block-heading\">IP\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u6709\u52b9\u5316<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo apt install nftables(\u7121\u3051\u308c\u3070)<\/li>\n\n<li>sudo sysctl -w net.ipv4.ip_forward=1<\/li>\n\n<li>sudo nano \/etc\/sysctl.conf\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3001\u307e\u305f\u306f\u3001\u30b3\u30e1\u30f3\u30c8\u5916\u3059\u3002<ul class=\"wp-block-list\"><li>net.ipv4.ip_forward=1<\/li><\/ul><\/li>\n\n<li>sudo sysctl -p<\/li><\/ul><h2 class=\"wp-block-heading\">WAN\uff08wlan1\uff09\u304b\u3089LAN\uff08wlan0\uff09\u3078\u30d1\u30b1\u30c3\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo nft add table ip nat<\/li>\n\n<li>sudo nft add chain ip nat POSTROUTING { type nat hook postrouting priority 100 \\; }<\/li>\n\n<li>sudo nft add rule ip nat POSTROUTING oif &#8220;wlan1&#8221; masquerade<\/li><\/ul><h2 class=\"wp-block-heading\">nftables\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo sh -c &#8220;nft list ruleset &gt; \/etc\/nftables.conf&#8221;<\/li>\n\n<li>sudo systemctl enable nftables<\/li><\/ul><h2 class=\"wp-block-heading\">DHCP\u30b5\u30fc\u30d0\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u8a2d\u5b9a<\/h2><ul class=\"wp-block-list has-white-color has-black-background-color has-text-color has-background\"><li>sudo apt install dnsmasq(\u7121\u3051\u308c\u3070)<\/li>\n\n<li>sudo nano \/etc\/dnsmasq.conf(\u4ee5\u4e0b\u306e\u884c\u3092\u8ffd\u8a18)<ul class=\"wp-block-list\"><li>interface=wlan0<\/li>\n\n<li>dhcp-range=<em><strong>192.168.63.2,192.168.63.100,255.255.255.0,24h<\/strong><\/em><\/li><\/ul><\/li>\n\n<li>sudo systemctl restart dnsmasq<\/li><\/ul><p>192.168.63.2,192.168.63.100,255.255.255.0,24h\u306e\u90e8\u5206\u306f\u3001\u3054\u81ea\u5206\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p><h2 class=\"wp-block-heading\">wifi\u306b\u3064\u306a\u304c\u308c\u3070OK!<\/h2><p>\u304a\u75b2\u308c\u3055\u307e\u3067\u3057\u305f\u3002<\/p><p>ssh\u3067\u3064\u306a\u3044\u3067\u305f\u3089\u5207\u308c\u3061\u3083\u3044\u307e\u3059\u3002<\/p><h2 class=\"wp-block-heading\">\u95a2\u9023\u8a18\u4e8b<\/h2><p>country=JP<\/p><figure class=\"wp-block-embed is-type-wp-embed is-provider-sgg-039-s wp-block-embed-sgg-039-s\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"FeViOXamFH\"><a href=\"https:\/\/okamoto3.com\/index.php\/2025\/04\/27\/wlan0-down\/3790\/\">wlan0 state DOWN<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;wlan0 state DOWN&#8221; &#8212; sGG&#039;s\" src=\"https:\/\/okamoto3.com\/index.php\/2025\/04\/27\/wlan0-down\/3790\/embed\/#?secret=8WZ1FrX3j9#?secret=FeViOXamFH\" data-secret=\"FeViOXamFH\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure><figure class=\"wp-block-embed is-type-wp-embed is-provider-sgg-039-s wp-block-embed-sgg-039-s\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"KgcvJw3q9l\"><a href=\"https:\/\/okamoto3.com\/index.php\/2024\/06\/01\/4glte-usb-modem-zerodis\/3516\/\">\u6fc0\u5b89 \u4e2d\u83ef 4G LTE USB\u30e2\u30c7\u30e0 Zerodis rvyt7c2udf<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u6fc0\u5b89 \u4e2d\u83ef 4G LTE USB\u30e2\u30c7\u30e0 Zerodis rvyt7c2udf&#8221; &#8212; sGG&#039;s\" src=\"https:\/\/okamoto3.com\/index.php\/2024\/06\/01\/4glte-usb-modem-zerodis\/3516\/embed\/#?secret=sbEzTbazJF#?secret=KgcvJw3q9l\" data-secret=\"KgcvJw3q9l\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><figcaption class=\"wp-element-caption\">wan\u5074\u306b\u3064\u3044\u3066<\/figcaption><\/figure><p>\u4ee5\u4e0a\u3002<\/p><hr class=\"wp-block-separator has-css-opacity\"\/><div class=\"wp-block-image is-style-rounded\"><figure class=\"aligncenter size-thumbnail\"><a href=\"https:\/\/youtube.com\/user\/hishigeki3\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=150%2C150&#038;ssl=1\" alt=\"\" class=\"wp-image-658\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=100%2C100&amp;ssl=1 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption class=\"wp-element-caption\">\u3088\u308d\u3057\u3051\u308c\u3070\u30c1\u30e3\u30f3\u30cd\u30eb\u767b\u9332\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u7533\u3057\u4e0a\u3052\u307e\u3059\uff01<\/figcaption><\/figure><\/div><hr class=\"wp-block-separator has-css-opacity\"\/>","protected":false},"excerpt":{"rendered":"<p>wlan0\u3092LAN\u5074\u3001wlan1\u3092WAN\u5074\u3068\u3057\u3066router\u4f5c\u308b\u3067\u3002\u306a\u305c\uff1f\u3068\u805e\u304b\u308c\u3066\u3082\u3001\u308f\u3057\u306b\u3082\u308f\u304b\u3089\u3093\u3002 \u4f7f\u3046\u30e9\u30ba\u30d1\u30a4 raspberry pi 3 \u7406\u7531\u306f\u6d88\u8cbb\u96fb\u529b\u304c\u6bd4\u8f03\u7684\u5c11\u306a\u3044\u304b\u3089\u3002 wan\u5074\u306b\u4f7f\u3046NIC(wlan1&hellip; <a class=\"more-link\" href=\"https:\/\/okamoto3.com\/index.php\/2025\/04\/12\/raspi-wifi-router\/3780\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">raspberry pi os wlan0\u3068wlan1\u3067WiFi router\u306e\u3084\u308a\u65b9<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3784,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[286,23,135,213],"tags":[],"class_list":["post-3780","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-4g-lte-usb-modem","category-raspberry-pi","category-memorandum","category-all-articles","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2025\/04\/1000001756.jpg?fit=119%2C119&ssl=1","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/3780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/comments?post=3780"}],"version-history":[{"count":7,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/3780\/revisions"}],"predecessor-version":[{"id":3796,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/3780\/revisions\/3796"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media\/3784"}],"wp:attachment":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media?parent=3780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/categories?post=3780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/tags?post=3780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}