PYNQ上手 3.上网配置

可以先执行第4步测试下能不能ping通,不行的话回来从第一步执行

1.配置网关

由于/etc/network/interfaces是只读文件

可用 

sudo vi /etc/network/interfaces

sudo su
chmod 777 /etc/network/interfaces
vi  /etc/network/interfaces

如果设置动态IP

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
auto eth0
iface eth0 inet DHCP
source-directory /etc/network/interfaces.d

如果设置静态IP

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
auto eth0
iface eth0 inet static
address 192.168.50.223
netmask 255.255.255.0
gateway 192.168.50.1
source-directory /etc/network/interfaces.d

输完,ctrl+c,:wq!退出

2.配置DNS

打开/etc下的resolv.conf

vi /etc/resolv.conf

照下面代码更改,114.114.114.114与114.114.115.115是国内最多用的DNS服务器,也可使用谷歌的8.8.8.8与8.8.4.4

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
nameserver 114.114.114.114
nameserver 114.114.115.115
~
~

3.重启网络

/etc/init.d/networking restart

4.测试

先ping内网ip,注意我自己x是50,你们不一定是这个

ping 192.168.x.1

PYNQ上手 3.上网配置_第1张图片

再测外网61.139.2.39

ok

你可能感兴趣的:(PYNQ入门,ubuntu)