Ubuntu
PC Configuration
Windows Security Center -> Firewall and Network Protection -> Turn off the firewall.
Configure the static IP of the RNDIS network card, open Settings -> Advanced Network Settings -> Change Adapter Options.
After connecting the development board, an unrecognized local network will appear on the PC side.
Share the PC network with the development board network.
Configure the development board network information.
Development Board Configuration
Add route information
sudo route add default gw 172.32.0.100
Add DNS servers
Open the file
sudo vi /etc/resolv.conf
Add the following content:
nameserver 8.8.8.8
Network test
ping www.baidu.com
Automatic configuration at startup
Route information and DNS servers will be cleared after a restart. We create a script to automatically complete the configuration for us after startup.
cd /etc/profile.d/
sudo vi usb_network.shAdd the following content:
#!/bin/sh
sudo route add default gw 172.32.0.100
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf > /dev/nullModify script permissions
sudo chmod 775 usb_network.sh
Configure the pico user to execute commands like route, tee, etc., without entering a password in the script.
sudo visudo
Add the following content:
pico ALL=(ALL) NOPASSWD: /usr/sbin/route, /usr/bin/tee
Network Test
View route information
pico@luckfox:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.32.0.100 0.0.0.0 UG 0 0 0 usb0
172.32.0.0 0.0.0.0 255.255.0.0 U 0 0 0 usb0View DNS servers
pico@luckfox:~$ cat /etc/resolv.conf
#......
nameserver 127.0.0.53
options edns0 trust-ad
search .
nameserver 8.8.8.8Network test
pico@luckfox:~$ ping www.baidu.com
PING www.a.shifen.com (183.2.172.42): 56 data bytes
64 bytes from 183.2.172.42: icmp_seq=0 ttl=51 time=10.357 ms
64 bytes from 183.2.172.42: icmp_seq=1 ttl=51 time=9.662 ms
64 bytes from 183.2.172.42: icmp_seq=2 ttl=51 time=8.473 ms
64 bytes from 183.2.172.42: icmp_seq=3 ttl=51 time=9.874 ms
64 bytes from 183.2.172.42: icmp_seq=4 ttl=51 time=10.498 ms
64 bytes from 183.2.172.42: icmp_seq=5 ttl=51 time=11.104 ms
64 bytes from 183.2.172.42: icmp_seq=6 ttl=51 time=9.385 ms
64 bytes from 183.2.172.42: icmp_seq=7 ttl=51 time=9.726 ms
64 bytes from 183.2.172.42: icmp_seq=8 ttl=51 time=11.111 ms
64 bytes from 183.2.172.42: icmp_seq=9 ttl=51 time=10.581 ms
^C--- www.a.shifen.com ping statistics ---
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min/avg/max/stddev = 8.473/10.077/11.111/0.776 ms