Creating Wifi AP Hotspot on Jetson Nano

Dear all,

I’ve recently purchased a Jetson Nano board and set up the SD card & HDMI without a problem. I’ve also purchased an Edimax EW-7811Un (Realtek RTL8188CUS chipset) and the device connects to wifi correctly too (in fact I’m currently writing this question on the Jetson Nano).

However, I run into some problems when trying to set up wifi AP connection on the board. Similar to my previous projects with Raspberry Pi, I’m trying to set it up such that it (1) connects to the current Wifi network (2) establishes an AP hotspot such that e.g. PC and phones can connect and ssh into it with a static ip address, and optionally (3) share the network through the AP (similar to a wireless repeater) to the devices connected. Such a setup allows one to use a PC/phone to control the board conveniently without needing an external monitor or keyboard/mouse.

I’ve tried the library create_ap made by the user OBLiQUE at https://github.com/oblique/create_ap. However, when I tried setting up

sudo create_ap wlan0 wlan0 Nano

the terminal shows the error

ERROR: Your adapter can not be a station (i.e. be connected) and an AP at the same time

which probably means that the adapter doesn’t support working as an AP and a WiFi client at the same time. Therefore, I’ve bought another identical Edimax adapter, and used the command

sudo create_ap wlan1 wlan0 Nano

the terminal seems to attempt at creating a network, but returns the following message

WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
WARN: If AP doesn't work, please read: howto/realtek.md
Config dir: /tmp/create_ap.wlan1.conf.TuzyWi4G
PID: 11749
Network Manager found, set wlan1 as unmanaged device... DONE
Sharing Internet using method: nat
iptables: No chain/target/match by that name.

Doing cleanup.. done

and the hotspot does not show up. I’ve also tried to use the idle adapter (wlan1) to simply create an AP without network connection with

sudo create_ap -n wlan1 Nano

, but it shows the same error of “iptables: No chain/target/match by that name.”

I’ve installed the library dependencies including hostapd, iproute2, iw, dnsmasq, iptables, but still create_ap does not work properly. (On the other hand, I tried to use the system GUI to create a hotspot in the system settings, and the adapter is indeed able to work in AP mode - but in this case the system GUI doesn’t provide any option for sharing network from one adapter to the other, neither does it set a static ip address for the Nano to be sshed into).

May I ask if anyone has tried create_ap on a Jetson system before (or is familiar with the library and might know what causes the “iptables” error)?

Alternatively, I’ve also tried to do it the manual way, and followed some previous tutorials I used for Raspberry Pi such as Setting up a Raspberry Pi 3 as an Access Point - learn.sparkfun.com, (i.e. setting /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf to connect to wifi, using /etc/dhcp.conf, /etc/dnsmasq.conf, /etc/hostapd/hostapd.conf to set up DHCP for the AP hotspot, and using NAT with iptables to redirect traffic from wlan0 to wlan1), but it seems that the files layout is very different on the Linux for Tegra system, and for instance modifying /etc/network/interfaces causes the system to not be able to recognize the adapter correctly. (It seems the system is using a “Network Manager” package to manage wifi).

May I ask if it’s possible to manually setup wifi, hostapd, iptables to share internet over a hotspot on Jetson? (For people with experiences with Raspberry Pi too) what would be the differences between setting it up on Raspbian versus Linux for Tegra? Also, if possible, may I ask if there might be any tutorials on Wifi setup for Jetson systems online?

Thank you very much for the help!

Yours Sincerely,
Mike

2 Likes

I don’t know what happens to this script (create_ap) since this is not from NV.

Are you able to configure the wifi by using ubuntu GUI?

Thanks for the reply. Yes, in addition to create_ap I’ve also tried to use the GUI (in settings → network) to create a hotspot, with which I can see a hotspot being successfully established, and my other devices (phone, PC) can connect to it. However, I don’t know how to use this system hotspot utility to set it up in command line, and therefore cannot for instance set it up with a static ip. (Also, setting up /etc/interfaces seems to result in a static ip for the adapter, but causes it to become “unmanaged” and appear as disabled in the system network manager list on the upper-right corner).

May I ask if there are options to use the system hotspot utility in command line - or in some ways customize the configurations (ip address, DHCP parameters)? Also, is there any way to set up a static ip for the interface, and to use e.g. dnsmasq+iptables to reroute the network from another wlan interface to the hotspot?


I’ve actually also tried to use hostapd to establish a hotspot, but it seems that the Edimax adapters (RTL8188CU/RTL8192U) don’t support the vanilla hostapd (it requires the rtl871xdrv driver rather than traditional nl80211), and the custom-compiled one somehow doesn’t work on Linux for Tegra system here. This is actually quite curious since the system hotspot utility can in fact establish AP through this adapter (perhaps is it because it’s using a different library than hostapd)?

Overall as it’s among the two recommended WiFi adapters (the other one being intel’s 8265) on the official BOM for the JetBot based on Jetson Nano, and the “supported components list”:

and since setting up AP is perhaps not uncommon for “screenless” setups, I was wondering if in fact there might be anyone who has run into similar problems as I did here.

(Also, initially I’ve picked the Edimax adapters since it seems that USB interface is easier to install and that the intel one requires antennae which are rather hard to get my hands on here in Canada, but now that I’ve run into some problems with the Edimax adapters, I’ve just ordered a set of intel 8265 + antennae from Arrow.com to try it out too, and I’ll post the results when I receive the intel card too.)

Could you check if the op_mode is set to 2 when using command line to enable wifi ap?

https://elinux.org/Jetson/TX1_WiFi_Access_Point

Yes, at first I couldn’t see the hotspot on my phone, and after using

options bcmdhd op_mode=2

The hotspot shows up. However, for the one established with system utility I don’t really know how to set it up with a static IP address (so I can’t ssh into it) while with hostapd the driver seems to be incompatible with the Edimax adapter (depending on the configuration file either the hotspot shows up but the device cannot connect, or the hotspot cannot be initialized).

You will need dhcp server to assign IP to your device.
If there is no dhcp server, you could just assign IP to device manually and check if any two devices can ping each other.

For installing dhcp server

sudo apt-get install isc-dhcp-server

Locate and edit "/etc/default/isc-dhcp-server"
     DHCPD_CONF=/etc/dhcp/dhcpd.conf
     INTERFACES="wlan0"

Locate and edit "/etc/dhcp/dhcpd.conf"
      default-lease-time 600;
      max-lease-time 7200;
      option subnet-mask 255.255.255.0;
      option broadcast-address 192.168.2.255;
      option routers 192.168.2.1;
      option domain-name-servers 10.24.4.101, 10.24.4.102, 10.25.20.252;
      subnet 192.168.2.0 netmask 255.255.255.0 {
      range 192.168.2.10 192.168.2.100;
      range 192.168.2.150 192.168.2.200;
     }

Thanks a lot! I’ll give it a try on the Jetson Nano board.

Also, may I ask if there are any commands to start the hotspot in command line? (Or, alternatively, set up the AP to start automatically at boot time?)

In fact, I don’t work on wifi ap on latest platform.

If you don’t use hostapd, I guess you could use networkmanager.

sudo service network-manager start
nmcli nm wifi off
nmcli nm wifi on
nmcli con up id AP_ID

I am also checking this on my side.

Many thanks for the help!

I think this one should work.

# nmcli con add type wifi ifname wlan0 mode ap con-name WIFI_AP ssid MY_AP
# nmcli con modify WIFI_AP 802-11-wireless.band bg
# nmcli con modify WIFI_AP 802-11-wireless.channel 1
# nmcli con modify WIFI_AP 802-11-wireless-security.key-mgmt wpa-psk
# nmcli con modify WIFI_AP 802-11-wireless-security.psk 11223344
# nmcli con modify WIFI_AP ipv4.method shared
# nmcli con up WIFI_AP

Please change the ifname if it is not wlan0.

Thanks a lot for the advice! I’ve tried this new method (using isc-dhcp-server and modifying dhcpd.conf, combined with nmcli parameters that work with the network manager) and it successfully establishes an AP, and better still, it actually automatically forwards the traffic from wlan0 (WiFi) to wlan1 (AP) with a bridge br0 (perhaps it’s automatically created by the system?) so all the connected devices can reach the network too.

There are still some small problems such as:
(1) the nmcli lines that set WPA-PSK security and the key somehow doesn’t work (if password is set, the device complains wrong password) so I currently have to use an open hotspot
(2) the wlan0 connection to the WiFi intermittently drops (and sometimes reconnects after half a minute, or sometimes requires manually using sudo nmcli connection up uid [UID] to restart the connection). I’m not sure if this is the problem of the software, of the adapter, or simply due to a problem in the University WiFi hotspot created by the shared router in the residence I live in - although my other devices only very occasionally have problems with the University WiFi. I’ll do some more testing and also some comparison when I get my hands on the intel card too, and I’ll post the results here if there is anything new.
(3) While SSH now works perfectly, somehow VNC (e.g. tightvncserver) doesn’t work well on the L4T system here, and the Ubuntu-native “desktop sharing” causes an Ubuntu internal error when clicked in GUI, similar to described in Ubuntu Internal error when selecting desktop sharing in settings. - Jetson Nano - NVIDIA Developer Forums , while using command line /usr/lib/vino/vino-server somehow can only establish a VNC connection for a few seconds before freezing. I don’t know if there is anything specific to the L4T system or the version of Ubuntu used - although, this probably should belong to a seperate question post. I’ll do some more testing and come back with a question if VNC is still problematic.

Overall, your proposed method solves the problem nicely! Many thanks again!

For question (3), if I remembered correctly (based on my knowledge on old tx1/tx2 platform/release), VNC requires a virtual display for remote access.
However, the display controller in L4T does not provide any by default unless you have any physical monitor connected. I think you could try below command on nano first.

export DISPLAY=:0
xrandr

Hi Wang.
I have the same problem as you on TX2 and I would like to know how your NetworkManager is configured.
I also tried using create_ap, which also reported iptables: No chain/target/match by that name.
I created an AP by clicking “Edit Connections” in the Network list in the upper right corner of the ubuntu desktop, but there was a prompt that said “Disconnected Wireless Network” when I clicked “Create New wi-fi Network” to use the AP.
I typed the following command:

sudo nmcli con up my_wifi 
Error: Connection activation failed

The ubuntu desktop displays “Disconnected Wireless network” whenever I try to open hot spots.
I tried rebooting NetworkManager

sudo service NetworkManager restart

Display “Disconnected-you are now offline” in the upper right corner of the ubuntu desktop.
I am sure that there is no problem with the AP I created, because I did it exactly according to the results of the Internet search, and occasionally I connected successfully,but most of the time it will prompt “Disconnected Wireless Network”, I think it should be the problem of network configuration.
I am a novice and don’t know much about Linux network configuration. I hope you can help me. Thank you very much!
Are you Chinese?My English level is not very good, if you think the words read above feel very bad, I suggest you directly copy into the translation software, it may be more convenient.
Looking forward to your reply. Thank you very much.:)

I think I’ve solved the problem of hot spots not opening.
I successfully created AP in the way of [url]http://variwiki.com/index.php?title=Wifi_NetworkManager[/url] and successfully con up it, without using the graphical interface to create AP(settings-> network->Edit Connections). Although it is not clear why this will be successful, no longer appear “Disconnected Wireless network”, at least it solved my problem and my project can finally move on.
Thank you very much for wang and NV Forums.

Hi,

I have created AP and was able to connect the hotspot with my laptop however the connection was very unstable and it just kept dropping out. Do you have any ideas to solve it?
Thanks!

Hi,

I set up the connection using these commands:

nmcli con add type wifi ifname wlan0 mode ap con-name WIFI_AP ssid MY_AP

nmcli con modify WIFI_AP 802-11-wireless.band bg

nmcli con modify WIFI_AP 802-11-wireless.channel 1

nmcli con modify WIFI_AP 802-11-wireless-security.key-mgmt wpa-psk

nmcli con modify WIFI_AP 802-11-wireless-security.psk 11223344

nmcli con modify WIFI_AP ipv4.method shared

nmcli con modify WIFI_AP ipv4.addr 192.168.5.1/24

nmcli con up WIFI_AP

The connection worked the first time but after reboot it is not connecting anymore.
When I run the nmcli con up WIFI_AP command, i keep getting the following error message:
Error: Connection activation failed: 802.1X supplicant took too long to authenticate.

I even tried restarting the network manager but it did not help.
Any ideas?

In Ubuntu 18, it’s now possible to easily create a hotspot through the GUI. Full instructions are here:

tl;dr:

Click “turn on wifi hotspot” under the hamburger in wifi settings in settings.