라즈베리파이 이미지중 Raspberry Pi OS Lite 를 설치하고 진행한다.
필수 패키지 설치
apt install -y hostapd apt install -y dnsmasq
설정파일
interface=wlan1 driver=nl80211 ssid=jongwan hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
/etc/hostapd/hostapd.conf
interface=wlan1 dhcp-range=192.168.10.2,192.168.10.20,255.255.255.0,24h domain=wlan address=/gw.wlan/192.168.10.1
/etc/dnsmasq.conf
# 아래 내용 추가 interface wlan1 static ip_address=192.168.10.1/24 nohook wpa_supplicant
/etc/dhcpcd.conf
# 아래 주석 해제 #net.ipv4.ip_forward=1
/etc/sysctl.conf
root@raspberrypi:/# sysctl -p net.ipv4.ip_forward = 1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
서비스 실행
systemctl unmask hostapd systemctl enable hostapd systemctl start hostapd systemctl enable dnsmasq systemctl start dnsmasq