The development board is connected to the Internet through wifi in the virtual machine

This blog records the process of connecting the development board to the Internet through wifi.

Material:

  1. Osmo Technology EASY EAI Development Board
  2. power cable
  3. ADB debug line
  4. Development Board WIFI Receiver

0. The virtual machine must be connected to the Internet (in fact, it is not necessary):

https://blog.csdn.net/weixin_45824067/article/details/131904810

1. Connect through the ADB debugging cable and enter the development board

First, power up the development board, and connect the WIFI receiver and ADB debugging cable .

 When the fourth icon in the lower right corner of the VMare Workstation software lights up, it means that the ADB debugging cable is connected

 

Enter the EASY-EAI compilation environment:

~/develop_environment/run.sh

 Open a new terminal and enter the development board:

2. /etc/wpa_supplicant.confAdd the wifi information you want to connect to

Do not modify /etc/netpaln/99_config.yaml, use netplan to configure the network, I tried all night without success

Or follow the blogger's approach

Method for connecting wifi to development board linux (1) - Programmer Sought

First modify the content of the /etc/wpa_supplicant.conf file , only modify the content behind the network= of the file

network={
	ssid="wifi名字"
	psk="wifi密码"
	scan_ssid=1
        proto=WPA RSN
        key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
        pairwise=TKIP CCMP
        group=CCMP TKIP WEP104 WEP40
}

Then execute the following script so that wlan0 is assigned an ip address :

#关闭有线连接
ifconfig eth0 down
#打开无线连接
ifconfig wlan0 up
#杀死以前配置进程
killall wpa_supplicant
#启动wifi配置,使文件生效
wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
#启动有点慢,等一下启动完毕
sleep 3s
#杀死以前的dhcp进程
killall udhcpc
#启动dhcp获取ip
udhcpc -b -i wlan0
#static ip
#ifconfig wlan0 192.168.134.250 netmask 255.255.255.0
#route add default gw 192.168.134.1

Regarding the last step of the above script, if your development board does not have the udhcpc command, you can also get the ip like this

sudo dhclient wlan0

3. Modify the DNS server (for resolving domain names)

Modify the /etc/resolv.conf file as follows,  which can only take effect once

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

#nameserver 127.0.0.53
#options edns0
nameserver 8.8.8.8
nameserver 114.114.114.114 

In fact, these two DNS servers are the DNS settings in the blog of the virtual machine networking

Modify /etc/systemd/resolved.conf, mainly the last two lines

https://www.cnblogs.com/zlslch/p/5842237.html

In fact, /etc/resolv.conf is just a soft link to /etc/systemd/resolved.conf, so you should directly modify /etc/systemd/resolved.conf to set the DNS server to resolve domain names

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS=
#FallbackDNS
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
nameserver 8.8.8.8
nameserver 114.114.114.114

Execute the following command to save the changes from the cache

sync

3. Try to exit the board, and then enter to see if the board can be connected to the Internet

root@EASY-EAI-NANO:/# exit      解释:退出与板子
logout
developer@EASY-EAI-Develop:~$ adb shell   解释: 重新进入板子
root@EASY-EAI-NANO:/# ping www.baidu.com
PING www.a.shifen.com (14.119.104.189) 56(84) bytes of data.
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=1 ttl=54 time=36.0 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=2 ttl=54 time=39.9 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=3 ttl=54 time=48.2 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=4 ttl=54 time=45.6 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=5 ttl=54 time=38.9 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=6 ttl=54 time=43.7 ms
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq=7 ttl=54 time=125 ms
^C
--- www.a.shifen.com ping statistics ---
8 packets transmitted, 7 received, 12.5% packet loss, time 7003ms
rtt min/avg/max/mdev = 36.039/53.836/124.576/29.134 ms
root@EASY-EAI-NANO:/# ping www.baidu.com
PING www.a.shifen.com (14.119.104.254) 56(84) bytes of data.
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=1 ttl=54 time=28.2 ms
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=2 ttl=54 time=33.8 ms
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=3 ttl=54 time=37.5 ms
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=4 ttl=54 time=38.5 ms
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=5 ttl=54 time=41.1 ms
64 bytes from 14.119.104.254 (14.119.104.254): icmp_seq=6 ttl=54 time=43.5 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5009ms
rtt min/avg/max/mdev = 28.192/37.087/43.462/4.972 ms

It can be found that after exiting the board and then re-entering, the board is still connected to the Internet, and finally did it, woo woo woo

4. View the assigned ip address of the development board

To log in to the development board with SHH, you must know the IP address of the development board

root@EASY-EAI-NANO:/# ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 此处是Ip地址 netmask 255.255.255.0  broadcast 此处为广播地址
        inet6 fe80::ba13:32ff:fe8f:4716  prefixlen 64  scopeid 0x20<link>
        ether b8:13:32:8f:47:16  txqueuelen 1000  (Ethernet)
        RX packets 2166  bytes 103083 (103.0 KB)
        RX errors 0  dropped 39  overruns 0  frame 0
        TX packets 372  bytes 35756 (35.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

After working all night, I finally connected the development board to the Internet. As a novice, I am very grateful to the authors of the blogs quoted in the article! ! !

Guess you like

Origin blog.csdn.net/weixin_45824067/article/details/131904810
Recommended