首页 > 解决方案 > 如何将主机 PC 连接到 ZedBoard 并共享主机 PC 互联网访问?

问题描述

我尝试使用我的主机 PC 连接到一个 digilent ZedBoard,我可以使用 UART 进行连接,但我无法通过 ssh 进入开发板或进一步使用我的主机 PC 互联网连接通过 ZedBoard 访问互联网。

我应该如何设置?

标签: connectionfpgaethernetzynqsoc

解决方案


我们将完成使用UART以太网端口与digilent Zedboard 通信的步骤。

使用 UART 端口

将主机 (USB) 连接到 zedboard 的 UART 端口 (micro USB) 并在主机上执行:

# Install minicom
apt update && apt install minicom
minicom –D /dev/ttyACM0 –b 115200 -8 -o 

恭喜,您已连接到 zedboard * 如需 minicom 帮助:CTRL+a z * 退出 minicomCTRL+a x

使用开发板的以太网端口连接

使用主机系统上的以太网端口或以太网到 USB 适配器将 zedboard 连接到主机。默认情况下,zedboard 的操作系统将 eth0 配置为具有以下静态 IP:192.168.1.10

在主机上配置:

  1. 网络连接>(选择zedboard的连接接口)>编辑> IPv4设置:
  2. 更改MethodManual
  3. 将地址编辑为:192.168.1.1
  4. 将网络掩码编辑为:255.255.255.0

使用主机上的菜单断开并连接到您刚刚配置的接口。

  • 通过以下方式连接到电路板:ssh root@192.168.1.10

与 zedboard 共享您的 PC 互联网

网络连接 >(选择连接接口)> 编辑 > IPv4 设置:* 更改MethodShare to other computers

使用主机上的菜单断开连接并连接到刚刚配置的接口执行ip addr并确认正在共享的连接接口的ip

  • 10.42.0.1在我的机器上(这在你的机器上可能不同

使用 minicom 连接到板(见上文)。

在 ZedBoard 中:

  1. 编辑文件/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.42.0.10
netmask 255.255.255.0
gateway 10.42.0.1
  1. /etc/resolv.conf并通过编辑文件来修复您的 DNS 解析器
nameserver 10.42.0.1

执行命令更改 zedboard 的配置

ifdown eth0; ifup eth0

瞧!此时应该能够在以下位置 ping 您的主机:

root@localhost:~# ping 10.42.0.1
PING 10.42.0.1 (10.42.0.1) 56(84) bytes of data.
64 bytes from 10.42.0.1: icmp_req=1 ttl=64 time=0.424 ms
64 bytes from 10.42.0.1: icmp_req=2 ttl=64 time=0.498 ms

8.8.8.8通过您的主机连接ping 一个 Internet 托管网站:

root@localhost:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=6.93 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=6.89 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=53 time=7.22 ms

如果您已/etc/resolv.conf正确设置,您还可以使用完整域名访问互联网:

root@localhost:~# ping www.google.com 
PING www.google.com (172.217.10.132) 56(84) bytes of data.
64 bytes from lga34s16-in-f4.1e100.net (172.217.10.132): icmp_req=1 ttl=53 time=7.02 ms
64 bytes from lga34s16-in-f4.1e100.net (172.217.10.132): icmp_req=2 ttl=53 time=7.20 ms

补充说明

要记住的文件

/etc/network/interfaces describes the network interfaces
/etc/hostname configures the nameserver credentials
/etc/hosts resolves IP addresses to hostnames
/etc/resolv.conf configure your DNS resolver

推荐阅读