메뉴 건너뛰기

TSKit

Rpi3 auto ap mode.

조회 수 6008 추천 수 0 2014.12.08 00:02:09

Normal client mode.


$sudo apt-get update

$sudo apt-get install hostapd -y

$sudo apt-get install dnsmasq -y

$sudo systemctl disable hostapd

$sudo systemctl disable dnsmasq


/etc/hostapd/hostapd.conf

interface=wlan0

driver=nl80211

ssid=RPI3wifi

hw_mode=g

channel=6

wmm_enabled=0

macaddr_acl=0

auth_algs=1

wpa=2

wpa_passphrase=1234567890

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP


/etc/default/hostapd

#demon_conf=""

==>

demon_conf="/etc/hostapd/hostapd.conf"


/etc/dnsmasq.conf

#Pi3Hotspot Config

#stop DNSmasq from using resolv.conf

no-resolv

#Interface to use

interface=wlan0

bind-interfaces

dhcp-range=10.0.0.3,10.0.0.20,12h

server=8.8.8.8


/etc/network/interfaces

allow-hotplug wlan0

iface wlan0 inet manual

#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


/etc/rc.local

#!/bin/sh -e

==>

#!/bin/bash -e


insert between fi and exit 0 


#Wifi config - if no prefered Wifi generate a hotspot

#RPi Network Conf Bootstrapper

 

createAdHocNetwork()

{

    echo "Creating RPI Hotspot network"

    ifconfig wlan0 down

    ifconfig wlan0 10.0.0.5 netmask 255.255.255.0 up

    service dnsmasq start

    service hostapd start

    echo " "

    echo "Hotspot network created"

    echo " "

}

 

echo "================================="

echo "RPi Network Conf Bootstrapper"

echo "================================="

echo "Scanning for known WiFi networks"

ssids=( 'mySSID1','mySSID2' )

connected=false

for ssid in "${ssids[@]}"

do

    echo " "

    echo "checking if ssid available:" $ssid

    echo " "

    if iwlist wlan0 scan | grep $ssid > /dev/null

    then

        echo "First WiFi in range has SSID:" $ssid

        echo "Starting supplicant for WPA/WPA2"

        wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null 2>&1

        echo "Obtaining IP from DHCP"

        if dhclient -1 wlan0

        then

            echo "Connected to WiFi"

            connected=true

            break

        else

            echo "DHCP server did not respond with an IP lease (DHCPOFFER)"

            wpa_cli terminate

            break

        fi

    else

        echo "Not in range, WiFi with SSID:" $ssid

    fi

done

 

if ! $connected; then

    createAdHocNetwork

fi


출처:

https://blog.psangwoo.com/rpi/2016/08/20/rpi-connect_wifi.html

태그
엮인글 :
List of Articles
번호 제목 글쓴이 날짜 조회 수
19 Mac os sierra(10.12.1) on LG 15nd530 file tskit 2016-12-12 39987
18 rpi serial clock file tskit 2016-10-14 5396
17 osx 10.10 on sense nt-p510 file tskit 2015-11-15 5255
16 해킨토시 설치(SUCCESS) file [1] tskit 2015-10-07 12815
» Rpi3 auto ap mode. tskit 2014-12-08 6008
14 RPi Shutdown switch for safe. file tskit 2014-12-04 5139
13 inxi install [1] tskit 2014-12-04 6455
12 갤럭시노트 3100mah 배터리 file tskit 2013-04-22 5180
11 7인치 a13 tablet file tskit 2012-11-22 6036
10 옵티머스원 ku3700 V33 커널 컴파일 중... file tskit 2011-11-04 9984
9 옵티머스원 ku3700 file tskit 2011-11-04 7366
8 옴팝 커널 컴파일 file tskit 2011-10-02 8015
7 framework-res.apk수정하기 tskit 2011-09-28 16211
6 initramfs 수정해보기 tskit 2011-09-27 9705
5 갤럭시k 컴파일해보기 tskit 2011-09-27 9388
4 갤럭시 안드로이드 오픈소스 tskit 2011-09-11 9084
3 고런처 배경화면 file tskit 2011-09-10 11372
2 옴드로이드 file tskit 2011-09-10 9562
1 안드로이드 게시판을 생성합니다. tskit 2011-09-10 7976