Cov txheej txheem:

Raspberry Pi Enterprise Network WiFi Choj: 9 Kauj Ruam
Raspberry Pi Enterprise Network WiFi Choj: 9 Kauj Ruam

Video: Raspberry Pi Enterprise Network WiFi Choj: 9 Kauj Ruam

Video: Raspberry Pi Enterprise Network WiFi Choj: 9 Kauj Ruam
Video: Describe your perfect vacation. #philippines #angelescity #expat #travel #filipina #phillipines 2024, Kaum ib hlis
Anonim
Raspberry Pi Enterprise Network WiFi Choj
Raspberry Pi Enterprise Network WiFi Choj

Los ntawm: Riley Barrett thiab Dylan Halland

Lub hom phiaj ntawm txoj haujlwm no yog tso cai rau IoT ntaus ntawv, xws li Weemo Smart Plug, Amazon Echo, Gaming Console, lossis lwm yam Wi-nkaus ua kom siv tau txuas rau WPA_EAP Enterprise Network los ntawm kev siv Raspberry Pi Zero W ua pob khoom xa khoom. Cov txheej txheem ntxiv yuav tsum tau ua rau cov cuab yeej txuas rau lub network kev lag luam, thiab ntau yam khoom siv tsis sib xws txhua. Los ntawm kev siv Wi-Fi Choj, txhua lub cuab yeej tuaj yeem nkag tau yooj yim hauv internet los ntawm kev txuas mus rau Pi.

Lub kaw lus tuaj yeem ua tiav ntawm ib daim npav wireless lossis ob daim npav cais nyob ntawm qhov xav tau ntawm tus neeg siv. Rau cov kab ke xav tau lub teeb liab siab dua thiab ua kom nrawm dua/rub tawm nrawm, nws yog qhov zoo tshaj plaws los siv daim npav wireless tshwj xeeb los tuav lub chaw nkag. Txawm li cas los xij, rau cov kab ke uas lub teeb liab lub zog thiab kev siv bandwidth tsawg dua, lossis qhov twg xav tau kev daws teeb meem ntau dua, ib daim npav tuaj yeem sib koom los ntawm kev nkag mus thiab kev sib txuas hauv network.

Khoom siv

Raspberry Pi Zero W.

Nkag mus rau cov keyboard thiab saib xyuas

Qee qhov kev paub txog kev ua haujlwm (rau lub hom phiaj debug, Raspberry Pi teeb tsa)

Sab nraud WiFi adapter/dongle (Tsis teb los tau)

Kauj Ruam 1: Teeb tsa Raspberry Pi

Teeb tsa Raspberry Pi
Teeb tsa Raspberry Pi

Pib los ntawm kev txuas koj Pi mus rau cov keyboard thiab saib xyuas (tej zaum yuav xav tau HDMI adapter).

Tom qab ntawd, koj tuaj yeem pib los ntawm kev ntaus cov lus txib:

sudo ua

Qhov no yuav ua kom koj muaj txoj cai tsim nyog los hloov cov ntaub ntawv ntawm pi.

Tam sim no koj yuav xav nruab dnsmasq thiab hostapd siv cov lus txib:

apt-tau nruab dnsmasq hostapd

Tam sim no koj tuaj yeem pib teeb tsa tus choj WiFi.

NCO TSEG - Cov lus qhia hauv qab no yuav muaj cov ntaub ntawv rau cov uas siv tib daim npav wireless rau ob qho chaw nkag thiab txuas rau lub network. Nws kuj tseem tuaj yeem teeb tsa lub kaw lus kom khiav ntawm ob daim npav cais. Txhawm rau ua qhov no, tsuas yog saib rau kab lus hais tawm "wlan1" kab hauv cov ntaub ntawv muab, thiab hloov lawv rau kab nyob ze "ap0" kab.

Kauj ruam 2: 70-persistent-net.rules

Pib los ntawm kev nrhiav MAC chaw nyob ntawm koj tus pi los ntawm kev ntaus ntawv:

iw dev

Tsim cov ntaub ntawv hauv qab no:

nano /etc/udev/rules.d/70-persistent-net.rules

thiab kho nws kom nws muaj cov hauv qab no

SUBSYSTEM == "ieee80211", ACTION == "ntxiv | hloov", ATTR {macaddress} == "b8: 27: eb: c0: 38: 40", KERNEL == "phy0", / RUN+= "/sbin/ iw phy phy0 interface ntxiv ap0 hom _ap ", / RUN+="/bin/ip txuas teeb tsa ap0 chaw nyob b8: 27: eb: c0: 38: 40"

Cov ntaub ntawv no qhia rau lub system kom faib ib lub cuab yeej rau qhov chaw nkag ntawm khau raj. Ntawm no, MAC chaw nyob yuav tsum tau hloov nrog qhov ntawm koj tus kheej pi, uas koj nyuam qhuav pom.

(Ob Daim Npav Wireless) Cov ntaub ntawv no tsis xav tau thaum siv ob daim npav wireless.

Kauj Ruam 3: Hostapd.conf

Tom ntej no, koj yuav hloov cov ntaub ntawv hostapd.conf los ntawm kev nkag mus rau hauv qab no:

nano /etc/hostapd/hostapd.conf

Hloov kho cov ntaub ntawv kom nws phim cov teeb tsa hauv qab no:

ctrl_interface =/var/run/hostapd

ctrl_interface_group = 0 #interface = ap0 interface = wlan1 driver = nl80211 ssid = testnet hw_mode = g channel = 6 wmm_enabled = 0 macaddr_acl = 0 auth_algs = 1 wpa = 2 wpa_passphrase = 0123456789 wpa_key_mgmt = WPA-PSK wpair_PrkPrk_Prk_Prk_Prk_Prk_Prp

Nco ntsoov tias thaum kuv cov channel ntawm no tau teeb tsa rau 6, koj yuav xav hloov tus nqi no kom haum rau cov channel uas wlan0 tau ua. Ntawm qee qhov tes hauj lwm, cov channel yuav raug hloov pauv rau qhov nkag mus kom phim wlan0, tab sis qhov no tsis yog kuv li kev paub ntawm kev lag luam network. Koj tuaj yeem tshawb xyuas cov channel twg tam sim no siv thiab los ntawm kev cuam tshuam los ntawm kev ntaus ntawv

iwlist channel ua

(Ob Daim Npav Wireless) Yooj yim tsis txaus siab kab uas muaj wlan1 thiab tawm tswv yim ib qho uas muaj ap0.

Kauj ruam 4: Dnsmasq.conf

Tam sim no koj yuav kho cov ntaub ntawv dnsmasq.conf:

nano /etc/dnsmasq.conf

Tsis pom zoo lossis ntxiv kab hauv qab no:

interface = lo, ap0

#interface = lo, wlan1 no-dhcp-interface = lo khi-cuam tshuam server = 8.8.8.8 domain-xav tau bogus-priv dhcp-range = 192.168.2.100, 192.168.2.200, 12h

Koj tuaj yeem siv koj tus kheej subnet ntawm no yog tias koj xav tau, tsuas yog nco ntsoov tias koj zoo ib yam.

(Ob Daim WirelessCcards) Tsis pom zoo rau kab uas muaj wlan1, thiab tawm tswv yim ib qho uas muaj ap0.

Kauj ruam 5: Interfaces

Tom ntej no, koj yuav tsum hloov kho cov ntaub ntawv cuam tshuam:

nano/etc/network/interfaces

auto hlo

auto ap0 #auto wlan1 auto wlan0 iface lo inet loopback iface eth0 inet dhcp pub-hotplug ap0 #pub-hotplug wlan1 iface ap0 inet zoo li qub #iface wlan1 inet zoo li qub chaw nyob 192.168.2.1 netmask 255.255.255.0 hostapd /etc/hostapd/hostapd.conf pub -hotplug wlan0 iface wlan0 inet dhcp pre -up wpa_supplicant -B -Dwext -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf post -down killall -q wpa_supplicant

Nws tsim nyog sau cia tias wlan0 interface YUAV TSUM tuaj tom qab qhov cuam tshuam uas koj tab tom xa mus rau nws, txwv tsis pub lub kaw lus yuav tsis ua haujlwm zoo.

(Ob Daim Npav Wireless) Tsis pom zoo ib kab uas muaj wlan1 thiab tawm tswv yim ib yam uas muaj ap0.

Kauj Ruam 6: Wpa_supplicant.conf

Tam sim no koj yuav hloov kho wpa_supplicant.conf cov ntaub ntawv pom ntawm:

nano /etc/wpa_supplicant/wpa_supplicant.conf

Qee lub network tau teeb tsa sib txawv dua li lwm qhov yog li qhov no yuav xav tau qee qhov tinkering, ntawm no yog cov ntaub ntawv wpa_supplicant.conf uas tso cai rau kuv txuas rau lub network ntawm Cal Poly:

lub teb chaws = USctrl_interface = DIR =/var/run/wpa_supplicant GROUP = netdev update_config = 1 network = {ssid = "SecureMustangWireless" scan_ssid = 1 key_mgmt = WPA-EAP pairwise = CCMP TKIP group = CCMP TKIP eap = PEAP tus kheej = username calpoly.edu "password =" your_password "phase1 =" peapver = 0 "phase2 =" MSCHAPV2 "}

Cov ntaub ntawv no tau siv los teeb tsa wlan0 txhawm rau txuas rau koj lub network kev lag luam. Qee lub tuam txhab kev lag luam xav tau daim ntawv pov thawj CA txhawm rau txuas. Cal Poly lub tsev kawm ntawv network tsis xav tau daim ntawv pov thawj, yog li kuv tau hla qhov no, tab sis koj tuaj yeem yooj yim rub daim ntawv pov thawj kom raug thiab ntxiv lawv rau koj cov ntaub ntawv wpa_supplicant nrog kab

ca_cert = "/path/to/cert.pem"

Kauj Ruam 7: Hostapdstart Tsab Ntawv

Qhov kawg uas yuav tsum tau ua yog sau ib tsab ntawv uas pib ob qho cuam tshuam thiab teeb tsa pob ntawv xa mus tom ntej thaum lub kaw lus pib. Tsim cov ntaub ntawv hu ua hostapdstart los ntawm kev ntaus ntawv:

nano/usr/zos/bin/hostapdstart

Ntxiv cov hauv qab no rau hauv cov ntawv

sudo ifdown -force wlan0 && sudo ifdown -force ap0 && sudo ifup ap0 && sudo ifup wlan0

#sudo ifdown --force wlan0 && sudo ifdown --force wlan1 && sudo ifup wlan1 && sudo ifup wlan0 sudo sysctl -w net.ipv4.ip_forward = 1 sudo iptables -t nat -A POSTROUTING -s 192.168.2.0/24! -d 192.168.2.0/24 -j MASQUERADEsudo systemctl rov pib dua dnsmasq

Tsab ntawv no ua rau ob qho cuam tshuam, tom qab ntawd coj lawv rov qab rau hauv qhov kev txiav txim kom raug, qhia tus pi tias koj xav xa cov pob ntawv los ntawm ib qho interface mus rau lwm qhov, thiab thaum kawg rov pib dua dnsmasq kom qhov kev hloov pauv yuav cuam tshuam.

(Ob Daim Npav Wireless) tsis pom zoo kab nrog wlan1 thiab tawm lus kab nrog ap0.

Kauj Ruam 8: Rc.local

Thaum kawg, peb xav kom lub kaw lus pib thaum lub kaw lus kaw lus, yog li peb yuav hloov kho rc.local cov ntaub ntawv, uas tau khiav ntawm khau raj:

nano /etc/rc.local

Cias ntxiv cov kab hauv qab no mus rau qhov kawg ntawm cov ntawv:

hostapdstart> 1 &

Koj cov ntaub ntawv yuav tsum zoo ib yam li qhov no:

_IP = $ (hostname -I) || trueif ["$ _IP"]; ces printf "Kuv tus IP chaw nyob yog %s / n" "$ _IP" fi

hostapdstart> 1 &

ua ex0

Kauj ruam 9: Reboot

Thiab qhov ntawd yog nws! Tam sim no, xav tias koj muaj txhua yam teeb tsa kom raug, thiab koj lub WiFi dongle tau txuas nrog (yog tias koj siv ib qho), koj tsuas yog yuav tsum rov pib dua koj li Raspberry Pi nrog cov lus txib:

rov pib dua

Thaum koj tus Pi tau rov pib ua tiav, koj yuav tsum tuaj yeem pom lub npe ntawm koj li Access Point ntawm txhua lub cuab yeej (xov tooj, laptop, thiab lwm yam). Thaum koj txuas nrog siv koj tus lej cim tshwj xeeb, nws yuav tsum txuas koj ncaj qha rau koj lub tuam txhab xav tau Network!

Ua tsaug tshwj xeeb rau cov kab txuas hauv qab no rau muab peb lub tswv yim ntawm yuav ua li cas thiaj li ua tau txoj haujlwm no:

  • https://blog.thewalr.us/2017/09/26/raspberry-pi-ze…
  • https://www.raspberrypi.org/forums/viewtopic.php?p…
  • https://www.raspberrypi.org/forums/viewtopic.php?f…

Qhia rau peb paub yog tias koj muaj lus nug, lus pom, lossis cov lus qhia!

IoT Kev Sib Tw
IoT Kev Sib Tw
IoT Kev Sib Tw
IoT Kev Sib Tw

Khiav Tawm hauv IoT Challenge

Pom zoo: