Cov txheej txheem:

LLDPi - Raspberry Pi Network Tool (Colorado State University): 7 Kauj Ruam
LLDPi - Raspberry Pi Network Tool (Colorado State University): 7 Kauj Ruam

Video: LLDPi - Raspberry Pi Network Tool (Colorado State University): 7 Kauj Ruam

Video: LLDPi - Raspberry Pi Network Tool (Colorado State University): 7 Kauj Ruam
Video: Network Monitoring - LibreNMS 2024, Hlis ntuj nqeg
Anonim
LLDPi - Raspberry Pi Network Tool (Colorado State University)
LLDPi - Raspberry Pi Network Tool (Colorado State University)

LLDPi txoj haujlwm yog txheej txheem tsim ua los ntawm Raspberry Pi thiab LCD uas tuaj yeem rov qab tau LLDP (Txuas Txheej Txheej Kev Tshawb Fawb Kev Tshawb Fawb) cov ntaub ntawv los ntawm cov khoom siv nyob sib ze ntawm lub network xws li lub npe system thiab kev piav qhia, lub npe chaw nres nkoj thiab kev piav qhia, VLAN npe, thiab IP tswj chaw nyob Hauv qhov kev qhia no peb yuav hla cov kauj ruam tsim nyog los ua ke LLDPi system ua los ntawm cov hauv qab no:

1x Raspberry Pi 2 B (lossis tshiab dua) + daim npav microSD nco:

1 x Elecrow 5-inch TFT LCD HDMI Display:

Xwb koj tuaj yeem siv cov zaub no:

1 x Kaw Circuit Court (siv nrog khawm):

1 x 3A UBEC (DC-DC voltage regulator):

1 x Roj teeb Charging module:

4 x 18650 Roj teeb:

1 x Poj Niam Hluav Taws Xob Jack Socket:

1 x Rocker Hloov:

2 x luv micro USB cables:

cable txuas:

Koj Yuav Tsum Tau Muag Khoom Hlau thiab Muag Khoom, zoo li yog cov hlua hlau!

Spool ntawm 3-D luam ntawv filament los luam ib lub thawv rau RamPi *(Koj yuav xav tau nkag mus rau 3-D tshuab luam ntawv)

11 x 1/4 tshuab ntsia hlau (tuav txhua yam hauv qhov chaw)

microSD adapter los nyeem/sau los ntawm PC nrog Saib, HDMI cable, Keyboard & Mouse los teeb Raspberry Pi

Kauj ruam 1: 3D Luam Case

3D Luam Case
3D Luam Case
3D Luam Case
3D Luam Case

Txhawm rau txuag qee lub sijhawm kuv tso qhov no ua thawj kauj ruam vim tias 3-D luam ntawv yuav yog cov kauj ruam ntev tshaj plaws hauv cov txheej txheem no.

Tom qab koj tau pom koj cov xim uas nyiam tshaj ntawm kev luam ntawv uas yog sib xws nrog lub tshuab luam ntawv 3-D koj yuav siv, tom qab ntawd rub tawm 4 cov ntawv no thiab pib luam tawm. Kuv siv ABS uas tuaj yeem ua rau cov nyom thiab cov txiaj ntsig tsis sib xws yog li koj yuav tau sim ua kom pom cov khoom raug.

(Kuv yuav tsum ntsuas cov khoom qis dua 0.1%.)

Kauj ruam 2: Nruab Raspbian ntawm SD Card

Koj yuav tsum muaj kev nkag siab zoo ntawm Linux thiaj li tuaj yeem ua LLDPi.

Mus rau qhov txuas hauv qab no thiab rub tawm qhov tseeb version ntawm Raspbian nrog Desktop.

www.raspberrypi.org/downloads/raspbian/

Siv koj lub khoos phis tawj los sau cov duab OS rau hauv daim npav microSD. Unzip cov ntaub ntawv Raspbian thiab mus rau qhov txuas hauv qab no txhawm rau saib cov lus qhia tshwj xeeb rau OS koj tam sim no siv los teeb duab.

learn.sparkfun.com/tutorials/sd-cards-and-…

Tam sim no peb yuav tsum tuaj yeem ntsaws daim npav microSD rau hauv Raspberry Pi 3 thiab khau raj nws. Nco ntsoov tias raspberry pi tau txuas rau tus saib xyuas thiab keyboard thiab muaj internet txuas thaum mus dhau phau ntawv qhia no.

Kauj Ruam 3: Teeb Raspbian ntawm Raspberry Pi

Ua ntej peb yuav ua kom ntseeg tau tias cov keyboard ua haujlwm tau zoo los ntawm kev qhia tias yuav siv lub nroog twg. Khiav cov lus txib hauv qab no, qhov twg $ yog kab hais kom ua sai, tsis txhob ntaus nws.

$ sudo raspi-teeb tsa

Qhov no yuav tsum tam sim no coj peb mus rau qhov tshuaj ntsuam uas peb tuaj yeem hloov kho Kev Xaiv Hauv Zos, nws yuav tsum yog plaub ntawm cov npe. Tam sim no peb xav xaiv Hloov Chaw, mus rau hauv cov npe thiab ntaus chaw seem ntawm thaj chaw hu ua en_US. UTF-8 UTF-8 thiab teeb nws mus rau lub vijtsam tom ntej. Peb kuj yuav tsum tau hloov lub sijhawm thaj tsam los ntawm kev rov qab mus rau hauv Localization Options thiab xaiv Hloov Timezone thiab teeb tsa rau Asmeskas / Denver

Tam sim no peb yuav tsum mus rau hauv Boot Options, Desktop / CLIDesktop Autologin txhawm rau pi rau autologin thaum khau raj. Cia peb mus rau hauv Cov Kev Xaiv Advanced thiab xaiv nthuav Cov Ntaub Ntawv System los siv tag nrho SDcard. Peb kuj tseem xav hloov tus neeg siv tus lej nkag los xaiv thawj qhov kev xaiv, Hloov Tus Neeg Siv Tus Kheej. Nws tau pom zoo kom sau tus password, tsis txhob hnov qab nws! Tus password tsis raug yog raspberry. Tom qab ntawv nyem Finish kom tawm. Raspberry Pi yuav xav tau rov pib dua rau qhov kev hloov pauv kom siv tau. Tam sim no qhib lub davhlau ya nyob twg thiab khiav cov lus txib hauv qab no thiab xaiv cov kev xaiv no thaum hais kom ua,

$ sudo dpkg-reconfigure keyboard-configuration

Generic 105-Key (Intl) PC

Lwm yam -> ces-> Askiv (Asmeskas)

Default rau keyboard layout

Tsis muaj tus yuam sij sau

Tsis yog

Peb cov kauj ruam tom ntej yog hloov kho thiab txhim kho Raspbian rau qhov hloov tshiab kawg. Txhawm rau ua qhov no yooj yim qhib lub davhlau ya nyob twg thiab ntaus, $ sudo apt -tau -y hloov tshiab & sudo apt -tau -y txhim kho

Yog tias qhov lus txib kawg tsis ua tiav lossis muab cov lus hais txog pob tawg, tom qab ntawv peb yuav xav tau rov pib dua thiab rov ua haujlwm dua. Tos kom txog thaum qhov ua tiav tiav thiab tom qab ntawd ua raws li cov lus txib hauv qab no,

$ sudo apt -tau -y hloov tshiab

$ sudo apt -tau nruab -y vim tsrk tcpdump ethtool gawk

Thaum nug "Puas yog cov neeg tsis siv superuser tuaj yeem ntes cov pob?", Ntaus Yes.

Kauj Ruam 4: Kho lub LCD

Configuring LCD
Configuring LCD
Configuring LCD
Configuring LCD

Cov kauj ruam tom ntej yuav yog teeb tsa lub LCD saib ua haujlwm nrog Raspberry Pi. Tua Raspberry Pi, teeb lub LCD zaub thiab tso lub zog rov qab kom nws sib phim cov duab saum toj no. Xyuas kom tseeb tias cov chaw nres nkoj HDMI kab zoo ib yam li hauv daim duab thiab ntsaws rau hauv HDMI txuas.

Tom ntej no, peb yuav tsum ua raws li cov lus txib hauv qab no txhawm rau rub tawm thiab teeb tsa tus tsav tsheb rau LCD zaub.

$ git clone

$ cd Elecrow-LCD5

$ chmod +x Elecrow-LCD5

$ sudo./Elecrow-LCD5

thiab ntaus y kom reboot. Tom qab lub cuab yeej ua tiav rov pib dua, peb tseem yuav xav hloov pauv cov lus qhia ua ntej.

$ sudo vim /boot/config.txt

thiab saib mus rau qhov kawg ntawm cov ntawv rau kab zoo li

display_rotate = 0

thiab hloov nws mus

display_rotate = 3

Reboot Raspberry Pi, tos kom txog thaum Raspberry Pi khau raj dua thiab qhib lub davhlau ya nyob twg. Thiab khiav cov lus txib hauv qab no txhawm rau txhim kho txoj hauv kev ntsuas lub vijtsam kov.

$ sudo rov pib dua

$ sudo apt-tau nruab -y xinput-calibrator xinput xserver-xorg-input-evdev

X thiab Y axis ntawm lub vijtsam kov yuav tsum tau hloov pauv yog li peb ua raws li cov lus txib hauv qab no kom ua tiav kho lub vijtsam.

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 10

Hla hla qhov no yog tias tsis muaj qhov ua yuam kev nrog cov lus hais ua ntej

#################################################################

Yog tias muaj qhov tsis raug tom qab ua cov lus txib saum toj no koj tuaj yeem sim ua qhov kev hloov pauv no rau cov ntaub ntawv tsav tsheb siv los ntawm Raspberry Pi. Nyob ntawm seb Raspberry Pi koj tab tom siv rau LLDPi no yuav muaj qee qhov sib txawv me ntsis nrog teeb tsa cov tsav tsheb LCD thiab/lossis lwm qhov chaw. Thaum teeb tsa qhov no nrog Raspberry Pi 3, muaj teeb meem nrog LCD siv cov ntawv teeb tsa hauv qab no

/usr/share/X11/xorg.conf.d/40-libinput.conf

Thaum nws yuav tsum tau siv cov ntawv teeb tsa no rau lwm tus tsav tsheb evdev

/usr/share/X11/xorg.conf.d/10-evdev.conf

Txhawm rau kho qhov no khiav cov lus txib hauv qab no,

$ sudo mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

$ sudo rov pib dua

Tom qab ntawd sim khiav cov lus txib kom pauv X thiab Y axis dua.

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 10

Yog tias qhov no tseem tsis ua haujlwm ces koj yuav tsum tau nrhiav lwm txoj hauv kev kom tau txais lub touchscreen teeb tsa kom raug.

###############################################################

Yog tias cov lus txib ua haujlwm thiab lub vijtsam kov ua haujlwm tau zoo tom qab ntawv hloov kho cov ntaub ntawv hauv qab no kom muaj 4 kab ntawm txoj cai no. $ vim /home/pi/.config/lxsession/LXDE-pi/swapAxis.sh

#!/bin/tsoo

xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 10

ua ex0

Tsis txhob hnov qab muab tsab ntawv tso cai ua cov ntawv tso cai. $ sudo chmod 755 /home/pi/.config/lxsession/LXDE-pi/swapAxis.sh

Cov lus txib tom ntej yuav ua kom lub app pib thiab hloov pauv kom raug txhua lub sijhawm Pi khau raj.

$ sudo vim /home/pi/.config/lxsession/LXDE-pi/autostart

Ntxiv 2 kab ntawv hauv qab no,

@/home/pi/.config/lxsession/LXDE-pi/swapAxis.sh

@lxterminal

Kauj ruam 5: Tsim Circuit Court

Tsim Circuit Court
Tsim Circuit Court
Tsim Circuit Court
Tsim Circuit Court
Tsim Circuit Court
Tsim Circuit Court

Ua kom cov hlau txuas tau zoo, rub cov hlua txuas, thiab pib tsim lub Circuit Court uas yuav tso cai rau 18650 roj teeb rau lub zog LLDPi. Pib nrog tus poj niam lub hwj chim lub qhov (socket) thiab txuas qee cov kab txuas txuas los txuas nws mus rau qhov kawg ntawm UBEC. Tom qab ntawd peb yuav tsum tau txais tus txiv neej micro usb cable thiab txuas nws mus rau lwm qhov kawg ntawm UBEC zoo li qhia hauv daim duab. UBEC yuav tsum muaj tus pin teeb ua li cas nws tau qhia hauv daim duab ze. Tom qab ntawd lob cov teeb ntawm 18650 roj teeb, txuas lawv ua ke thiab muab cov hlua txuas txuas txuas txuas rau lub roj teeb them nqi. Teem dab tsi koj tau ua kom deb ntawm lub Circuit Court rau hauv rooj plaub nrog rau cov roj teeb.

Ua ntej yuav mus ntxiv, xyuas kom txhua yam ua haujlwm raws li xav tau kom deb li deb. Yog tias txhua yam ua haujlwm ces nws tau npaj los ua ke!

Kauj Ruam 6: Muab tag nrho ua ke

Muab tso ua ke
Muab tso ua ke
Muab tso ua ke
Muab tso ua ke
Muab tso ua ke
Muab tso ua ke

Tam sim no ntswj lub roj teeb npog rau ntawm rooj plaub. Lub roj teeb them nqi yuav tsum muaj UBEC txuas nrog los ntawm micro USB, thiab cov roj teeb nyob rau lwm sab dhau los ntawm ob kab txuas txuas. Lwm qhov USB cable ntawm lub roj teeb them nqi yuav ua rau lub kaw lus kaw. Tau txais qhov hloov pauv rocker npaj nrog lub txuas txuas txuas uas yuav ua khub rau lub kaw lus kaw. Qhov kaw hluav taws xob tseem yuav muaj 2 lwm txoj xov hlau mus rau raspberry pi rau kev qhia lub kaw lus sib txuas, nrog rau muab lub zog los ntawm lwm qhov loj dua USB rau raspberry pi, raws li qhia hauv ob peb daim duab kawg. USB loj dua uas siv hauv daim duab xav tau vim tias nws muab 2.1 amps thaum lwm tus tsuas yog siv 1 amp.

Yog tias koj muaj teeb meem tau txais cov khoom siv kom haum rau hauv rooj plaub, koj tuaj yeem sim tshem lub roj teeb npog thiab teeb cov khoom siv sib dhos nyob ntawd.

Ua raws qhov txuas no kom tau txais cov lus qhia ntawm teeb tsa software thiab kho vajtse kom muab raspberry pi hloov pauv zoo.

mausberry-circuits.myshopify.com/pages/set…

Tom qab tau txais txhua yam teeb tsa rau lub kaw lus zoo, nco ntsoov tias koj xaub lub rocker hloov mus rau hauv lub qhov nyob ntawm ib sab ntawm rooj plaub ua ntej ruaj ntseg raspberry pi nqes nrog cov ntsia hlau, tom qab haum txhua yam rau hauv rooj plaub npaj kom ntxiv cov ua haujlwm LCD thiab muab lub npog rau ntawm rooj plaub nrog cov ntsia hlau.

Kauj Ruam 7: Coding LLDPi Application

Coding LLDPi Daim Ntawv Thov
Coding LLDPi Daim Ntawv Thov
Coding LLDPi Daim Ntawv Thov
Coding LLDPi Daim Ntawv Thov

Tam sim no peb tau teeb tsa lub khoos phis tawj peb tuaj yeem pib ua haujlwm tawm cov cai uas yuav tsim GUI thiab sau tag nrho cov ntaub ntawv peb xav tau. Cov ntaub ntawv nrog cov cai tsim nyog rau daim ntawv thov no nyob hauv qab ntawm nplooj ntawv. Koj yuav tsum rub tawm lawv thiab xyuas kom tseeb tias lawv nyob hauv lawv cov npe kab ntawv raug, raws li qhia hauv qab no.

Nco ntsoov hloov cov ntaub ntawv npe nrog.txt txuas ntxiv mus rau.sh txuas ntxiv

$ mkdir/tsev/pi/LLDPi

$ cd/tsev/pi/LLDPi

$ kov /home/pi/LLDPi/lldp.sh

$ kov /home/pi/LLDPi/getSWITCHinfo.sh

$ kov /home/pi/LLDPi/getVLANinfo.sh

$ kov /home/pi/LLDPi/LLDPiGUI.py

$ kov /home/pi/LLDPi/reset.sh

*** Tej zaum yuav tsum tau ua qhov no txhawm rau ua cov ntawv sau ua ntej

$ chmod 755 lub npe ntaub ntawv

$ kov tsrk.cap

$ sudo chown paus: hauv paus tsrk.cap

$ kov tcpdump.cap

$ kov displayLLDP.txt

$ kov progess

[Tsis teb los tau] Qhov no yuav ua lub cim yooj yim ntawm lub vijtsam Desktop uas tus neeg siv tuaj yeem nyem ob zaug kom pib LLDPi Application. Kho cov ntawv hauv qab no los tsim lub cim thiab xyuas kom nws muaj cov hauv qab no.

$ vim /home/pi/Desktop/LLDPi.desktop

[Desktop nkag]

Lub npe = LLDPi

Saib = RUN LLDPi Script

Exec =/tsev/pi/LLDPi/LLDPiGUI.py

Terminal = muaj tseeb

Hom = Daim Ntawv Thov

*Yog tias koj muaj daim duab los siv ua lub cim, tom qab ntawd ntxiv kab rau LLDPi.desktop cov ntaub ntawv uas qhia txog txoj hauv kev rau hauv daim duab,

Icon =/meej/txoj kev/rau/duab/ntawv

Muab cov ntawv sau ua haujlwm los ntawm kev tshuaj xyuas qhov tso tawm ntawm./LLDPiGUI.py lossis los ntawm txhaj lub cim ntawm lub vijtsam loj

$ vim ~/.bashrc

Ntxiv ib txoj kab zoo li cov hauv qab no thaum kawg ntawm ~/.bashrc kom pib LLDPi app ntawm lub sijhawm khau raj. /home/pi/LLDPi/LLDPiGUI.py

Thiab qhov ntawd yuav tsum yog nws, RamPi yuav tsum ua tiav thiab npaj txhij los sim.

Pom zoo: