树莓派3B设置静态IP,静态WIFI地址

树莓派3B设置静态IP

当身边没有路由时,想要电脑远程连接树莓派,有两种方法:除了电脑共享网络给树莓派的方法,还可以给树莓派配置eth0静态IP,方法如下:

1 打开如下配置文件

sudo nano  /etc/network/interfaces
2 注释下面语句
#iface eth0 inet manual
3  在其后增加语句:

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.10.1.100   #静态IP
netmask 255.255.255.0 #子网掩码
gateway 10.10.1.1     #网关

4 重启服务

sudo /etc/init.d/networking restart
5 验证是否配置成功,终端输入命令查看

ip add
若 eh0后出现10.10.1.100 IP,则配置正确

注:1 步骤3中#注释语句要删掉,不然会配置失败!

        2 电脑端设置同一网段10.10.1.X,且两者都通过有线方式连接同一路由时,也可以在此网段内通信。

树莓派3b设置静态WIFI地址方法

这个方法测试后可以完美设置树莓派3b静态WIFI地址,同时还不影响有线网络的连接,设置方法简单易行,最关键的是可靠。

原帖如下:我这样设置是可以的

/etc/network/interfaces:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

然后在/etc/dhcpcd.conf中最后加上:
interface wlan0
static ip_address=192.168.1.50/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

最后/etc/wpa_supplicant/wpa_supplicant.conf最后加上:
network={
ssid="xxxxx"
psk="xxxxx"
}

猜你喜欢

转载自blog.csdn.net/qq_15063463/article/details/83443302
今日推荐