코드 잡동사니

Raspberry pi AP 무선 네트워크 환경 만들기 본문

데비안_라즈비안/라즈베리파이3

Raspberry pi AP 무선 네트워크 환경 만들기

세객 2019. 2. 8. 14:30

라즈베리파이 무선랜 환경 구축하기

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y dnsmasq hostapd
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
sudo reboot

sudo vim /etc/dhcpcd.conf
> interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

sudo service dhcpcd restart
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
cd /etc
sudo cat > dnsmasq.conf << "EOF" \
interface=wlan0      # Use the require wireless interface - usually wlan0 \
  dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h \
EOF

cd /etc/hostapd
sudo cat > hostapd.conf << "EOF \
interface=wlan0 \
driver=nl80211 \
ssid=NameOfNetwork \
hw_mode=g \
channel=7 \
wmm_enabled=0 \
macaddr_acl=0 \
auth_algs=1 \
ignore_broadcast_ssid=0 \
wpa=2 \
wpa_passphrase=AardvarkBadgerHedgehog \
wpa_key_mgmt=WPA-PSK \
wpa_pairwise=TKIP \
rsn_pairwise=CCMP \
EOF

sudo vim /etc/default/hostapd
> DAEMON_CONF="/etc/hostapd/hostapd.conf"

sudo systemctl start hostapd
sudo systemctl start dnsmasq
sudo vim /etc/sysctl.conf
> net.ipv4.ip_forward=1 #주석 해제

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

sudo vim /etc/rc.local
#exit 0 위에 작성
iptables-restore < /etc/iptables.ipv4.nat

reboot
https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md


Comments