[RPI]设置静态IP,让你的树莓派连上内网[浙江大学嵌入式系统]

1. 设置mac地址

RPi设置mac地址的方式和一般linux相同。

sudo ifconfig eth0 down hw ether xx:xx:xx:xx:xx:xx
sudo ifconfig eth0 up

运行后用ifconfig就能看到修改结果。

2.设置静态ip,网关,子网掩码

参考地址:http://elinux.org/RPi_Setting_up_a_static_IP_in_Debian

文件地址为:/etc/network/interfaces

执行命令:

sudo /etc/init.d/networking restart

完成后执行 ifconfig 查看修改结果。

3.dns设置

在文件:/etc/resolv.conf 末尾追加如下内容 nameserver 10.10.0.21

至此,如果没有出现特殊情况 执行命令

ping 10.10.10.34

结果如图:

温馨提醒:千万别忘了插上网线!!!

原文地址:https://www.cnblogs.com/zxRPI/p/2942049.html