नेटवर्किंग: हेडल रास्प्बेबेरी PI


मा मेरो बीबी -8 droid को साथ मेरो टोरोइड को लागी एक रोबोटकी पुग्न उत्सुक, मैले एक रास्पबेरी pl my Mode मोडेल बी यसमा। तर जब यो गठन गरिएको छ -02.111.11n वायरलेस, म सुरुमा वायरलेस पहुँच पोइन्ट थिएन, यद्यपि अन्ततः मैले एक प्राप्त गरें। त्यो संकेत भयो कि म यसलाई फेला पार्न र मेरो डेस्कटप कम्प्युटरसँग भेट्ने विभिन्न तरिकाहरू मार्फत गएको छु। निश्चित रूपमा त्यहाँ अरूहरू छन् जुन त्यहि गर्न खोज्दै छन् ताकि यसलाई एक पृष्ठ जडान गर्न प्रयोग गरिएको गोप्य इन्द्रियलाई सिधा एक कम्प्युटरमा जडान गर्न प्रयोग गर्नुहोस्, र अप्रत्यक्ष रूपमा।

किन मेरो डेस्कटप कम्प्युटरबाट pi कनल गर्नुहोस्? आखिर, त्यहाँ साना मोनिटरहरू र किबोर्डहरू छन् जुन ह्याकरहरू बारम्बार PI ल्यापटपहरू र PI ट्याब्लेटहरू बनाउन प्रयोग गर्दछन्। म बिभिन्न रोबोटहरूमा पिन सम्मिलित हुने भएकोले मैले यसको लागि छुट्टै मोनिटर र कुञ्जीपाटी खरीद गर्न आवश्यक देखें, तर मैले थोरैमा देखेको थिएँ।

मेरो डेस्कटपको मोनिटरले एक VGA कनेक्टर प्रयोग गर्दछ तर VGA-TH-HDMI एडाप्टर म सँगै मिलेर काम गरेन। साथै, मेरो डेस्कटपको पुरानो कुञ्जी कुञ्जीपाटीले P / 2 कनेक्टर प्रयोग गर्दछ त्यसैले जुन प्रयोग योग्य थिएन। यद्यपि PS / 2-देखि-USB एडीप्टरहरू अवस्थित छन्, मेरो अनुसन्धानले यो देखाए कि मेरो कुञ्जीमा स्मार्टहरू छन्, किनकि मेरो कुञ्जीपाटीले यस्तै प्रकारको इलेक्ट्रोनिक्स छैन। (तर यसको मीठो, गहिरो चरमत्मक कुञ्जीहरू छन्!) मेरो पाइ हाइज र म योमा मेरो डेस्कटप कम्प्युटरबाट जडान गरेर यो प्रोग्राम गर्न सक्दछु।

ईथरनेट केबलको माध्यमबाट सिधा जडान गर्दै

मेरो घर मोडेम पनि पुरानो थियो, कुनै वायरलेस भएको थिएन। यो पनि एक ईथरनेट पोर्ट थियो। त्यो संकेत भयो कि म मेरो डेस्कटप कम्प्यूटर या त मोडेममा वा रास्प्बेरी पाईमा जडान गर्न सक्दछु तर दुवै एकै समयमा दुबै होइन। त्यसोभए अन बडबकमा, यसलाई मेरो कम्प्युटरमा यसलाई जडान गर्ने एकमात्र तरीकामा मोडलबाट ईथरनेट कम्मर अनप्लग गर्नुपर्दछ र यसको सट्टामा पिलैज गर्नुहोस्। यसले कुनै पनि इन्टरनेट पहुँचलाई कुनै इन्टरनेट पहुँचको साथ संकेत गरेन, हार्दिक आदर्शको साथ काम गर्दा, तर त्यहाँ राम्रो छ कि भनेर हेर्न पर्याप्त राम्रो छ।

तर मेरो कम्प्युटरको लागि PI सँग कुरा गर्नको लागि मलाई PI को IP ठेगाना चाहिएको थियो। ती आईपी ठेगानाहरूसँग परिचित छैनन्, ती duns नम्बरहरू 0 देखि 2 255 सम्म डटबाट विभाजित हुन्छन्। उदाहरण को लागी:

169.254..95.9508

यो वास्तवमै 32-बिट नम्बर हो तर यो पाठ्यताको लागि त्यस तरीकाले लेखिएको छ।

विन्डोज र विन्डोजमा साझेदारी केन्द्र

आईपी ​​ठेगाना र सबनेट मास्क

मेरो डेस्कटपमा विन्डोज नियन्त्रण प्यानलमा गइरहेको छ र त्यसपछि नेटवर्क र साझेदारी केन्द्र र साझेदारी केन्द्रमा जाँदै, मँ अहिले अस्तित्वमा थिएँ कि नेटवर्क अस्तित्वमा छ।

दृश्य स्थिति र गहिरो हुँदै गइरहेको छ मैले केहि लाभदायक जानकारी फेला पारे। पहिलो डेस्कटप कम्प्युटर, 16999.254..95.95.9508 को आईपी ठेगाना थियो। IPV4 मलाई बताउँछ कि यो इन्टरनेट प्रोटोकल संस्करण on। IP IPV6 मा आईपी ठेगानाहरू कम्तिमासम्ममा भिन्न छ कि उनीहरू चार गुणा फरक छन्।

यसबाहेक, आईपीभी4 को उपस्थितिको उपस्थिति, 255.2555.055.0.0.0 एक सबर्म एक सानो नेटवर्क निर्माण गर्न मेशिनहरू को एक समूह हो जुन एक ठूलो को एक हिस्सा हुन सक्छ वा हुन सक्दैन। तिनीहरूको आईपी ठेगानाहरूले सबै समान बाइनरी मानहरूको साथ सुरूवात गर्दछ, यद्यपि उनीहरू कति थोरै बिट्सहरू समान हुन्छन्। तपाइँ कसरी जान्नुहुन्छ कुन बिट्स सामान्य छ?

सबनेट मास्क प्रयोग गर्दै
जहाँ सब्जन मास्क भित्र आउँदछ। कुन बिट्स पत्ता लगाउन, सब्टनेट मास्क लिनुहोस् र एक उपन्यापमा निर्माता र एक निर्माता को आईपी ठेगाना को साथ। रेखाचित्रले देखाउँदछ, मेरो मामला मा परिणाम 1 1699 .2.254.0.0.0.0.0.0.0.0.0.0.0.0.04 को साथ शुरू हुनुपर्दछ। सब्जन मास्क लेख्ने अर्को तरिका भनेको CIDR नोटनमा छ। Cidr नोट मा IP ठेगाना एक / र त्यसपछि साझा बिट्सको संख्या। यस अवस्थामा यो 1 16 .2.254..0.0.0.01। हुनेछ। अन्तिम दुई संख्या शून्य हो तर तिनीहरू विचार गर्नु पर्दैन कि 1 16 ले तपाईंलाई के राख्नु पर्ने बताउँछ। यो Cidr नोटेशन चाँडै आउनेछ।

यद्यपि 1 16 .2.254 साझा गरिएको थियो, कि अझै 65,, 5366 (2 2563) (266 × 2)) दुई बाँकी संख्याका लागि सम्भावित संयोजनहरू। नेटवर्क स्क्यान गर्न, संख्याको सबै संयोजनबाट गइरहेको, मैले NMAP प्रयोग गरें, NMAP.org बाट डाउनलोड गर्न योग्य।

‘NAMP -SN’ स्क्यान परिणामहरू
स्न्यापशटमा देखाईएको छ, म यसलाई साइजीविन विन्डोमा दौडँदैछु जहाँ त्यहाँ गुइ संस्करणहरू पनि उपलब्ध छन्। मैले निम्न आदेश रेखा प्रयोग गरें।

nmap -sn 1699.254.254.0.0.01।

नोट गर्नुहोस् कि सब्जन मास्कलाई CIDR संकेतनको प्रयोग गरी दिइएको छ। रास्पबेरी पात्रको बारेमा खण्ड जुन तपाईंले स्न्यापशटमा देख्नु भएको छ 10 मिनेट पछि देखा पर्यो, 19 .2.254.254..37.7747777777777777777777777777। जे होस् त्यो मैले खोजिरहेको थिएँ, मैले यसलाई जे भए पनि जान छोडें र पूर्ण स्क्यानले चालीस चार मिनेट भन्दा बढी लिएको थियो। त्यस समयमा यसले मेरो डेस्कटप कम्प्युटर पनि फेला पार्दछ, होस्टले यसलाई स्क्यान गरिरहेको थियो। पाको आईपी ठेगाना 1.99.254.254.255555.25555 भयो तब यसले पूर्ण चालीस मिनेट लिएको थियो यसलाई फेला पार्नु अघि।

Pi को आईपी ठेगाना 1 16999.254..257..374747777777777777777777777777477777777774774747747477474777474774747477774747777

टर्मिनल र VNC डेस्कटप सुरू गर्दैPuTTY for SSH terminal

VNC desktop

Now that I had it connected, I needed a terminal running a safe shell (SSH) into the Pi on the desktop computer. Setting up the terminal was simply a matter of downloading the popular PuTTY program and running it. In the Session section, I filled in the Pi’s IP address, port 22, and made sure SSH was selected. That opened up a terminal window with a login prompt. The default username is pi and the password is raspberry. Of course the first thing I did was run the passwd utility to change the password.

Alternatively you can get a graphical terminal instead using VNC. This is a graphical desktop that runs in a window on you desktop computer but is really a terminal into the Pi.

Connecting by means of Ethernet using A Wireless Router

It wasn’t long after getting my Pi that I made a decision to switch to a wireless router / fiber modem combo. As a bonus, this upgrade also includes multiple Ethernet ports. I set up my desktop computer to use wireless, but I couldn’t do the same for the Pi just yet. I had to do some configuration on the Pi to set up the wireless, and so I had to connect using Ethernet first.

Router network information in a browser
Connecting to the router with Ethernet was far much easier than the direct-connection method covered above considering that no scanning was involved. Once I’d connected the Pi using an Ethernet cable, I simply brought up a browser on my desktop computer and typed the router’s IP address into the browser’s URL bar at the top. This is an address like 192.168.1.1 or 192.168.2.1, but with http:// in front of it, though some browsers don’t need the http://. check your router/modem manual.

What you see depends on your modem, but mine displayed a network graph at the bottom with the Pi’s IP address, 192.168.2.14. with that I was able to bring up a terminal using PuTTY as described above.

If you want to remain using Ethernet between your Pi and the modem then you’re done. but I wanted to go wireless so that my robots could wander around without a trailing Ethernet cable. now that I had a terminal into the Pi I could go on to the next step.

Connecting Wirelessly

The Raspberry Pi 3 model B has wireless built-in, but if you have a version without wireless then you can also get a wireless dongle that plugs into one of the Pi’s USB ports. Before you can connect to the headless Pi wirelessly, you’ll still need to connect to it using one of the above methods first, and do some configuration on the Pi.

I brought up a terminal and logged in as described above. I needed to put my wireless network name and network password into the configuration file /etc/wpa_supplicant/wpa_supplicant.conf.  But for safety reasons, I didn’t want the password to be in plain text.

Using wpa_passphrase and editing wpa_supplicant.conf
Editing wpa_supplicant.conf
So I ran wpa_passphrase “bobsnetname” “bobsnetpassword” and highlighted the output, which in this terminal, copies the highlighted text to the clipboard. “bobsnetname” and “bobsnetpassword” are of course fictitious.

I then edited /etc/wpa_supplicant/wpa_supplicant.conf and pasted from the clipboard by right-clicking. The pasted text still included a line with the password in clear text. It was commented out but nonetheless, visible, so I deleted it.

After saving, and exiting the editor I disconnected the Ethernet cable. A running program called wpa-supplicant should have taken only a few seconds after the file was changed to notice it and get the wireless going. And so after waiting a few seconds I ran ping google.com. यसले काम गर्यो। The Pi was connected wirelessly.

Had it not been then I could have restarted it manually by running sudo wpa_cli reconfigure. This also reports the interface name, wlan0 in my case.

Running ‘ifconfig wlan0’
To additionally test it, and to get the Pi’s IP address, I ran ifconfig wlan0 and looked for the IP address beside the inet addr. It was there and with it I could connect to the Pi and start programming robots.

Those were my experiences in connecting to my Raspberry Pi, but we know that there are lots of Raspberry Pi users on Hackaday. What methods have you used, what traps have you found and what ideas do you have for getting out of them? let us know in the comments so that others don’t fall into them too.

Leave a Reply

Your email address will not be published. Required fields are marked *