Method one, software search: such as Ipscan or Ipscanner
Ipscan is used here.
The green sign is the Raspberry Pi that you can find in use.
Second, find the IP address of the Raspberry Pi.
Run the DOS window and enter Arp–a. The Raspberry Pi is one of the dynamic addresses.
、
Third, set the static IP address,
Modify file:/etc/network/interfaces, command as follows
sudo nano/etc/network/interfaces
Replace the last sentence iface default inet DHCP with the following:
Iface default inet static
Address 192.168.1.186 (The feeling is that the root has its own network to fill)
Netmask 255.255.255.0
Gateway 192.168.1.1
Finally Ctrl+o save Ctrl+x exit, and then restart the network:
sudo/etc/init.d/networking restart
Four, on the router to view
View active status after logging in to the router
Five, Raspberry Pi send their own address to the mailbox
Create a text named send_ip.py and copy the following Python code in
First, let's create a text named send_ip.py and copy the Python code below.
Import socket
Import Fcntl
Import time
Import struct
Import Smtplib
Import Urllib
From Email.mime.multipart import Mimemultipart
From Email.mime.text import Mimetext
From Email.mime.image import Mimeimage
def sendEmail (smtpserver,username,password,sender,receiver,subject,msghtml):
Msgroot = Mimemultipart (' related ')
Msgroot["to"] = ', '. Join (receiver)
Msgroot["from"] = Sender
msgroot[' Subject '] = Subject
Msgtext = Mimetext (msghtml, ' html ', ' Utf-8 ')
Msgroot.attach (Msgtext)
SMTP = Smtplib. SMTP ()
Smtp.connect (SmtpServer)
Smtp.login (username, password)
Smtp.sendmail (sender, receiver, msgroot.as_string ())
Smtp.quit ()
Def check_network ():
While True:
Try
Result=urllib.urlopen (' http://baidu.com '). Read ()
Print result
Print "Network is ready!"
Break
Except Exception, E:
Print E
Print "Network is not ready,sleep 5s ...."
Time.sleep (5)
Return True
Def get_ip_address ():
s = socket.socket (socket.af_inet, socket. SOCK_DGRAM)
S.connect (("1.1.1.1", 80))
Ipaddr=s.getsockname () [0]
S.close ()
return ipaddr
if __name__ = = ' __main__ ':
Check_network ()
Ipaddr=get_ip_address ()
SendEmail (' smtp.126.com ', ' Your email ', ' e-mail password ', ' or your email ', [' Your Inbox '], ' IP Address of Raspberry Pi ', ipaddr)
We remember to modify the final parameters of the script, I have been marked out in Chinese, note that stmp.126.com is 126 of the server, if you are QQ mailbox to do email, remember to change the server to smtp.qq.com, other mailboxes to modify
Now everyone save the text under/HOME/PI, open the terminal, enter
Python send_ip.py
Now we're going to add this script to the Raspberry Pi boot.
First enter the root account (do not know the self-Baidu)
Cd/etc
Nano rc.local
Add this line after fi
/usr/bin.python/home/pi/send_ip.py
Save (PS: You can add boot scripts like this later)
Restart Raspberry, your mailbox will have Raspberry Pi IP.
Common ways to find a Raspberry Pi IP address