Jetson Nano creating WiFi AP on boot

Hello, this question is not specific to Jetson nano which probably could be replied by someone who understands linux networking.

I’m trying to create WiFi access point while at the same time I want my device to connect my home’s router as well. My device does not have GUI, I have used nmcli to connect to WiFi station without any problem. I also used hostapd and dnsmasq and configured them to create WiFi AP succesfully.

My problem is I’m opening WiFi AP via cable since I need to ifconfig-down to wifi card but this is problematic I want to create AP on boot so I can directly connect to Jetson’s WiFi.

sudo ifconfig wlan0 down
sudo iw dev wlan0 interface add ap0 type managed
sudo /etc/init.d/dnsmasq stop
sudo ifconfig ap0 192.168.33.1 netmask 255.255.255.0 up
sudo /etc/init.d/dnsmasq start
sudo /etc/init.d/hostapd start
sudo ifconfig wlan0 up

The above commands work for me to create AP but kinda breaks nmcli’s auto connection which connects the predefined network without asking and this is what I want.

I wrote systemd service that calls the above commands but it does not work all the time. I believe it’s because the timing of the call. Sometimes it creates AP (I can see it on my phone’s WiFi list) and jetson also connects to home router, but mostly it fails and I plug the cable and reconfigure the whole thing again.

I want to create persistent configurations so that I don’t need to define the above settings all the time. For example, I have found that I can create udev rule for command “iw dev wlan0 interface add ap0 type managed” now I see ap0 when I type ifconfig -a command.

Is there any example on this provided by Nvidia? I know this is not just related to jetson boards but I also couldn’t find an easy solution.

Sorry that we don’t have experience on this use ase, may other developers help to provide suggestions.

Apologies for not mentioning about my wifi card and some system specs.

WiFi card is intel ac8265 and my sistem had both wpa_supplicant and nmcli. I was using nmcli to connect to my home router.

I tried two different methods and wanted to share my information on the topic.

I knew that above commands work since after the boot I was entering via ssh to my device and running the above commands by hand and I was creating AP succesfully (though sometimes it was failing but didn’t get the idea why, later I did…).

  1. I deleted nmcli, I thought it was creating a problem working with wpa_supplicant together but deleting was a mistake. Everything became a problem. I was connecting to station via wpa_supplicant then I was running dhclient wlan0 as well to get the ip from the station. And then dns became problem since ping www.google.com didn’t work. So long story short, nmcli does some stuff under the hood and works ok. Does not create problem with AP mode. During experiment on wpa_supplicant + hostapd, problem still continued and I couldn’t run the above commands with success.

  2. After close investigation, I noticed hostapd system was throwing error about channel and hardware mode. I was trying to set 5GHz AP mode and specifically set to channel to 140 and hw_mode=a. I could swear I created 5GHz AP and connected to station at the same time but later I found these topics :
    How do we enable 5GHz wifi for the AC8265 - #10 by moezruo6
    So it says it is not available to create 5GHz AP mode because of a firmware restriction. So then I accepted the fate and turned my codes to create 2.4GHz AP.

Also for intel 8265, creating a virtual interface such as the following is not acceptable if you are gonna use ap0 and wlan0 together (although this worked for me sometimes, IDK why…). Because when we call ifconfig wlan0 up calling ifconfig ap0 up will throw busy error since card does not allow this.

sudo iw dev wlan0 interface add ap0 type managed

Instead ac8265 allow managed + ap mode, so I also changed

sudo iw dev wlan0 interface add ap0 type __ap

Because of my configurations ifconfig and hostapd were throwing errors, creating the virtual interface like this solved the problem of calling ifconfig up/down commands and I was able to create 2.4GHz AP after the boot.

If you also want to configure STA + AP together, an example github page for configurations GitHub - peebles/rpi3-wifi-station-ap: Raspberry Pi 3 WIFI Access Point + Station, though these examples use wpa_supplicant to connect to station.

Hope this helps to someone.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.