第一范文网 - 专业文章范例文档资料分享平台

树莓派设定静态ip和dns

来源:用户分享 时间:2025/12/2 2:37:09 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

① 开机启动树莓派。

② 备份网络接口配置文件,卸载自带的dhcpcd5程序,命令如下:

1:su

2:cp /etc/network/interfaces /etc/network/interfacesbackup 3:apt-get purge dhcpcd5

4:cp /etc/network/interfacesbackup /etc/network/interfaces

5: 重启树莓派

③ 编辑网络接口配置文件(/etc/network/interfaces)

1:改动eth0的配置,就是树莓派自带网口的配置。

原文件有关网口eth0的配置内容如下: auto eth0

allow-hotplug eth0 iface eth0 inet manual

将上面这几行改为:

auto eth0

allow-hotplug eth0 iface eth0 inet static

address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1

dns-nameservers 221.228.255.1 #dns地址,只需要在对外网的eth中配置 dns-nameservers 8.8.8.8 #dns备用地址

2:如果装有usb转RJ45设备,那么按照上面的eth0方式增加或修改对网口eth1、eth2...ethx的配置即可。

例如:一个树莓派自带网口,两个usb转RJ45设备,配置成三个网段: auto eth0

allow-hotplug eth0 iface eth0 inet static address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1

dns-nameservers 221.228.255.1 #dns地址,只需要在对外网的eth中配置 dns-nameservers 8.8.8.8 #dns备用地址

auto eth1

iface eth1 inet static address 192.168.2.2 netmask 255.255.255.0 gateway 192.168.2.1

auto eth2

iface eth2 inet static address 192.168.3.3 netmask 255.255.255.0 gateway 192.168.3.1

④ 重启树莓派即可。

搜索更多关于: 树莓派设定静态ip和dns 的文档
树莓派设定静态ip和dns.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c9nvby83tz58xzkp047nw_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top