# WiFi Tethering

**URL:** <https://community.solid-run.com/t/wifi-tethering/694>\
**Category:** NXP i.MX8M Plus\
**Created:** [August 1, 2023, 8:04pm UTC](https://community.solid-run.com/t/wifi-tethering/694 "2023-08-01T20:04:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 1, 2023, 8:04pm UTC](https://community.solid-run.com/t/wifi-tethering/694/1 "2023-08-01T20:04:32Z")

</div>

Hello all,  
Anyone who has implemented or can implement the WiFi Tethering function, please advise.

I got the below information from Chat gpt.  
it is possible to control both AP (Access Point) and STA (Station) functionalities simultaneously without the need for a virtual wireless interface. Some wireless chips, like the Broadcom BCM43455, support concurrent operation, allowing a single physical wireless interface to handle both roles.  
is this right?  
I would appreciate it if you could give me the specific commands to implement tethering.

Looking forward to a positive response.  
TianLong

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 2, 2023, 4:09am UTC](https://community.solid-run.com/t/wifi-tethering/694/2 "2023-08-02T04:09:51Z")

</div>

The phy is able to do both simultaneously but the virtual interfaces are still need for controlling the two interfaces separately from userspace. If you have connman installed the simplest method is to enable tethering mode, `tether wifi on <ssid> <passphrase>`, and then use connmanctrl to connect to your access point. Connmand will take care of setting up the forwarding, NAT, and DHCP/DNS for the clients that connect to the AP.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 2, 2023, 3:51pm UTC](https://community.solid-run.com/t/wifi-tethering/694/3 "2023-08-02T15:51:59Z")

</div>

Thanks for answering.  
I have one question.  
I keep getting errors in the wireless settings, but I think there is a problem with the kernel.  
Is the Yocto layer (“meta-murata-wireless”) added to SolidRun/meta-solidrun-arm-imx8?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 2, 2023, 4:22pm UTC](https://community.solid-run.com/t/wifi-tethering/694/4 "2023-08-02T16:22:51Z")

</div>

It is not, we include the firmware tested for our devices directly in our BSP. Are you using our kirkstone meta-layer? What errors are you getting?

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 2, 2023, 4:27pm UTC](https://community.solid-run.com/t/wifi-tethering/694/5 "2023-08-02T16:27:13Z")

</div>

Yes, I’m using kirkstone-imx8m.

root@imx8mpsolidrun:~# wpa\_supplicant -B -i wlan0 -c /etc/wpa\_supplicant.conf  
Successfully initialized wpa\_supplicant  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: k[54.660975] ieee80211 phy0: brcmf\_cfg80211\_add\_iface: iface validation failed: err=-16  
ernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
nl80211: kernel reports: Match already configured  
Failed to create interface p2p-dev-wlan0: -16 (Device or resource busy)  
nl80211: Failed to create a P2P Device interface p2p-dev-wlan0  
P2P: Failed to enable P2P Device interface

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 2, 2023, 4:38pm UTC](https://community.solid-run.com/t/wifi-tethering/694/6 "2023-08-02T16:38:53Z")

</div>

This is most likely because connmand or networkmanagerd is already controlling the interface. If you want to manually configure the interfaces then you need to exclude them from being controlled by the networking daemons, or disable the networking daemons running.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 2, 2023, 5:46pm UTC](https://community.solid-run.com/t/wifi-tethering/694/7 "2023-08-02T17:46:19Z")

</div>

I added the following command to the local.conf file when building core-minimal-image.  
DISTRO\_FEATURES:append=" bluez5 bluetooth wifi iw wpa-supplicant packagegroup-tools-bluetooth"  
Isn’t this necessary?

Is it possible to implement the wifi tethering function only with the initial core-minimal-image build image?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 3, 2023, 4:24am UTC](https://community.solid-run.com/t/wifi-tethering/694/8 "2023-08-03T04:24:00Z")

</div>

yes this is possible, but by default Yocto still has wpa\_supplicant services that start on boot. You need to shutdown and or disable them if you want to run wpa\_supplicant from the commandline.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 8, 2023, 3:17am UTC](https://community.solid-run.com/t/wifi-tethering/694/9 "2023-08-08T03:17:13Z")

</div>

Hello,  
Please check my commands for configuring WiFi tethering.

#ifconfig wlan0 up  
#iw dev wlan0 interface add wlan1 type \_\_ap  
#ifconfig wlan1 192.168.2.1 up  
#wpa\_supplicant -D nl80211 -i wlan0 -c /etc/wpa\_supplicant.conf -B  
#wpa\_cli -p /var/run/wpa\_supplicant -i wlan0 status  
#udhcpc -i wlan0 up  
#hostapd /etc/hostapd.conf -B

But my phone couldn’t connect to wlan1 AP.  
Does it need a DHCP server for wlan1 configuration?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 8, 2023, 3:47am UTC](https://community.solid-run.com/t/wifi-tethering/694/10 "2023-08-08T03:47:19Z")

</div>

yes, wpa\_supplicant doesn’t handle the networking configuration. That is why using a networking daemon makes the entire setup much simpler.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 8, 2023, 3:50am UTC](https://community.solid-run.com/t/wifi-tethering/694/11 "2023-08-08T03:50:56Z")

</div>

Is the networking daemon you’re talking about networkmanager or nmi?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 8, 2023, 4:20am UTC](https://community.solid-run.com/t/wifi-tethering/694/12 "2023-08-08T04:20:44Z")

</div>

The default one shipped with NXP’s BSP is connmand, but NetworkManager is also an option I have documented how to include it at the end of the Kirkstone readme

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 10, 2023, 1:34pm UTC](https://community.solid-run.com/t/wifi-tethering/694/13 "2023-08-10T13:34:26Z")

</div>

Tested wifi tethering like below.  
#iw dev wlan0 interface add wlan1 type \_\_ap  
#ifconfig wlan1 192.168.2.1 up  
#wpa\_supplicant -i wlan0 -c /etc/wpa\_supplicant.conf -B  
#udhcpc -i wlan0 up  
#hostapd /etc/hostapd.conf -B  
#sysctl -w net.ipv4.ip\_forward=1  
#iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE  
#iptables -A FORWARD -i wlan1 -j ACCEPT

it is working fine.  
but tethering allows us to connect one device at a time.  
if we disconnect the first one, the second one gets connected.  
Would you please check if there is an option to connect multiple devices?

I attached hostapd.conf  
interface=wlan1  
ssid=TetheringTest  
hw\_mode=g  
channel=7  
wmm\_enabled=0  
macaddr\_acl=0  
auth\_algs=1  
ignore\_broadcast\_ssid=0  
wpa=2  
wpa\_passphrase=12345678  
wpa\_key\_mgmt=WPA-PSK  
wpa\_pairwise=TKIP  
rsn\_pairwise=CCMP

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [August 10, 2023, 1:50pm UTC](https://community.solid-run.com/t/wifi-tethering/694/14 "2023-08-10T13:50:41Z")

</div>

What dhcp server are you running to provide networking to the connected devices? You should enable verbose logging for all the daemons and see what configuration is disallowing device connections. There are no hardware limitations regarding this.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 10, 2023, 1:52pm UTC](https://community.solid-run.com/t/wifi-tethering/694/15 "2023-08-10T13:52:19Z")

</div>

I’m using dnsmasq.

/etc/dnsmasq.conf  
interface=wlan1  
dhcp-range=192.168.2.10,192.168.2.100,255.255.255.0,24h  
server=8.8.8.8  
server=8.8.4.4

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 11, 2023, 2:55am UTC](https://community.solid-run.com/t/wifi-tethering/694/16 "2023-08-11T02:55:25Z")

</div>

Now, up to 3 phones are connected, but the 4th phone fails.  
One of the three phones that are already connected must be disconnected before the fourth phone is connected.  
I looked at the log of hostapd daemon.  
There is no log in hostapd while the phone tries to connect and fails.

---

<div class="post-metadata">

**Author:** ![TianLong](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@TianLong](https://community.solid-run.com/u/TianLong)\
**Post date:** [August 11, 2023, 10:25am UTC](https://community.solid-run.com/t/wifi-tethering/694/17 "2023-08-11T10:25:24Z")

</div>

P2P interface must be present to enable tethering mode using connman?

> **[GitHub - SolidRun/meta-solidrun-arm-imx8 at kirkstone-imx8m](https://github.com/SolidRun/meta-solidrun-arm-imx8/tree/kirkstone-imx8m)**
>
> kirkstone-imx8m

I built the above github, there is no p2p interface.

I tested it by adding connman in Yocto, but the error below comes out.  
IMAGE\_INSTALL:append = “iw wpa-supplicant hostapd dnsmasq iptables connman connman-client”

root@imx8mpsolidrun:~# connmanctl tether wifi on APTest 12345678  
Wifi SSID set  
Wifi passphrase set  
Error enabling wifi tethering: Permission denied
