Turning a Raspberry Pi into a wireless LAN router ~Bridge mode edition~: Playing with a business card-sized ultra-compact PC "Raspberry Pi" (Part 25)
If you use an internet connection at home, you probably have a wireless LAN router installed. Some of you may have rented from a provider or got a product recommended by a consumer electronics retailer or word-of-mouth site, but did you know that you can make such a wireless router with a Raspberry Pi?
Last time, I introduced how to turn the Raspberry Pi into a wireless LAN router and connect Wi-Fi compatible devices, but if you already have a wireless LAN router installed at home, you will have to build it with a different network address, so file Devices that were connected to the original network, such as servers, will no longer be accessible. So this time, let's introduce how to set up in bridge mode so that you can connect to the same address space.
It is OK to follow the previous procedure, but you will need "bridge-utils" to bridge the wireless LAN and wired LAN. Also, last time I configured DNS with "dnsmasq", but this time I don't need the DNS function, so I won't install it.
The procedure is as follows.
Let's explain later.
Installation and configuration of bridge-utils
First, use the command below to install the tools to create a bridge.
$ sudo apt install bridge-utils
Next, change the settings of "/etc/network/interfaces".
After entering$ sudo nano /etc/network/interfaces
to open the configuration file, add the following content to the last line.
auto br0iface br0 inet dhcpbridge_ports eth0 wlan0
After setting, check if it is recognized with the "brctl" command.
$ brctl showbridge namebridge idSTP enabledinterfacesbr0 8000.************ noeth0wlan0
If it is displayed as above, it is recognized.
Installing and setting up hostapd
This is almost the same as the previous flow, but the contents of using the bridge are described in the setting file.
$ sudo apt install hostapd
After installing hostapd by entering this command, create the configuration file "hostapd.conf" with the standard editor nano.
$ sudo nano /etc/hostapd/hostapd.conf
This time the contents are as follows. Add the entry "bridge=br0". For other items, please refer to the previous post.
interface=wlan0bridge=br0 ← Added driver=nl80211hw_mode=bchannel=1macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0ieee80211ac=0wmm_enabled=1ieee80211d=1country_code=JPieee80211h=1local_pwr_constraint=3spectrum_mgmt_required= 1wpa=3wpa_key_mgmt=WPA-PSKssid=raspi_bridgewpa_passphrase=**** **
Save the file with Ctrl + x, "y", Enter. Then edit the hostapd default action file.
$ sudo nano /etc/default/hostapd
As before, change "#DAEMON_CONF=""" in the items displayed here as follows. Also remove the "#" at the beginning.
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Although hostapd is masked, it will not start automatically in most cases. Therefore, enter the following command to remove the mask.
$ sudo systemctl unmask hostapd$ sudo systemctl enable hostapd$ sudo systemctl start hostapd
You can check that the service has started by typing "sudo systemctl status hostapd".
Now that the settings have been completed, let's restart the Raspberry Pi.
$ sudo reboot
After rebooting, you can find the access point with the set SSID.
You can see the set SSID "raspi_bridge"To read more, you need to agree to the terms of use for comments and register for "ITmedia ID" and "ITmedia NEWS Anchor Desk Magazine" is