Cov txheej txheem:

ESP8266 Static IP (WIP): 3 Cov Kauj Ruam
ESP8266 Static IP (WIP): 3 Cov Kauj Ruam

Video: ESP8266 Static IP (WIP): 3 Cov Kauj Ruam

Video: ESP8266 Static IP (WIP): 3 Cov Kauj Ruam
Video: How to Assign a Static / Fixed IP Address | ESP8266 | ESP32 | Arduino 2024, Kaum ib hlis
Anonim
ESP8266 IP zoo li qub (WIP)
ESP8266 IP zoo li qub (WIP)

(Yog tias koj lub Wi-nkaus network twb tau teeb tsa hauv qee txoj hauv kev, koj yuav xav tham nrog koj Tus Thawj Saib Xyuas Network.)

Ib feem ntawm lub hom phiaj ntawm peb txoj haujlwm yog kom muab txhua tus ESP8266 nws tus kheej tus IP chaw nyob kom yooj yim txhawm rau taug qab cov cuab yeej thiab txuas rau lawv lub vev xaib.

Tus IP chaw nyob yog qhov chaw nyob uas tuaj yeem siv nkag mus thiab sib tham nrog cov khoom siv ntawm lub network. Muaj 2 hom IP chaw nyob, tab sis daim ntawv uas pom ntau tshaj yog IPv4, uas zoo ib yam li qhov no: 192.168.1.1. Hom ntawv yog 4 pawg lej ntawm 0-255, sib cais los ntawm lub sijhawm, TAB SIS *** nws yog ib qho tseem ceeb kom nco ntsoov tias qee tus lej tshwj xeeb muaj kev siv tshwj xeeb thiab lub ntsiab lus, qee qhov uas koj tuaj yeem nrhiav cov ntaub ntawv hais txog ntawm no: https:// en.wikipedia.org/wiki/IPv4#Tshwj xeeb-siv_ad…

Cov chaw nyob no feem ntau tau txais los ntawm DHCP server. Cov tsev thiab tsev kawm theem siab feem ntau siv lawv lub router ua lawv li DHCP server, txhais tau tias lub router yuav muab tus IP chaw nyob, siv Dynamic Host Configuration Protocol (DHCP), rau cov khoom siv thaum lawv txuas rau lub network.

Peb lub hom phiaj ntawm no, txawm li cas los xij, yog siv Static IP chaw nyob, uas yog IP chaw nyob uas tsis tau txais los ntawm DHCP server. Qhov laj thawj rau qhov no yog tias koj lub router tsis teeb tsa los muab qee yam khoom siv tib tus IP chaw nyob, yog li nws yuav siv qee qhov chaw nyob tsis xwm yeem uas tshwm sim muaj nyob rau lub sijhawm. Thaum qhov no zoo kawg nkaus rau kev siv network feem ntau, qhov no tuaj yeem cuam tshuam nrog thaum koj ua qee yam zoo li peb tab tom ua ntawm no thiab koj yuav tsum txuas rau lub vev xaib hauv zos uas siv tus IP tus ntaus ntawv.

Kauj Ruam 1: Nkag Mus Rau Koj Tus Router Tus Tswj Vaj Huam Sib Luag

Yog tias koj lub router muaj qee yam kev teeb tsa hauv qhov chaw, qhov no yog qhov uas koj yuav xav tham nrog koj Tus Thawj Saib Xyuas Network (leej twg teeb tsa lub teeb tsa, xws li niam txiv/tus saib xyuas, kws qhia ntawv, thev naus laus zis/IT chav haujlwm, thiab lwm yam).

Txhawm rau kom muaj cov chaw nyob IP zoo li qub, koj yuav yog yuav tsum tau nrhiav thaj tsam muaj nyob hauv koj qhov kev teeb tsa tam sim no lossis teeb tsa ib puag ncig koj tus kheej. Txhawm rau ua qhov no, koj yuav tsum nkag mus rau hauv lub vaj huam sib luag tswj ntawm koj lub router. Txoj kev koj ua qhov no yuav txawv nyob ntawm seb koj muaj router li cas, tab sis koj yuav tsum muaj peev xwm saib "yuav ua li cas nkag mus {koj lub npe router lossis hom} tswj vaj huam sib luag" thiab nrhiav kev qhia.

Thaum koj nkag mus rau koj lub router tswj vaj huam sib luag, pom nws cov DHCP teeb tsa (uas tej zaum yuav nyob hauv qeb dav dua hu ua "Local Network" lossis qee yam zoo sib xws).

Kauj Ruam 2: Txuag Ntau Yam Zoo Li Qub hauv DHCP

Yog tias koj lub router YUAV muaj qhov tshwj xeeb DHCP teeb tsa lossis tshwj tseg teeb tsa, tom qab ntawd:

  • Ib qho twg pom ntau ntawm IP chaw nyob uas tsis tau siv tam sim no hauv ntau qhov tshwj tseg thiab sau tseg ntawm cov no
  • LOSSIS ua qhov tam sim no loj dua (koj tuaj yeem pom yuav ua li cas hauv cov theem hauv qab no)

Yog tias koj lub router tsis muaj qhov tshwj xeeb DHCP teeb tsa lossis tshwj tseg teeb tsa, tom qab ntawv ua raws cov theem no:

  1. Koj tus router tau hais kom muab IP chaw nyob hauv qee qhov, xws li los ntawm 192.168.1.1 txog 192.168.1.255, yog li peb xav txwv qhov no kom peb muaj ntau yam ntawm cov chaw nyob uas tsis tau muab tso cia.
  2. Teeb qhov ntau kom pib siab dua los ntawm kev hloov tus lej hauv cov lej kawg. Piv txwv li, hloov 192.168.1.1 rau 192.168.1.25. Qhov no txhais tau tias koj lub router yuav tsis txiav tus IP chaw nyob ib puag ncig ntawm 192.168.1.1 txog 192.168.1.25

Tam sim no peb tuaj yeem muab cov chaw nyob no rau tus kheej!

Kauj Ruam 3: Muab IP Static rau ESP8266

Muaj 2 txoj hauv kev tseem ceeb ntawm kev muab tus IP zoo li qub rau ESP8266: hla tus router lossis hla ESP8266.

Thov qhov chaw nyob tshwj xeeb los ntawm tus router hla tus lej ntawm ESP8266 (kuv tus kheej nyiam):

Nov yog cov lus qhia zoo: https://circuits4you.com/2018/03/09/esp8266-static… tab sis cov hauv paus yog:

Muab cov lus hauv qab no suav nrog cov nqe lus saum toj kawg nkaus ntawm koj cov cai:

#suav nrog

#ncig #ncig

Tom qab ntawv hu cov txheej txheem no, qhov twg x yog IP zoo li qub (cais 4 pawg ntawm tus lej nrog tus lej cim tsis siv sijhawm) thiab y yog IP chaw nyob ntawm koj lub router (uas tseem hu ua lub qhov rooj):

IPAddress zoo li qub IP (x); // IP chaw nyob zoo li qub

IPAddress rooj vag (y); // Router tus IP chaw nyob IPAddress subnet (255, 255, 255, 0); IPAddress dns (8, 8, 8, 8);

Siv ESP8266's Media Access Control (MAC) chaw nyob hauv router teeb tsa:

Pom zoo: