请选择 进入手机版 | 继续访问电脑版

 找回密码
 立即加入
搜索
查看: 5109|回复: 0

给树莓派设置静态ip地址

[复制链接]

43

主题

47

回帖

847

积分

管理员

积分
847
发表于 2016-6-12 21:05 | 显示全部楼层 |阅读模式 |回复 |
树莓默认的是动态ip地址,断电或重启后,ip地址可能会变,这给管理带来很大的不方便,我们当然得为树莓设置一个静态的ip地址。

方法如下

  1. sudo nano /etc/network/interfaces
复制代码
更改为如下
  1. # interfaces(5) file used by ifup(8) and ifdown(8)

  2. # Please note that this file is written to be used with dhcpcd
  3. # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

  4. # Include files from /etc/network/interfaces.d:
  5. source-directory /etc/network/interfaces.d

  6. auto lo
  7. iface lo inet loopback

  8. auto eth0
  9. allow-hotplug-eth0
  10. #iface eth0 inet manual
  11. iface eth0 inet static
  12. address 192.168.0.3
  13. netmask 255.255.255.0
  14. gateway 192.168.0.1

  15. allow-hotplug wlan0
  16. iface wlan0 inet manual
  17.     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

  18. allow-hotplug wlan1
  19. iface wlan1 inet manual
  20.     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
复制代码
其中,address这里改为你想要的,gateway就是路由器的地址

然重重启一下,reboot

完成
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

本版积分规则

Archiver|手机版|小黑屋|玉玲珑

GMT+8, 2024-3-29 20:35 , Processed in 0.026550 second(s), 24 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表