给树莓派设置固定IP

4,803 views次阅读
没有评论

如果要查看当前使用IP 可以输入 ifconfig

但这个是 动态获取 的IP ,为了使用方便设置一个固定IP 是必须的。

 

sudo vi /etc/network/interfaces

原文如下:

auto lo

 

iface lo inet loopback

iface eth0 inet dhcp

 

allow-hotplug wlan0

iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

 

可以看见 eth0 是动态dhcp获取IP,下面将 iface eth0 inet dhcp 修改如下:

iface eth0 inet static

address 192.168.1.88

netmask 255.255.255.0

gateway 192.168.1.1

这样树莓派的网口固定IP 就改成了:192.168.1.88

 

那无线IP呢?下面接着将 iface default inet dhcp 修改如下:

iface default inet static

address 192.168.1.89

netmask 255.255.255.0

gateway 192.168.1.1

同样的wlan0 改为固定IP 192.168.1.89

记得注释掉 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

 

修改后的 interfaces 内容如下:

auto lo

 

iface lo inet loopback

iface eth0 inet static

address 192.168.1.88

netmask 255.255.255.0

gateway 192.168.1.1

 

allow-hotplug wlan0

iface wlan0 inet manual

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet static

address 192.168.1.89

netmask 255.255.255.0

gateway 192.168.1.1

正文完
 0
HopoL
版权声明:本站原创文章,由 HopoL 于2016-01-16发表,共计876字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)

HopoL's Blog

文章搜索
最新评论
阿龙 阿龙 谢谢大佬分享
MickeyDee MickeyDee Cancell that, figured it out and it works, Much appriciated .
MickeyDee MickeyDee Hi Thanks for sharing, please clarify, do you mean Rename the folder "unraider-7.2.0" to unraider and copy it to the config . Thanks
lzdwudi lzdwudi 我也想试试 但我目前的版本是6.12.13 我不敢做大的动作
wice222 wice222 archive is demaged
tstUser01 tstUser01 Thanks for sharing!
saisu saisu how to install from scratch for noobs like me please :D What is GUID ??
Adrian Adrian How update works? Should we rename unraider file, do the update and rename back? from 7.2.0 to 7.2.1
步兵 步兵 哈喽 想请问一下文件是从老毛子网站下载的吗 因为怕有挖矿的后门 所以想了解确认一下 感谢
hpapagaj hpapagaj Thank you.