Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축
                                            
                                                
                                                
                                                
                                                
                                                
                                                 4996 단어  가정 내 LANRaspberryPi4무선랜CentOS
                    
네트워크 구성은 다음과 같습니다. 인터넷은 EdgeRouterX를 통해 연결되며 LAN 측 게이트웨이의 주소는
192.168.3.1입니다. 또한 이 인터페이스에서는 DHCP 및 DNS 서비스가 작동합니다.이번에는 CentOS의 가상 브리지를 이용하여 EdgeRouterX에서 나오는
192.168.3.0/24 네트워크를 그대로 무선 LAN 측에 연결하고 있습니다.
부팅용 SD 만들기
armv7 용 CentOS7 이미지를 다운로드하여 부팅 SD 카드에 씁니다.
SD 카드는 작업용 PC에 삽입되어 있고/dev/sdd에서 인식됩니다. 이 근처는 적절히 읽어 주세요. (마운트되어 있으면 실패하므로 언마운트 해 둡니다)
$ wget https://people.centos.org/pgreco/images/forrpi4v2/CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-exp4-1810-sda.raw.xz
$ tar xf CentOS-Userland-7-arm7hl-RaspberryPI-Minimal-exp4-1810-sda.raw.xz
$ sudo dd bs=4M if=CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-exp4-1810-sda.raw of=/dev/sdd conv=fsync status=progress
 네트워크 초기 설정
SD 카드를 Raspberry Pi 4에 넣고 전원을 켠 후 잠시 기다리면 DHCP에서 IP 주소를 얻고 루트로 SSH 로그인을 할 수 있습니다. 초기 암호는 centos입니다. IP 주소는 라우터의 로그 등에서 적절하게 조사합니다.
$ ssh [email protected]
[root@localhost ~]# passwd     # root パスワードの変更
[root@localhost ~]# hostnamectl set-hostname rpap     # ホスト名の変更
[root@localhost ~]# timedatectl set-timezone Asia/Tokyo     # タイムゾーンの設定
[root@localhost ~]# systemctl stop firewalld          # firewalld を無効にする
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# vi /etc/sysconfig/selinux         # selinux を無効にする
    -SELINUX=enforcing
    +SELINUX=disabled
[root@localhost ~]# vi /etc/NetworkManager/NetworkManager.conf     # DNSの自動設定を無効にする
    +dns=none     # [main]セクションの中に追記
[root@localhost ~]# vi /etc/resolv.conf     # DNSの設定
    -# Generated by NetworkManager
    +nameserver 192.168.3.1
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-br0     # 新規作成
    +NAME=br0
    +DEVICE=br0
    +TYPE=Bridge
    +BOOTPROTO=static
    +ONBOOT=yes
    +IPADDR=192.168.3.2
    +NETMASK=255.255.255.0
    +NETWORK=192.168.3.0
    +GATEWAY=192.168.3.1
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0     # 新規作成
    +NAME=eth0
    +DEVICE=eth0
    +TYPE=Ethernet
    +BOOTPROTO=static
    +ONBOOT=yes
    +BRIDGE=br0
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-wlan0     # 無線LANインタフェースの設定を新規作成
    +NAME=wlan0
    +DEVICE=wlan0
    +TYPE=Ethernet
    +BOOTPROTO=static
    +ONBOOT=yes
    +BRIDGE=br0
 MAC 주소 랜덤화 비활성화
CentOS7의 NetworkManager는 무선 LAN 클라이언트의 위치 추적을 어렵게 하기 때문에 주기적으로 무선 LAN 인터페이스의 MAC 주소를 변경하는 기능이 기본적으로 활성화되어 있습니다.
AP로 작동할 때 이 기능을 활성화하면 변경 시점에 연결이 끊어지므로 비활성화합니다.
[root@localhost ~]# vi /etc/NetworkManager/conf.d/30-no-mac-randomization.conf
   +[device-mac-randomization]
   +wifi.scan-rand-mac-address=no
 필요한 패키지 추가
[root@localhost ~]# yum -y install iptables-services bridge-utils net-tools bind-utils tcpdump wget
 무선 LAN 인터페이스의 설정 파일 취득
[root@localhost ~]# wget -O /usr/lib/firmware/brcm/brcmfmac43455-sdio.txt https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt
 hostapd 설치
[root@localhost ~]# vi /etc/yum.repos.d/epel.repo     # 新規作成
    +[epel]
    +name=Epel rebuild for armhfp
    +baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
    +enabled=1
    +gpgcheck=0
[root@localhost ~]# yum -y install wireless-tools hostapd
[root@localhost ~]# mv /etc/hostapd/hostapd.conf .     # バックアップ
[root@localhost ~]# vi /etc/hostapd/hostapd.conf       # 新規作成
    +ctrl_interface=/var/run/hostapd
    +ctrl_interface_group=wheel
    +macaddr_acl=0
    +auth_algs=1
    +ignore_broadcast_ssid=0
    +wpa=2
    +wpa_key_mgmt=WPA-PSK
    +rsn_pairwise=CCMP
    +wpa_passphrase=hogehoge
    +driver=nl80211
    +interface=wlan0
    +bridge=br0
    +hw_mode=g
    +channel=1
    +ssid=ore_no_musen_lan
    +country_code=JP
    +ieee80211d=1
[root@localhost ~]# systemctl enable hostapd
 무선 LAN 전원 관리 비활성화
무선 LAN의 전원 관리가 활성화되어 있으면 부팅 후 시간이 경과하면 성능이 저하되므로 이를 비활성화합니다. hostapd가 시작될 때 무효화됩니다.
[root@localhost ~]# vi /usr/lib/systemd/system/hostapd.service
    +ExecStartPost=/sbin/iw dev wlan0 set power_save off
 가상 브리지를 통과하는 패킷에 iptables 적용
CentOS 7의 기본적으로 가상 브리지를 통과하는 패킷에는 iptables 규칙이 적용되지 않으므로 변경합니다.
[root@localhost ~]# /etc/sysconfig/modules/br_netfilter.modules
    +#!/bin/sh
    +/sbin/modprobe br_netfilter >/dev/null 2>&1
[root@localhost ~]# chmod 755 /etc/sysconfig/modules/br_netfilter.modules
이제 iptables FORWARD 체인 규칙이 적용됩니다.
 재부팅
[root@localhost ~]# shutdown -r now
잠시 기다리면 SSID가 ore_no_musen_lan인 액세스 포인트가 나옵니다.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/bobunderson/items/389ca640745ef009c54a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
$ wget https://people.centos.org/pgreco/images/forrpi4v2/CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-exp4-1810-sda.raw.xz
$ tar xf CentOS-Userland-7-arm7hl-RaspberryPI-Minimal-exp4-1810-sda.raw.xz
$ sudo dd bs=4M if=CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-exp4-1810-sda.raw of=/dev/sdd conv=fsync status=progress
SD 카드를 Raspberry Pi 4에 넣고 전원을 켠 후 잠시 기다리면 DHCP에서 IP 주소를 얻고 루트로 SSH 로그인을 할 수 있습니다. 초기 암호는
centos입니다. IP 주소는 라우터의 로그 등에서 적절하게 조사합니다.$ ssh [email protected]
[root@localhost ~]# passwd     # root パスワードの変更
[root@localhost ~]# hostnamectl set-hostname rpap     # ホスト名の変更
[root@localhost ~]# timedatectl set-timezone Asia/Tokyo     # タイムゾーンの設定
[root@localhost ~]# systemctl stop firewalld          # firewalld を無効にする
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# vi /etc/sysconfig/selinux         # selinux を無効にする
    -SELINUX=enforcing
    +SELINUX=disabled
[root@localhost ~]# vi /etc/NetworkManager/NetworkManager.conf     # DNSの自動設定を無効にする
    +dns=none     # [main]セクションの中に追記
[root@localhost ~]# vi /etc/resolv.conf     # DNSの設定
    -# Generated by NetworkManager
    +nameserver 192.168.3.1
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-br0     # 新規作成
    +NAME=br0
    +DEVICE=br0
    +TYPE=Bridge
    +BOOTPROTO=static
    +ONBOOT=yes
    +IPADDR=192.168.3.2
    +NETMASK=255.255.255.0
    +NETWORK=192.168.3.0
    +GATEWAY=192.168.3.1
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0     # 新規作成
    +NAME=eth0
    +DEVICE=eth0
    +TYPE=Ethernet
    +BOOTPROTO=static
    +ONBOOT=yes
    +BRIDGE=br0
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-wlan0     # 無線LANインタフェースの設定を新規作成
    +NAME=wlan0
    +DEVICE=wlan0
    +TYPE=Ethernet
    +BOOTPROTO=static
    +ONBOOT=yes
    +BRIDGE=br0
MAC 주소 랜덤화 비활성화
CentOS7의 NetworkManager는 무선 LAN 클라이언트의 위치 추적을 어렵게 하기 때문에 주기적으로 무선 LAN 인터페이스의 MAC 주소를 변경하는 기능이 기본적으로 활성화되어 있습니다.
AP로 작동할 때 이 기능을 활성화하면 변경 시점에 연결이 끊어지므로 비활성화합니다.
[root@localhost ~]# vi /etc/NetworkManager/conf.d/30-no-mac-randomization.conf
   +[device-mac-randomization]
   +wifi.scan-rand-mac-address=no
 필요한 패키지 추가
[root@localhost ~]# yum -y install iptables-services bridge-utils net-tools bind-utils tcpdump wget
 무선 LAN 인터페이스의 설정 파일 취득
[root@localhost ~]# wget -O /usr/lib/firmware/brcm/brcmfmac43455-sdio.txt https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt
 hostapd 설치
[root@localhost ~]# vi /etc/yum.repos.d/epel.repo     # 新規作成
    +[epel]
    +name=Epel rebuild for armhfp
    +baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
    +enabled=1
    +gpgcheck=0
[root@localhost ~]# yum -y install wireless-tools hostapd
[root@localhost ~]# mv /etc/hostapd/hostapd.conf .     # バックアップ
[root@localhost ~]# vi /etc/hostapd/hostapd.conf       # 新規作成
    +ctrl_interface=/var/run/hostapd
    +ctrl_interface_group=wheel
    +macaddr_acl=0
    +auth_algs=1
    +ignore_broadcast_ssid=0
    +wpa=2
    +wpa_key_mgmt=WPA-PSK
    +rsn_pairwise=CCMP
    +wpa_passphrase=hogehoge
    +driver=nl80211
    +interface=wlan0
    +bridge=br0
    +hw_mode=g
    +channel=1
    +ssid=ore_no_musen_lan
    +country_code=JP
    +ieee80211d=1
[root@localhost ~]# systemctl enable hostapd
 무선 LAN 전원 관리 비활성화
무선 LAN의 전원 관리가 활성화되어 있으면 부팅 후 시간이 경과하면 성능이 저하되므로 이를 비활성화합니다. hostapd가 시작될 때 무효화됩니다.
[root@localhost ~]# vi /usr/lib/systemd/system/hostapd.service
    +ExecStartPost=/sbin/iw dev wlan0 set power_save off
 가상 브리지를 통과하는 패킷에 iptables 적용
CentOS 7의 기본적으로 가상 브리지를 통과하는 패킷에는 iptables 규칙이 적용되지 않으므로 변경합니다.
[root@localhost ~]# /etc/sysconfig/modules/br_netfilter.modules
    +#!/bin/sh
    +/sbin/modprobe br_netfilter >/dev/null 2>&1
[root@localhost ~]# chmod 755 /etc/sysconfig/modules/br_netfilter.modules
이제 iptables FORWARD 체인 규칙이 적용됩니다.
 재부팅
[root@localhost ~]# shutdown -r now
잠시 기다리면 SSID가 ore_no_musen_lan인 액세스 포인트가 나옵니다.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/bobunderson/items/389ca640745ef009c54a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
[root@localhost ~]# vi /etc/NetworkManager/conf.d/30-no-mac-randomization.conf
   +[device-mac-randomization]
   +wifi.scan-rand-mac-address=no
[root@localhost ~]# yum -y install iptables-services bridge-utils net-tools bind-utils tcpdump wget
무선 LAN 인터페이스의 설정 파일 취득
[root@localhost ~]# wget -O /usr/lib/firmware/brcm/brcmfmac43455-sdio.txt https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt
 hostapd 설치
[root@localhost ~]# vi /etc/yum.repos.d/epel.repo     # 新規作成
    +[epel]
    +name=Epel rebuild for armhfp
    +baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
    +enabled=1
    +gpgcheck=0
[root@localhost ~]# yum -y install wireless-tools hostapd
[root@localhost ~]# mv /etc/hostapd/hostapd.conf .     # バックアップ
[root@localhost ~]# vi /etc/hostapd/hostapd.conf       # 新規作成
    +ctrl_interface=/var/run/hostapd
    +ctrl_interface_group=wheel
    +macaddr_acl=0
    +auth_algs=1
    +ignore_broadcast_ssid=0
    +wpa=2
    +wpa_key_mgmt=WPA-PSK
    +rsn_pairwise=CCMP
    +wpa_passphrase=hogehoge
    +driver=nl80211
    +interface=wlan0
    +bridge=br0
    +hw_mode=g
    +channel=1
    +ssid=ore_no_musen_lan
    +country_code=JP
    +ieee80211d=1
[root@localhost ~]# systemctl enable hostapd
 무선 LAN 전원 관리 비활성화
무선 LAN의 전원 관리가 활성화되어 있으면 부팅 후 시간이 경과하면 성능이 저하되므로 이를 비활성화합니다. hostapd가 시작될 때 무효화됩니다.
[root@localhost ~]# vi /usr/lib/systemd/system/hostapd.service
    +ExecStartPost=/sbin/iw dev wlan0 set power_save off
 가상 브리지를 통과하는 패킷에 iptables 적용
CentOS 7의 기본적으로 가상 브리지를 통과하는 패킷에는 iptables 규칙이 적용되지 않으므로 변경합니다.
[root@localhost ~]# /etc/sysconfig/modules/br_netfilter.modules
    +#!/bin/sh
    +/sbin/modprobe br_netfilter >/dev/null 2>&1
[root@localhost ~]# chmod 755 /etc/sysconfig/modules/br_netfilter.modules
이제 iptables FORWARD 체인 규칙이 적용됩니다.
 재부팅
[root@localhost ~]# shutdown -r now
잠시 기다리면 SSID가 ore_no_musen_lan인 액세스 포인트가 나옵니다.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/bobunderson/items/389ca640745ef009c54a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
[root@localhost ~]# wget -O /usr/lib/firmware/brcm/brcmfmac43455-sdio.txt https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt
[root@localhost ~]# vi /etc/yum.repos.d/epel.repo     # 新規作成
    +[epel]
    +name=Epel rebuild for armhfp
    +baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
    +enabled=1
    +gpgcheck=0
[root@localhost ~]# yum -y install wireless-tools hostapd
[root@localhost ~]# mv /etc/hostapd/hostapd.conf .     # バックアップ
[root@localhost ~]# vi /etc/hostapd/hostapd.conf       # 新規作成
    +ctrl_interface=/var/run/hostapd
    +ctrl_interface_group=wheel
    +macaddr_acl=0
    +auth_algs=1
    +ignore_broadcast_ssid=0
    +wpa=2
    +wpa_key_mgmt=WPA-PSK
    +rsn_pairwise=CCMP
    +wpa_passphrase=hogehoge
    +driver=nl80211
    +interface=wlan0
    +bridge=br0
    +hw_mode=g
    +channel=1
    +ssid=ore_no_musen_lan
    +country_code=JP
    +ieee80211d=1
[root@localhost ~]# systemctl enable hostapd
무선 LAN 전원 관리 비활성화
무선 LAN의 전원 관리가 활성화되어 있으면 부팅 후 시간이 경과하면 성능이 저하되므로 이를 비활성화합니다. hostapd가 시작될 때 무효화됩니다.
[root@localhost ~]# vi /usr/lib/systemd/system/hostapd.service
    +ExecStartPost=/sbin/iw dev wlan0 set power_save off
 가상 브리지를 통과하는 패킷에 iptables 적용
CentOS 7의 기본적으로 가상 브리지를 통과하는 패킷에는 iptables 규칙이 적용되지 않으므로 변경합니다.
[root@localhost ~]# /etc/sysconfig/modules/br_netfilter.modules
    +#!/bin/sh
    +/sbin/modprobe br_netfilter >/dev/null 2>&1
[root@localhost ~]# chmod 755 /etc/sysconfig/modules/br_netfilter.modules
이제 iptables FORWARD 체인 규칙이 적용됩니다.
 재부팅
[root@localhost ~]# shutdown -r now
잠시 기다리면 SSID가 ore_no_musen_lan인 액세스 포인트가 나옵니다.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/bobunderson/items/389ca640745ef009c54a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
[root@localhost ~]# vi /usr/lib/systemd/system/hostapd.service
    +ExecStartPost=/sbin/iw dev wlan0 set power_save off
CentOS 7의 기본적으로 가상 브리지를 통과하는 패킷에는 iptables 규칙이 적용되지 않으므로 변경합니다.
[root@localhost ~]# /etc/sysconfig/modules/br_netfilter.modules
    +#!/bin/sh
    +/sbin/modprobe br_netfilter >/dev/null 2>&1
[root@localhost ~]# chmod 755 /etc/sysconfig/modules/br_netfilter.modules
이제 iptables FORWARD 체인 규칙이 적용됩니다.
재부팅
[root@localhost ~]# shutdown -r now
잠시 기다리면 SSID가 ore_no_musen_lan인 액세스 포인트가 나옵니다.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/bobunderson/items/389ca640745ef009c54a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
[root@localhost ~]# shutdown -r now
Reference
이 문제에 관하여(Raspberry Pi 4 및 CentOS 7에서 무선 LAN 액세스 포인트 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/bobunderson/items/389ca640745ef009c54a텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)