树莓派实战1:查询自己内网,外网ip

来源:互联网 发布:mac腾讯助手官方下载 编辑:程序博客网 时间:2024/05/22 04:39

这4个实战合起来的完成效果就是:让树莓派每小时把自己ip地址通过邮件自动地发送到自己邮箱


实战2 :http://blog.csdn.net/make_app/article/details/47305179

实战3 :http://blog.csdn.net/make_app/article/details/47305337

实战4:http://blog.csdn.net/make_app/article/details/47305387

0、系统环境

树莓派a+,系统wheezy

输入uname -a

这是我的  Linux raspberrypi 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux 

1、

获取自己内网和外网 ip 地址

通过ifconfig 和grep和 cut 和 curl 命令即可

如下:

ifconfig | grep 'Bcast' | cut -d B  -f 1 >> /home/pi/Desktop/ip.log

curl http://members.3322.org/dyndns/getip >>/home/pi/Desktop/ip.log

第一句是找到自己内网Ip

第二句是找到自己外网Ip




1 0