티스토리 뷰

728x90

Raspberry PI -무선랜카드 AP모드로 사용하기

출처 : Using your new Raspberry Pi 3 as a WiFi access point with hostapd
라즈베리파이 활용강좌 : 라즈베리파이를 무선공유기(AP)로 활용하기 |
SETTING UP A RASPBERRY PI AS AN ACCESS POINT IN A STANDALONE NETWORK

최신으로 업데이트

$ sudo apt-get update;sudo apt-get upgrade -y

AP 관련 패키지 설치

$ sudo apt-get install hostapd bridge-utils iw
$ sudo apt-get install dnsmasq

wlan0 고정 아이피 설정

$ sudo vi /etc/dhcpcd.conf

아래 내용 하단에 추가

denyinterfaces wlan0

Network 설정 파일 백업하고 수정

$ sudo cp /etc/network/interfaces /etc/network/interfaces.bak
$ sudo vi /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.0.255
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

wlan 다시 시작

$ sudo service dhcpcd restart
$ sudo ifdown wlan0
$ sudo ifup wlan0

DHCP 서버 설정

$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
$ sudo vi /etc/dnsmasq.conf

interface=wlan0      # Use interface wlan0
listen-address=192.168.0.1 # Explicitly specify the address to listen on
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere
server=8.8.8.8       # Forward DNS requests to Google DNS
domain-needed        # Don't forward short names
bogus-priv           # Never forward addresses in the non-routed address spaces.
dhcp-range=192.168.0.2,192.168.0.20,255.255.255.0,24h # Assign IP addresses between 192.168.0.2 and 192.168.0.20 with a 24 hour lease time

hostapd.conf 파일 생성

$ sudo vi /etc/hostapd/hostapd.conf

# This is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network
ssid=Pi3-AP

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
wmm_enabled=1

# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

# Accept all MAC addresses
macaddr_acl=0

# Use WPA authentication
auth_algs=1

# Require clients to know the network name
ignore_broadcast_ssid=0

# Use WPA2
wpa=2

# Use a pre-shared key
wpa_key_mgmt=WPA-PSK

# The network passphrase
wpa_passphrase=raspberry

# Use AES, instead of TKIP
rsn_pairwise=CCMP

default hostapd 파일 수정

$ sudo vi /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

서비스 다시 시작

$ sudo service hostapd start  
$ sudo service dnsmasq start
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함