打开主菜单

Wiki-Orange Pi β

更改

以太网口测试

添加3,509字节, 2023年4月24日 (一) 15:03
创建页面,内容为“1) 首先将网线的一端插入开发板的以太网接口,网线的另一端接入路由器,并确保网络是畅通的<br><br> 2) 系统启动后会通过 ''…”
1) 首先将网线的一端插入开发板的以太网接口,网线的另一端接入路由器,并确保网络是畅通的<br><br>
2) 系统启动后会通过 '''DHCP''' 自动给以太网卡分配 IP 地址,'''<span style="color:#FF0000">不需要其他任何配置</span>'''<br><br>
3) 在开发板的 Linux 系统中查看 IP 地址的命令如下所示<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''ip addr show eth0'''<br>
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000<br>
link/ether 4a:fe:2b:3d:17:1c brd ff:ff:ff:ff:ff:ff<br>
inet '''<span style="color:#FF0000">192.168.1.150</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0 valid_lft 43150sec preferred_lft 43150sec<br>
inet6 fe80::9a04:3703:faed:23be/64 scope link noprefixroute
|}
{| class="wikitable" style="width:800px;background-color:#ffffdc;"
|-
|当使用 '''ifconfig''' 查看 IP 地址时,如果提示下面的信息,是因为没有加 '''sudo''' 导致的,正确的命令是:'''sudo ifconfig'''<br><br>

orangepi@orangepi:~$ '''ifconfig'''<br>
Command 'ifconfig' is available in the following places<br>
/sbin/ifconfig<br>
/usr/sbin/ifconfig<br>
The command could not be located because '/sbin:/usr/sbin' is not included in the PATH environment variable.<br>
This is most likely caused by the lack of administrative privileges associated with your user account.<br>
ifconfig: command not found<br>
|}
{| class="wikitable" style="width:800px;background-color:#ffffdc;"
|-
|开发板启动后查看 '''IP''' 地址有三种方法:<br>
1. 接 '''HDMI''' 显示器,然后登录系统使用 '''ip addr show eth0''' 命令查看 IP 地址<br>
2. 在调试串口终端输入 '''ip addr show eth0''' 命令来查看 IP 地址<br>
3. 如果没有调试串口,也没有 '''HDMI''' 显示器,还可以通过路由器的管理界面来查看开发板网口的 '''IP''' 地址。不过这种方法经常有人会无法正常看到开发板的 '''IP''' 地址。如果看不到,调试方法如下所示:<br>
A) 首先检查 '''Linux''' 系统是否已经正常启动,如果开发板的绿灯在闪烁了,一般是正常启动了,如果只亮红灯,说明系统都没正常启动;<br>
B) 检查网线有没有插紧,或者换根网线试下;<br>
C) 换个路由器试下(路由器的问题有遇到过很多,比如路由器无法正常分配'''IP''' 地址,或者已正常分配 '''IP''' 地址但在路由器中看不到);<br>
D) 如果没有路由器可换就只能连接 '''HDMI''' 显示器或者使用调试串口来查看 '''IP'''地址。<br>

另外需要注意的是开发板 '''DHCP''' 自动分配 '''IP''' 地址是不需要任何设置的。<br>
|}
4) 测试网络连通性的命令如下,'''ping''' 命令可以通过 '''Ctrl+C''' 快捷键来中断运行<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''ping www.baidu.com -I eth0'''<br>
PING www.a.shifen.com (14.215.177.38) from 192.168.1.12 eth0: 56(84) bytes of data. 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=56 time=6.74 ms<br>
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=56 time=6.80 ms<br>
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=56 time=6.26 ms<br>
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=56 time=7.27 ms<br>
^C<br>
--- www.a.shifen.com ping statistics ---<br>
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
|}<br>
8,460
个编辑