Cov txheej txheem:

Raspberry Pi Ethernet rau Wifi Choj: 7 Kauj Ruam
Raspberry Pi Ethernet rau Wifi Choj: 7 Kauj Ruam

Video: Raspberry Pi Ethernet rau Wifi Choj: 7 Kauj Ruam

Video: Raspberry Pi Ethernet rau Wifi Choj: 7 Kauj Ruam
Video: ПРИВОЗ. ОДЕССА МАМА. Рецепт САЛО. ОБЗОР НОЖЕЙ 2024, Hlis ntuj nqeg
Anonim
Raspberry Pi Ethernet rau Wifi Choj
Raspberry Pi Ethernet rau Wifi Choj
Raspberry Pi Ethernet rau Wifi Choj
Raspberry Pi Ethernet rau Wifi Choj
Raspberry Pi Ethernet rau Wifi Choj
Raspberry Pi Ethernet rau Wifi Choj

Kuv muaj kev sib txuas network ntawm ntau yam Raspberry Pies, khoom siv, thiab lwm lub khoos phis tawj thiab cov khoom siv sib txuas, lawv tau tswj hwm los ntawm Ubiquity firewall/router thiab kuv xav kom nws txuas nrog hauv internet yog li kuv tuaj yeem rub hloov tshiab, software, thiab lwm yam. Hmoov tsis zoo, nws nyob hauv ib feem ntawm kuv lub nkas -las / kev cob qhia uas tsis muaj ethernet jack lossis cable txuas rau, yog li siv Raspberry Pi Kuv tsim Tus Choj los txuas lub firewall mus rau Wireless network uas twb muaj lawm hauv kuv lub tsev. Nws tau siv ob peb hnub ntawm kev tawm tsam thiab sim ua cov txheej txheem sib txawv yog li kuv vam tias Phau Ntawv Qhia no yuav cawm koj qee lub sijhawm thiab kev ntxhov siab!

Ntau cov lus qhia thiab yuav ua li cas tos hauv is taws nem tau rau lwm txoj hauv kev: txuas rau lub network txuas thiab tom qab ntawd tsim lub wireless network rau txhua lub cuab yeej txuas rau. Qhov ntawd yog rooj plaub siv tau zoo kawg nkaus tab sis qhov teeb meem tseem ceeb nrog kuv qhov xwm txheej yog kuv tsis muaj qhov txuas txuas mus rau hauv internet muaj, Kuv tsis xav tso lub jacks rau hauv phab ntsa lossis siv cov hlua ntev los ua li ntawd, thiab kuv muaj zoo kawg nkaus wireless network nrog lub teeb liab muaj zog los txuas rau!

Qhov chaw uas yooj yim zoo nkauj, Pi, Kuv tso lub POE lub kaus mom rau nws kom kuv tuaj yeem txo cov xov tooj thiab cov nyom, kuv kuj tau xaiv siv sab nraud USB wifi adapter vim tias kuv xav tau AC600 lub peev xwm thiab txuas mus rau Wireless AC600 network.

Khoom siv

  • Raspberry Pi 3 B+ Case, thiab SD Card (https://amzn.to/2LHzkmy)
  • Raspberry Pi POE Hat (https://amzn.to/2q0ZMzG)
  • Alfa AWUS036ACS 802.11ac AC600 Wi-Fi USB Wireless Network Adapter (https://amzn.to/2rp7UuM)
  • POE Hloov (https://amzn.to/2siIuyE)
  • Ethernet Cables (https://amzn.to/2P9Urjf)

Thiab yog tias koj xav paub qhov no yog cov khoom siv sib tham uas kuv siv rau kuv lub tsev, uas kuv xav tias tsuas yog txaus

  • Ubiquiti UniFi Cloud Key (https://amzn.to/38q04BE)
  • Ubiquiti Unifi Security Gateway (USG) (https://amzn.to/35crkSe)
  • Ubiquiti UniFi AP AC PRO 802.11ac Scalable Enterprise Wi-Fi Access Point (https://amzn.to/2siIqPr)
  • Ubiquiti UniFi Hloov 8 60W (https://amzn.to/36fibs6)

Kauj ruam 1: Rub Raspbian thiab nyem SD Card

Rub tawm Raspbian thiab nyem SD Card
Rub tawm Raspbian thiab nyem SD Card
Rub tawm Raspbian thiab nyem SD Card
Rub tawm Raspbian thiab nyem SD Card

Ua ntej peb yuav tsum rub ob peb yam:

Ib qho yog OS rau peb Raspberry Pi thiab peb tab tom yuav siv Raspbian, vim tias nws nrov thiab siv tau yooj yim (uas yog vim li cas nws thiaj li nrov heev). Koj tuaj yeem rub daim duab ntawm no, https://www.raspberrypi.org/downloads/raspbian/, peb yuav siv "Raspbian Buster nrog desktop" duab yog li peb muaj GUI Desktop los ua tej yam yooj yim me ntsis thiab txij li peb tab tom teeb tsa Pi no los ua tus choj thiab tsis yog rau kev siv txhua hnub, peb tsis xav tau txhua qhov software pom zoo ntxiv.

Ob yog peb tseem yuav siv Etcher los nyem peb daim npav SD. Nws yog pub dawb thiab siv tau yooj yim, rub tawm thiab kawm paub ntau ntxiv txog nws ntawm no:

Ntxig daim npav SD rau hauv lub khoos phis tawj (Kuv siv Mac thiab kuv xav tias koj lub khoos phis tawj/khoos phis tawj muaj SD Card nyeem ntawv, tsis li ntawd tau txais ib qho zoo li no

Txhawm rau hloov daim duab mus rau SD Card peb xub Unzip cov duab rub tawm uas yog ZIP cov ntaub ntawv, tom qab ntawd hauv Etcher xaiv cov ntawv.img, nco ntsoov xaiv daim npav SD raug raws li lub hom phiaj (Kuv ua qhov no los ntawm kev txheeb xyuas qhov loj, 32 GB qhov no, thiab kuv feem ntau txuas lossis tshem tawm lwm yam USB lossis SD daim npav ua ntej tso Etcher), thiab xaiv Flash. Nws yuav mus nrawm nrawm nrog sau thiab txheeb xyuas cov duab, ib zaug ua tiav koj tuaj yeem tshem daim npav SD thiab kaw Etcher.

Kauj ruam 2: Pib Pi thiab Teeb

Booting Pi thiab Teeb
Booting Pi thiab Teeb
Booting Pi thiab teeb tsa
Booting Pi thiab teeb tsa
Booting Pi thiab teeb tsa
Booting Pi thiab teeb tsa

Txuas lub Hwj Chim, HDMI Saib, thiab cov keyboard thiab nas rau Pi. Koj tseem tuaj yeem txuas lub USB wifi adapter tab sis muaj qee cov kauj ruam ntxiv tom qab uas yuav tsum tau ua kom nws ua haujlwm.

Ntxig daim npav SD thiab lub zog rau ntawm Pi.

Kev teeb tsa thawj zaug yog qhov yooj yim zoo nkauj, hauv kev coj teeb tsa:

  • Kauj Ruam 1, peb teeb tsa qhov chaw kom raug, lus.
  • Kauj ruam 2, peb teeb tus password.
  • Kauj Ruam 3, peb xaiv lub network wifi uas twb muaj lawm thiab muab tso rau hauv kab lus dhau los. Tam sim no peb nyob hauv lub network.
  • Kauj Ruam 4, peb kho thiab hloov kho tshiab.
  • Kauj Ruam 5, peb xaiv qhov kev xaiv daws teeb meem, kuv cov zaub muaj ciam dub, yog li kos cim.
  • Kauj Ruam 6, peb xaiv "tom qab" ntau dua li rov pib dua.
  • Kauj Ruam 7, peb qhib raspberry pi kev teeb tsa thiab tig rau SSH thiab VNC kom ua kom tswj tau yooj yim.
  • Kauj ruam 8, tom qab ntawd peb rov pib dua.

Kauj Ruam 3: Txhim Kho Tus Qauv Tsav Tsheb rau Alfa USB Wireless Card

Txhim Kho Tus Qauv Tsav Tsheb rau Alfa USB Wireless Card
Txhim Kho Tus Qauv Tsav Tsheb rau Alfa USB Wireless Card

Peb yuav tsum tsim thiab teeb tsa lub kernel module kom peb USB ua haujlwm. Qhov no tuaj yeem nyuaj me ntsis tab sis hmoov zoo rau peb muaj ib tus neeg hauv tebchaws Askiv ntawm Raspberry Pi cov rooj sib tham hu ua MrEngman uas suav ntau tus tsav tsheb wifi rau Raspbian, thiab qhov no nws muaj ib qho rau peb Alfa USB wireless card. Koj tuaj yeem pom cov xov no ntawm no (https://www.raspberrypi.org/forums/viewtopic.php?t=192985)

Txhawm rau siv nws tsab ntawv peb rub tawm nws thiab khiav nws ua tus superuser (uas tuaj yeem ua rau muaj kev phom sij los ntawm kev saib xyuas kev nyab xeeb, tab sis tom qab tshuaj xyuas yam peb tab tom thawb peb paub tias nws nyab xeeb rau lub sijhawm no).

sudo wget https://fars-robotics.net/install-wifi -O/usr/bin/install-wifi

sudo chmod +x/usr/bin/install-wifi

Cov ntawv no ua dab tsi yog txheeb xyuas qhov yuav tsum tau siv tus tsav tsheb/tsav tsheb, rub nws los ntawm Is Taws Nem, tshem nws thiab txav nws mus rau txoj hauv kev rau OS kom pom nws (xws li hauv/lib/modules/), thiab teeb tsa qhov tsim nyog kev tso cai. Peb tuaj yeem hla cov kauj ruam no peb tus kheej, tab sis siv MrEngman cov ntawv sau tawm qee qhov kev kwv yees thiab phau ntawv qhia ua cov txheej txheem ua rau peb yooj yim dua.

Kauj ruam 4: Lov tes taw Onboard Wifi

Vim tias peb tab tom siv wifi sab nraud, peb tsis tas yuav siv onboard ib qho. Rau qhov yooj yim peb tsuas yog lov tes taw nws hauv OS. Nov yog qhov yooj yim ntawm Pi vim tias cov tsav tsheb wifi yog qhov tshwj xeeb:

Peb xiam cov tsav tsheb los ntawm kev kho cov ntaub ntawv /etc/modprobe.d/raspi-blacklist.conf thiab ntxiv:

blacklist brcmfmac cov

blacklist brcmutil cov

Kauj Ruam 5: Ua Ntej Ua Ntej Ua Ntej thiab Disable IPv6

Txij li thaum peb muaj ob lub network, kev sim network thiab kev sib txuas ib txwm txuas rau hauv is taws nem, peb xav kom Pi txheeb xyuas lub wireless network ua ntej, ntau dua li cov xov hlau, uas yog qhov tsis zoo rau lub neej ntawd. Peb tuaj yeem siv cov ntsuas ntsuas ntsuas thiab teeb tsa nws rau cov khoom siv, qhov twg tus lej qis dua qhov muaj feem thib siab dua.

Thiab peb tsis siv ipv6 ntawm ob lub network yog li peb tsuas yog tua nws kom yooj yim.

Kho cov ntaub ntawv /etc/dhcpcd.conf, ntxiv cov kab nyob ze rau hauv qab.

eth0 ua

ntsuas 300

wb wl0

ntsuas 200

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1

Kauj Ruam 6: Teeb Txoj Cai Xa Mus & DHCP ntawm Wired Network

Peb xav tau qee txoj cai tiv thaiv hluav taws kom coj mus los thiab xa nws los ntawm cov xov hluav taws xob txuas mus rau lub wireless network. Cov no yog cov qauv zoo nkauj, peb siv iptables ntawm Pi thiab peb tsim ob peb cov ntaub ntawv thiab cov cai kom paub tseeb tias txhua yam khaws cia tom qab rov pib dua.

Cov cai yog ib qho yooj yim lees txais thiab ib qho xa mus los ntawm cov xov txuas mus rau wireless.

# Tsim cov npe uas peb yuav khaws peb cov cai iptables `xa mus.

mkdir -p/etc/iptables # Tsim `iptables` cov cai los ntawm kev ua cov lus txib no los tsim ib qho` cai.v4` file cat </etc/iptables/rules.v4 *nat: PREROUTING ACCEPT [98: 9304]: INPUT ACCEPT [98: 9304]: YUAV TSUM TSO CAI [2: 152]: POSTROUTING ACCEPT [0: 0] -A POSTROUTING -o wlan0 -j MASQUERADE COMMIT *lim: INPUT ACCEPT [791: 83389]: FORWARD ACCEPT [0: 0]: OUTPUT ACCEPT [333: 34644] -A FORWARD -i wlan0 -o eth0 -m xeev -xeev RELATED, ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -o wlan0 -j ACCEPT COMMIT EOF txhua lub khau raj miv </etc/network/if-up.d/iptables #!/bin/sh iptables-restore </etc/iptables/rules.v4 EOF chmod +x /etc/network/if-up.d/iptables # Pab kom tsis tu ncua `ipv4` xa mus rau txhua qhov system boot # https://www.ducea.com/2006/08/01/how-to-enable-ip-… sed -i '' / s/ # net.ipv4. ip_forward = 1/net.ipv4.ip_forward = 1/\ /etc/sysctl.conf

Tam sim no rau DHCP ntawm qhov txuas txuas, peb teeb tsa qhov chaw nyob zoo li ntawm 10.1.1.1 thiab tom qab ntawd teeb tsa DHCP los pab tawm chaw nyob hauv IP ntawd.

# Tsim qhov chaw nyob IP zoo li qub. Qhov 'eth0' adapter yuav siv a

# IP zoo li qub ntawm `10.1.1.1` ntawm lub subnet tshiab no. miv </etc/network/interfaces.d/eth0 auto eth0 pub-hotplug eth0 iface eth0 inet zoo li qub chaw nyob 10.1.1.1 netmask 255.255.255.0 gateway 10.1.1.1 EOF # Tsim `dnsmasq` DHCP teeb tsa ntawm`/etc/dnsmasq. d/choj.conf`. # Raspberry Pi yuav ua tus DHCP server rau cov neeg siv txuas nrog # ethernet. DNS neeg rau zaub mov yuav yog `8.8.8.8` (Google's DNS) thiab # ntau yuav pib ntawm` 10.1.1.2`. miv </etc/dnsmasq.d/bridge.conf interface = eth0 khi-cuam tshuam server = 8.8.8.8 sau-xav tau bogus-priv dhcp-range = 10.1.1.2, 10.1.1.254, 12h EOF

Kauj ruam 7: Reboot thiab Test

Reboot thiab Test
Reboot thiab Test

Tom qab tau txais cov khoom teeb tsa peb tuaj yeem ntsuas qhov kev sib txuas ntawm ib qho ntawm cov khoom siv thiab paub meej tias peb tuaj yeem tsoo hauv internet thiab txhua yam ua haujlwm! Peb kuj tseem tuaj yeem nkag mus rau peb qhov Ubiquity huab yuam sij thiab txheeb xyuas qhov teeb tsa muaj ib yam. Screenshot qhia qhov no.

Thaum kawg peb rov pib dua tsuas yog kom ntseeg tau tias txhua yam rov zoo li qhov xav tau dua!

Txaus siab rau.

Pom zoo: