1. Requirements:
The project needs to add a USB network card to the Respberry pi, which needs some network setup for this NIC when the Respberry pi is started.
2. Implementation options:
(1) Add the following code to the/etc/rc.local file:
if [-x/etc/mynet.conf]; Then/etc/mynet.conf &fi
(2) Complete the mynet.conf script and put it in the/etc/directory, the contents of mynet.conf are as follows:
#! /bin/bashwhile! IW Dev wlan1 Info &>/tmp/netlog; Do sleep 0.2 did ifconfig wlan1 down IWS dev Wlan1 interface add ah0 type IBSS ifconfig ah0 up IW Dev ah0 ibss Join Rpi-ah0 2462 ifconfig ah0 192.168.2.6 route add 192.168.1.102 GW 192.168.1.102 Dev wlan0 route add 192.168.2.102 GW 192.168.2.102 Dev Ah0
(3) Set mynet.conf file executable permission, open terminal Enter the following command:
sudo chmod 755/etc/mynet.conf
This article is from the "Wauoen" blog, make sure to keep this source http://7183397.blog.51cto.com/7173397/1834360
Raspberry Pi 3 Self-booting set USB NIC IP