ทุก Device บน Network มี Internet Protocol (IP) Address IP Address ใช้ระบุ Device เฉพาะบน Network ระหว่าง Device อื่นๆ เหมือนที่อยู่ถนน/ไปรษณีย์ หากต้องการเชื่อมต่อ Device บน Network ต้องรู้ IP Address และบางครั้งหายาก
บทความนี้แสดงวิธีหา IP Address ของ Raspberry Pi ที่ต่อ Network อยู่ บางกรณี IP ของ Pi เป็น Dynamic (เปลี่ยนได้) หาก IP เปลี่ยน ต้องหา IP ใหม่ เนื่องจากอาจมี/ไม่มี Monitor ต่อ Pi เราจะแนะนำวิธีหา IP Pi พร้อมและไม่มี Display
หา IP Address Raspberry Pi ด้วย Monitor และ Keyboard ต่อกับ Pi
วิธีง่ายที่สุด: Sign in เข้า Pi โดยตรง ไม่ว่าจะติดตั้ง OS ที่มี GUI Desktop หรือไม่
หากติดตั้ง Headless (ไม่มี Linux Desktop)
OS ที่ติดตั้งบน Pi ไม่มี GUI Desktop ใช้ Terminal หา IP Address
- Sign in เข้า Pi
- พิมพ์ ip a กด Enter
- IP Address จะแสดงรูปแบบ: inet 192.168.x.x
- ตัวอย่าง Pi ต่อผ่าน Ethernet IP อยู่ Section eth0 หากต่อ WiFi จะอยู่ wlan0
หากมี Linux Desktop
หากติดตั้ง Raspberry Pi OS with Desktop บน Pi หา IP ได้ง่าย: Hover เมาส์ที่ Network Icon (ลูกศร 2 หัว) มุมขวาบน ใกล้นาฬิกา Information Panel แสดง Network Connection ของ Pi
หาก Pi ต่อ Ethernet จะเห็น IP หลัง eth0 ภาพตัวอย่าง IP คือ 192.168.1.179 ข้าม Slash และตัวเลขหลัง (Subnet Mask) หากต่อ WiFi จะเห็น IP หลัง wlan0
หา IP Address Pi จาก Windows Computer บน Network เดียวกัน
วิธีง่าย 2 วิธี หา IP Pi จากคอมพิวเตอร์อื่น Network เดียวกัน
ใช้คำสั่ง Hostname
Hostname Command ดีสำหรับหา IP Pi จากคอมพิวเตอร์อื่น Network เดียวกัน
- บน Windows Computer Network เดียวกับ Pi เปิด Command Prompt: พิมพ์ cmd ใน Search Box กด Enter
- ใน Command Prompt พิมพ์ nslookup raspberrypi
- เห็นข้างต้น nslookup คืน 2 ผลลัพธ์ ตัวแรก = Gateway Address (Router IP) ตัวที่สอง = IP Address ของ Raspberry Pi
- หมายเหตุ: หากคืน "*** [NETWORK_NAME] can't find raspberrypi: Non-existent domain" หมายถึง Pi ไม่อยู่ Network เดียวกัน, Typo คำสั่ง, หรือ Computer ไม่มีสิทธิ์ Query DNS Server
ใช้คำสั่ง Ping
Network Device ส่วนใหญ่มี Ping Enabled Raspberry Pi OS Images ส่วนใหญ่ Enable Ping Default แต่ Ping อาจถูก Disable บน Pi วิธีนี้ไม่รับประกัน 100%
Ping Command เหมือนเล่น Marco Polo โห "Marco" Device ตอบ "Polo" เปิดเผยตำแหน่ง
- Windows Computer Network เดียวกับ Pi เปิด Command Prompt: cmd ใน Search Box กด Enter
- พิมพ์ ping raspberrypi กด Enter
- Screenshot ข้างต้น IP แสดงหลายครั้ง หาก Ping Fail IP ที่คืนอาจยังถูก ลองดูว่าทำงานไหม
- หมายเหตุ: หา Pi ไม่เจอ Error "Ping request could not find host raspberrypi. Please check the name and try again" ลองวิธีอื่น
หา IP Address Pi ด้วย Third Party Tools
Network Scanner Tools Loop ทุก IP บน Network พยายาม Detect Hosts (เช่น Raspberry Pi) จำไว้: Tool นี้ทำงานก็ต่อเมื่อ Computer/Phone อยู่ Network เดียวกัน (ต่อ Router เดียวกัน) กับ Pi
ใช้ Angry IP Scanner
Angry IP Scanner Open Source จาก Anton Keks นิยมในชุมชน Pi ดาวน์โหลดจาก GitHub Page ให้ได้ Latest Release รองรับ Windows, Mac OS, Linux
ติดตั้งและรัน Angry IP Scanner บน Computer อื่น Network เดียวกับ Pi วิธีนี้หา ทุก Device บน Network หา Result ที่ Hostname เริ่ม raspberrypi เตือน: รัน Tool นี้ก็ต่อเมื่อคุณเป็นเจ้าของ Network!
ใช้ Fing App บน Smartphone
Fing App Android/iPhone Scan Local Network แสดง IP Address Devices ทั้งหมด
รัน Fing App ได้รายการ Device ทั้งหมดบน Network หา Result เริ่ม raspberrypi IP ของ Pi จะแสดง