If you are using Internet lines at home, you will often have a wireless LAN router.You may have rented it from a provider or have a product recommended by a consumer electronics retailer or word -of -mouth site, but you know that you can handmade such a wireless LAN router with raspberry pie.
This time, I will introduce the procedure to operate Raspberry Pi as a wireless LAN router.In addition, it is necessary to install the OS "Raspbian" for rasp pie.See the 21st article for the procedure.
The rasp pie's wireless LAN router will follow the following steps.
By installing these settings and additional programs, connect the modem to the raspberry pie wired LAN and connect the Wi-Fi device to the network with a wireless LAN.Let's look in order.
First is the DHCPCD setting.DHCPCD is a service for obtaining a host's IP address, net mask, broadcast address from the DHCP server and set it to raspberry pie.This time, in order to use a different address space to the wireless LAN side, set a different address space assigned to the modem or wireless LAN router currently used.
Since the configuration file is changed, stop the service once.
$ sudo systemctl stop dhcpcd
Start nano with the following command to correct the file.
$ sudo nano /etc/dhcpcd.conf
When the file is open, add the following items at the end.
interface wlan0static ip_address=192.168.2.1/24
This setting, but in my environment, "192.168.1.The device to be connected to the router in the address space of the router you are currently using is "192".168.1.The IP address "XXX" is assigned.For this reason, "192" so that it does not overlap..168.2.The address space starting from "1" is set.This differs in each environment, so please read and set.Once added, restart DHCPCD with the following command.
$ sudo systemctl restart dhcpcd
Next, install "HostApd", which is the access point of the router.Enter the following command.
$ sudo apt install hostapd
After installing, set the hostapd.First, "hostapd" in the configuration file.Create Conf "with nano.
$ sudo nano /etc/hostapd/hostapd.conf
Next, when the blank file is displayed, enter the following items:
interface=wlan0driver=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=raspiwpa_passphrase=******
I will explain each of the above.
Define the interface to be connected.This time, it will be "WLAN0" because the wireless LAN side of Raspberry Pi is used.
It is a driver of the wireless LAN interface used for connection.
It is a frequency band to use."B" is IEEE 802.11b, "G" is IEEE 802.11g, "A" is IEEE 802.It will be 11a.This time IEEE 802.Since 11b is used, set it to "B".
It is a channel to use.If you already have a wireless LAN router, check the channels you are currently using with tools such as "Wifi Analyzer" and set them not to interfere.
It is filtering with a MAC address, but here (0) is set.
Authentication algorithm."1" when using WPA, "2" for WEP, "3" when using both, and "0" for no encryption.This time I will use WPA.
It is a setting to prevent SSID from referring to a third party.This time, I will turn it off (0).
IEEE 802.Whether to enable 11ac.Since it is not set this time, set "0".
Set to WMM (WME) and QOS control standards.This time, it is "1" to enable it.
IEEE 802.11d and IEEE 802.It is a standard setting called 11h, which performs output control in accordance with national regulations.Both are "1" because they are enabled.
Since it is used in Japan, it is JP.
It is a setting about the output of wireless LAN.
Set the WPA version to use.WPA is "1", WPA2 is "2", and "3" when using both.
This is a shared key authentication method used.
It is an encryption method used.
This is the SSID used.Here, it is "Raspi", but let's decide and enter it.
Decide the password when connecting.Passwords can be set between 8 and 64 characters.
Next, edit the HostApd default operation file.Enter the following and start nano.
$ sudo nano /etc/default/hostapd
Change "#Daemon_conf =" "" in the displayed item as follows.Delete the first "#".
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Make sure that HostAPD is running here.
$ sudo systemctl status hostapd
In most cases, the following message is displayed and you can see that it has not worked.
● hostapd.serviceLoaded: masked (Reason: Unit hostapd.service is masked.)Active: inactive (dead)
In such a case, enter the following command to remove the mask and restart.
sudo systemctl unmask hostapdsudo systemctl enable hostapdsudo systemctl start hostapd
Enter "Sudo SystemCTL Status Hostapd" again to check the start of the service.
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP AuthentLoaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset:Active: active (running) since Thu 2020-07-30 10:29:04 JST; 6s ago………………
This time, to set a port -forward function (passing the packet to any device) with Raspberry Pi, "/etc/sysctl".Edit "Conf".
$ sudo nano /etc/sysctl.conf
When the file is displayed as, delete the " #" at the top of the following line.
net.ipv4.ip_forward=1dnsmasqのインストールと設定1|2次のページへ
To read more, you need to agree to the terms of use and register "ITMEDIA NEWS Anchor Desk Magazine".
Category
Related Articles
Hot Articles