Raspberry Pi 3b--using 360wifi (small wifi, MI wifi) to open the hotspot

Source: Internet
Author: User
Tags get ip git clone

Objective

Raspberry Pi 3b board comes with a WiFi module, but the WiFi module can only turn on the network card mode or hotspot mode, that is, using its own WiFi hotspot, you can not connect to other WiFi. Of course, it's also a way to use your own WiFi to turn on hotspots and then plug in additional USB NICs to connect to the network. This article focuses on how to use the 360wifi type of USB network tab to open hotspots.

Hardware environment: Raspberry Pi 3b, 360 portable WIFI2 (small-degree wifi, MI wifi can be). One of the Raspberry Pi is used so far by the official latest system.
Purpose: Use 360wifi to turn on AP hotspots.

Introduction to the operating mode of USB card

USB card has two operating modes, NIC mode (ie STA mode) and hotspot mode (AP Mode)

Statement

Because of the current Raspberry Pi system, the mt7601 driver is built in (360wifi is using this chip), so when you insert 360wifi, the system will automatically recognize, then there is no problem. That is, if you only use 360wifi as a normal USB card, this article is not helpful to you. This article is aimed at the people who want to use 360wifi to open hot spots, because this information is relatively scarce, and the clutter does not look, this article after the practice of the summary and collation, wrote this article.

What kind of pits are there?

360wifi This kind of network card, its use is mt7601 this chip, the chip official has only STA mode source code, namely we can only use it as the ordinary network card. But in fact this network card is supported AP mode, but under Linux, especially in the arm environment, most of us can not download the ready-made drivers, so we can only compile themselves. I previously compiled in the ARM environment successfully over STA mode and AP mode network card driver, but this time to the raspberry, still met a lot of pits. first Pit, GCC.
We use the cat/proc/version command to view the system kernel and the GCC version of the compiled kernel, which I display as follows:

Linux version 4.9.59-v7+ (dc4@dc4-xps13-9333) (gcc version 4.9.3 (crosstool-ng crosstool-ng-1.22.0-88-g8460611)) #1047 S MP Sun Oct 12:19:23 GMT 2017

You can see that the kernel version is 4.9.59, and the GCC version used is 4.9.3. When I enter the Gcc-v command, but I see that the GCC version is 6.3+, yes, you did not see the wrong, the GCC version is much higher, the beginning of the time I did not care about this, I think the version is not a problem, the result I downloaded from the Internet drive source, either STA or AP, are compiled failed. So we must first adjust the GCC version to a similar version of the kernel, we install the 4.9 version of GCC here:
Uninstall the old GCC and g++ first:

Apt-get Remove gcc
apt-get Remove g++

Then install the 4.9 version of GCC and g++:

Apt-get Install gcc-4.9
apt-get Install g++-4.9

Once installed, use the GCC-V command again to check to confirm that GCC is version 4.9. The second pit, the kernel source .

If we want to compile the program on Linux, the kernel source code is not few, if you check the data from the Internet, most of the use of Rpi-source this command, in fact, there is more simple, is also the official recommendation, is directly using Apt-get install Raspberrypi-kernel-headers command, after this command is executed we can see more than two source directories under/USR/SRC, and they will also have a soft connection to the/lib/modules directory. The third pit, most of the source code on the Internet is not available, even including my original in other arm platform can compile the source code

If you search compiled 360wifi data, most will point to this article Xiaomi Wifi,linux under the AP Hotspot Drive (open source), if the previous pits you are filled, follow this tutorial is able to compile and load the driver, but you will find that the open hotspot.

If you continue to look for it online, you may find this information: Mt7601u-ap, which is the source code on GitHub, can compile normally. After compiling and installing, plug in 360wifi, you use the Ifconfig command will be horrified to find, there are 15 ra0 similar network cards, and can search ht_ap0 similar to 15 hot spots, this is why. Because the driver does not read the configuration file properly, 15 hotspots are created by default, and their names are the default names. Originally I tried to solve this bug, after some attempts, finally give up.

If these pits are filled, let's start compiling the AP driver.

Start by making sure that the GCC version is consistent with the kernel, and refer to the previous paragraphs to make them consistent. Install the kernel source code, also refer to the previous paragraph. Download AP Source: Polyvection/mt7601u-ap, note that the Git clone may fail, you can download the zip file directly. After downloading, copy it to the Raspberry Pi and unzip it, then CD command to get there. Perform the make command to compile and execute the make install command after successful installation because the Raspberry Pi has built-in mt7601 drivers, to prevent conflicts, we need to remove them first. Delete or rename the/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko file. Now plug in 360wifi, using the ifconfig command can see a lot of a network card called RA0, and the phone can see a hot spot called hd_mesh_1.

At this point, the 360wifi AP driver is compiled.

Configure and use the first step to modify the hotspot information. Edit the/etc/wireless/rt2870ap/rt2870ap.dat file with Notepad or the VI command:
SSID: Hotspot name AuthMode: Hotspot is using password Wpapsk: Hot spot Password The second step is to configure the IP of the hotspot itself. Directly modify the/etc/dhcpcd.conf file, add the following code, indicating that the IP of the RA0 network card is 192.168.99.1:

Interface ra0
Static ip_address=192.168.99.1/24

It is important to note that do not modify the/etc/network/interfaces file, yes do not change, will cause the system can not start, and the display has no output. The third step is to configure the DHCP service. In fact, we can already use the mobile phone to connect to the Raspberry Pi hotspot, but the phone will always show the get IP, this is because we have not turned on the DHCP service. Note that before you turn on the DHCP service, you should wait for the network card startup in Raspi-config to be configured to enable:
Enter the Raspi-config command, enter the boot options, and wait for network ... Configured as Enable. Install DHCP service: Apt-get Install isc-dhcp-server Configure DHCP service monitoring network card, edit/etc/default/isc-dhcp-server file, modify interfacesv4= "RA0" Configure the DHCP parameters, edit the/etc/dhcp/dhcpd.conf file, and add the following configuration:

Subnet 192.168.99.0 netmask 255.255.255.0 {
Range 192.168.99.50 192.168.99.250;
option routers 192.168.99.1;
}
Please refer to the configuration example in this file if you need a hotspot to access your own wifi. Restart the DHCPD service, the service dhcpd restart, which is powered on by default, so there is no need to configure boot boot again.
At this point, our 360wifi hotspot can be used normally.

If you do not want to build a driver, you can directly download the driver I have compiled: Raspberry Pi 3b under 360wifi (small wifi, MI wifi) AP hotspot Driver
Instruction for use: three KO files placed under/lib/modules/4.9.59-v7+/kernel/drivers/net/wireless/, where 4.9.59-v7+ represents the kernel version, the Raspberry Pi current system is in this location, such as the kernel version has changed , the RT2870AP.dat file is placed under/etc/wireless/rt2870ap/and created manually when the directory does not exist.

PS: If you also want to compile the driver of the STA, download this, this test is able to compile the normal use: Https://github.com/art567/mt7601usta

Finish.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.