树莓派更改静态IP 地址、网关、掩码 - 3步 速成法

树莓派在使用ssh远程登录(树莓派ssh设置允许条件下,官方因安全考虑,在2016年更新镜像版本后关闭了树莓派的 ssh)或者一些和其他接口对接交互的时候往往需要固定IP。

1、ifconfig 查看树莓派网卡信息。如未找到eth0或者相关的网卡。则ifconfig -a即可。

2、打开 /etc/network/interfaces (网络配置文件)

3、更改文件信息

enxb827eb3a3daa 为我的网卡信息,还未更改名称。可自己更改为eth0  具体百度即可

静态的就为iface enxb827eb3a3daa  inet static  + address + netmask + gateway

动态的为iface enxb827eb3a3daa  inet dhcp 屏蔽 address + netmask + gateway 即可

4、保存退出,之后service networking restart 重启网卡。报错一般为代码编写错误,细心点没问题。

5、reboot重启,更改即成功。

猜你喜欢

转载自blog.csdn.net/qq_37967635/article/details/83350617