用Raspberry Pi 做WiFi Access Point (Dump AP) #2

Wan Leung Wong
Mar 7 · 5 min read

上回講到怎樣選合適的Pi 及天線, 今回就SETUP DUMP AP.

以下的Scenario, 係以Raspberry Pi 3B 及 TP-Link AC600 USB2.0 天線為主. Pi 3B 內置的天線, 就做UUID名為TESTNETWORK 的 2.4Ghz NETWORK, 而支USB天線, 就做為UUID名為TESTNETWORK_5G的 5GHz NETWORK.

首先, 要幫隻Pi 安裝OS. 現在Raspberry Pi 提供了一個簡單的軟件, 可幫閣下方便地製作Pi OS的SD CARD. 叫rpi-imager, 有WINDOWS, MAC 及 LINUX 版本. LINK 如下:

安裝完後執行如下圖

選擇要安裝的OS, 本人選Pi OS Lite (32Bit) 版.

之後選好SD卡後, 就按WRITE字. 等完成放入Pi 就可用.

先用raspi-config setup好Pi基本config, 如locale, ssh等.

之後可以按住這篇文的設定.

首先安裝hostapd 這個AP的軟件.

之後, 用以下SETTING以在BOOT時可自動啟動hostapd

之後, 需要SET 個BRIDGE NETWORK br0 以做到類似SWITCH的效果.

執行以上指令新增bridge , 以新加br0,

sudo vi /etc/systemd/network/bridge-br0.netdev

加入以下內容:

然後將eth0 加入br0, 用以下指令新增把eth0加入br0的FILE

加入以下內容:

之後執行這句, 以執行BRIDGE NETWORK的SETTING

之後, 我們就要SET dhcpcd, 設定為只能經br0取得IP, 執行以下指令以修改dhcpcd config.

在file尾, interface eth0這句之前, 加入:

若要支援多一條天線的, 就用這句:

然後將下面interface一句, 修改成以下這句, 若前面有#, 請刪除#:

之後就完成SET BRIDGE NETWORK的PROCESS.

接著, 就SETUP 第一隻AP.

首先, 執行此句, 此make sure Pi OS無Block 到WIFI DEVICE:

之後, 執行以下指令以新增hostapd的config:

加入以下內客:

ssid為TestingNetwork, password 為 TestingNetworkPassword.

hw_mode=g 為802.11g 2.4GHz. interface 為 wlan0.

之後REBOOT, 就完成.

下回, 會繼續SETUP外置USB天線.

Hong Kong Linux User Group

香港LINUX用家協會

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store