您的位置:首页 > 理论基础 > 计算机网络

Raspberry Pi3 ~ 配置网络

2016-04-27 16:12 459 查看
Rpi3 有两个网卡 一个无线wlan 一个有线 eth0

无线的只需要在右上角的那个配置里面添加就行

有线的需要设置下静态IP、dns、等

在raspbain图形化界面里面 设置 Network Perferences

取消勾选 Auto matically configure empty options

然后配置

IP Address 192.168.3.169

Router 192.168.3.1

DNS Servers 61.153.177.196

重启下Rpi 3 即可

使用命令配置 这里参考的是 这篇博文

1、配置mac地址

sudo ifconfig eth0 down hw ether xx:xx:xx:xx:xx:xx
sudo ifconfig eth0 up


将上面两行代码复制进/etc/rc.local即可开机自动更改。

单独运行上面两行即可修改mac地址

2、设置IP与静态网关等

备份/etc/network/interfaces文件,并修改如下:

1)注释掉

iface eth0 inet dhcp


2)添加以下几行

# The loopback interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
#your static IP
address 192.168.3.169
#your gateway IP
gateway 192.168.3.1
netmask 255.255.255.0
#your network address "family"
network 192.168.3.0


其中network由IP决定,其最终结果为IP地址最后一位改为0

4)配置DNS服务器

在:/etc/resolv.conf中添加一条

nameserver  61.153.177.196


结束

若提示以下错误:

pi@raspberrypi:~$ ping 10.10.10.34
connect: Network is unreachable


解决方法 可以在/etc/rc.local中在ifconfig eth0 up后面加

/etc/init.d/networking restart &
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: