Android phones do wireless relay routers

Source: Internet
Author: User

Why do you use your phone as a router? Because I'm going to take a matchbox-sized router (703n) every day. It provides a f-Q wireless network, computers, mobile phones, tablets and other devices connected to the wireless network after the free on Twitter, watching YouTube. But it's not ideal. , I don't want to cram a device in a crowded bag, and I want to be able to brush Twitter only if the 3G network doesn't have a USB power on the road. The best devices are mobile phones.

Phone to do FQ router The biggest flaw is that it's not a router. At the beginning, the mobile phone is at the end of the network, either receiving a 3G signal or receiving a WiFi signal. Later technology development, mobile phone began to have the function of wireless launch, this on the iphone called Personal hotspot, on Android called Softap. Although the mobile phone can emit wireless, but it can not bear the function of the router. As soon as the mobile phone starts transmitting wireless, the connected wireless network (uplink wireless) will be disconnected. In this way, the phone can only be a client, or only wireless hotspot. Only at the same time do the client, and do wireless hotspot to meet the requirements of mobile phone to do FQ router. Is there any way to do it? The most straightforward approach is to use 3G Internet for mobile phones and then provide wireless hotspots out. This ability basically now all smartphones can do. But 3G Internet is much more expensive AH.

Mobile phone can be connected to both uplink wireless, and open the wireless hotspot to share the environment to other devices? It's a dream I've been dreaming of. Now the dream has come true. Today don't talk about FQ this piece, alone how to turn the Android phone into a wireless relay router.

What is wireless relay? The preceding description is not very precise. The most accurate article on wireless networking is openwrt. The wireless relay I'm talking about is the routed Client mode-masqueraded in the article. is a device to add two subnets at the same time, with Iptables's masquerade function to proxy a subnet device to access another subnet. Masquerade A more commonly used name is NAT. Basically all the home wireless routers are the network of this mode.

There is an essential difference between a wireless relay router and a common network of home wireless routers. Ordinary wireless routers generally walk on the ADSL PPPoE, which is the wired network. The downside is to share the Internet of wired networks with other devices through wireless hotspots. Wireless relay is different, the uplink of wireless relay is a wireless network, is generally the home of the cat attached to the wireless router to share the wireless hotspot, and the downside is another wireless network. Therefore, the configuration of the wireless relay router is more troublesome than the normal router. A home wireless router that brushes the OpenWrt operating system (such as Tplink 703n) can easily implement wireless trunking because the OpenWrt itself is designed to support such a network, and its hardware is designed to be very generic (ar71xx) with few restrictions on how to use it. General wireless hardware manufacturers to divide the chip into three levels, such as Broadcom is divided into mobile phone bcm4334 (Galaxy S3), flat bcm43241 (Nexus 10), and fixed infrastructure (Infrastructure) bcm4360 (Asus rt-ac66u). OpenWrt applicable equipment is a wireless chip belonging to the infrastructure series. The chip of these routers is a professional wireless hotspot, so it is not surprising to support wireless relay. But mobile phone and tablet wireless chip and the wireless chip of these routers, although the same manufacturer, but because the use of the situation is completely different, support wireless relay becomes very difficult.

So, while Android is an ideal router platform, it's not easy to just turn an Android phone into a router. In the meantime, we have to cross these lines:

    • Whether the mobile phone wireless chip hardware itself supports wireless relay
    • Wireless relay is supported by the firmware (small operating system running on the wireless chip) used by the mobile phone's wireless chip
    • Whether the driver for the chip supports wireless relay
    • Whether the relevant startup commands on Android exist on the phone
    • A script that configures the wireless relay with the corresponding wireless chip
= = = User State = = = Script VV command (IW, P2P-CLI, etc.) V[via NetLink socket]=== kernel-state ===v driver (e.g. BCMDHD) V[via sdio]=== Another small machine ==v firmware (e.g. fw_bcm4330.b IN) VV hardware (e.g. bcm4330)

1th, 2, 3 is something you and I can't handle. If the hardware itself does not support, even the driver of a compilation parameters, ordinary users, even developers are difficult to handle. Because there is no stable ABI between the Linux kernel and the driver, there is no way to build a Linux-built driver to get another Linux. As long as the original wireless driver does not directly support wireless relay, so even if I can find the way to modify the driver, to tens of thousands of mobile phones, different Linux kernel configuration to compile the appropriate wireless driver is simply an unthinkable thing. Not to mention a lot of the core of mobile phones have no way to compile their own, if you want to force to go to the wireless driver's part is basically no solution.

The firmware of a wireless chip is something that is not normally noticed. It's lower than the wireless driver. Wireless driver is just a puppet of the line guy, the real work is actually the wireless chip firmware. This firmware is actually a complete operating system and is a standalone small machine. There are at least three complete machines in a cell phone, each with its own CPU and memory and code. The first one is the obvious Android with CPU. The second is a baseband (baseband) that provides voice calls. The third one is the WiFi chip and its firmware. So, if the phone wireless chip firmware does not support wireless relay, basically there is no solution. Because all of the wireless chip firmware is not open source (even if the corresponding driver is open source). And there are many kinds of chips, even the same model of the same batch of wireless chips, the corresponding firmware may have many different versions (such as some firmware support WAPI, China's wireless standard). Hardware this piece I don't quite understand. Perhaps the wireless chip really to the hardware level is similar, there is no support for wireless relay does not support the problem.

Fortunately, we can't solve the problem, Google can help us solve. Google has introduced support for WiFi direct in Android 4.0. Wi-Fi Direct is the standard for those vendors who provide wireless hardware. So 1th, 2, 3 will not become a problem. The original mobile phone support Android 4.0, basically meet the WiFi direct standard, it is likely to support wireless relay. This support means: Driver support, firmware support, hardware support. All we need to do is just copy the command and script from the start and execute it. Can be understood as digging up an Android phone is originally supported, but Android does not provide a "hidden feature" interface configuration.

Why does WiFi direct solve the problem with wireless trunking? WiFi Direct is actually a package of a user-friendly version of WiFi technology. The essence is that when you leave the wireless network environment, you can temporarily start a wireless network with a mobile phone, and then your friends around you can use the mobile phone to join your temporary wireless network, and then the two sides can do the big files and the like things. Its relative Bluetooth, the bandwidth is bigger. Ad-hoc networking is more secure than wireless. In addition, WiFi Direct also allows a device to provide both wireless hotspot and wireless client. That is, you can transfer files via Wi-Fi direct to other devices in the event that the phone's own wireless network is constantly dropped. However, this feature has a very serious hardware limitation, the mobile phone connected to the wireless, and the start of the wireless hotspot must be in the same channel (radio frequency is the same). This results in the actual use of the two devices are connected to their own wireless network (channel different) when the file can not be transmitted via WiFi direct. This has led to a lot of WiFi direct implementation of the Wi-Fi Direct mode when the first time to turn off the wireless network. However, Google and these hardware manufacturers in the design of the time is not so thought. The ideal situation is that future hardware can be developed to support multi-channel concurrency. In terms of status, the original support WiFi direct mobile phone, can be used to do wireless relay.

Although WiFi direct can be used to support wireless relay. But it does not mean that the only way to implement a wireless relay is through the WiFi direct command. The home wireless router can also do wireless relay after brushing the openwrt. We also don't see these routers supporting WiFi direct AH. That is because the wireless chip of these routers support Linux mac80211, simple is to use software to manage wireless chips, wireless chips do not have too much, software said what frame to send what frame. So does the wireless chip on the phone support mac80211? Really, that is the WL12XX series (Texas Instruments TI produced). Like wl1271, this chip is much older than Android 4. That was the chip smash hit's Motorola milestone. But unfortunately, the chip and firmware support is not enough, but also need to force the driver. WL12XX's mac80211 drive is relatively late, and the early use of the driver Tiwlan_drv does not support mac80211. So unless someone is willing to drive the new wl12xx to the early mobile phones, such as the Motorola milestone, these old phones won't be able to do wireless relaying. But new devices using the WL12XX series chip are using new WL12XX drivers, such as the Kindle Fire. These new devices not only support wireless relay without pressure, but may even be used to do more interesting things like wireless cracking.

OK, we've learned about a pre-condition. Either the original phone support WiFi direct, or the mobile phone using the wireless card driver is mac80211. So what exactly is the configuration process? This will be divided into different platforms. The mainstream mobile phone wireless chip has four series (this list crawls the GitHub source code base through the artificial crawler crawl cm

    • Bo Tong Department (BCM): bcm4325, bcm4329, "bcm4330, bcm4334, bcm43214".
    • German Instrument Department (WL): "wl1271, etc., collectively referred to as WL12XX"
    • Cottage System (MTK): "mt6620,mt6628"
    • Qualcomm: wcn1312, wcn1314, ar6002, ar6003, "wcn3660, not tested"

Of these four series, the first three of which I have tested, the Qualcomm system only the latest platform (for example, the Nexus 4) is possible to support wireless relay, because the device is more expensive, so I did not buy test. The chip in "" is available for testing, "" is beyond the hope of a relatively slim.

Both BCM and MTK start the wireless relay by using the WiFi direct command. The WL wireless Relay is a mac80211 method. The start-up mode of Qualcomm I guess it might be very similar to bcm4330. Either way, the process principle is similar:

    • No matter what means, make two WiFi interface, such as the default has a Wlan0 network card, and then get a ap0 kind of out
    • Keep Wlan0 wireless connected and try to start a wireless hotspot on the newly added WiFi interface
    • Configure the Ap0 IP address for the machine
    • Start the DHCP server, listen for ap0, assign IP addresses to incoming clients
    • Set the native Iptables rule (masquerade) so that the client through Ap0 can go out of the Internet from Wlan0

The current situation is, MTK's mobile phone in my mind has already 703n such a mini router pk down. For example, I now use the Lenovo P770 mobile phone, but the price of 1000, 4.5 of the screen, 3500 mah battery, dual sim, which was already enough cost-effective. Now add a wireless relay when the router, the future software support up, you can also do * * * router. Holding a cell phone like this is a bit of a U.S. soldier's feeling.

Android phones do wireless relay routers

Related Article

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.