Linux Hotspot

0 views
Skip to first unread message

Leocricia Castellanos

unread,
Aug 3, 2024, 3:55:35 PM8/3/24
to esechproclac

I tried out linux' perf utility today and am having trouble in interpreting its results. I'm used to valgrind's callgrind which is of course a totally different approach to the sampling based method of perf.

Note: I found out that "E" unwraps the callgraph and gives somewhat more information. But the callgraph is often not deep enough and/or terminates randomly without giving information about how much info was spent where. Example:

Note: In the report step, -g graph makes the results output simple to understand "relative to total" percentages, rather than "relative to parent" numbers. --no-children will show only self cost, rather than inclusive cost - a feature that I also find invaluable.

Unless your program has very few functions and hardly ever calls a system function or I/O, profilers that sample the program counter won't tell you much, as you're discovering.In fact, the well-known profiler gprof was created specifically to try to address the uselessness of self-time-only profiling (not that it succeeded).

What actually works is something that samples the call stack (thereby finding out where the calls are coming from), on wall-clock time (thereby including I/O time), and report by line or by instruction (thereby pinpointing the function calls that you should investigate, not just the functions they live in).

Furthermore, the statistic you should look for is percent of time on stack, not number of calls, not average inclusive function time. Especially not "self time".If a call instruction (or a non-call instruction) is on the stack 38% of the time, then if you could get rid of it, how much would you save? 38%!Pretty simple, no?

Added: @caf got me hunting for the perf info, and since you included the command-line argument -g it does collect stack samples. Then you can get a call-tree report.Then if you make sure you're sampling on wall-clock time (so you get wait time as well as cpu time) then you've got almost what you need.

In Windows I can use Connectify Hotspot, which enables me to share the internet connection from the same wireless adapter as I am creating an access point on. As you can read on the technology overview page:

After I saw this link offered by vasishath, I managed to setup a wireless hotspot to share the internet connection from the same single wireless interface device. This wireless device must to use an Atheros driver that is already build with nl80211 support. Next I will show you how.

In wpa_supplicant.conf you must provide the settings of your current wireless network. See man wpa_supplicant for some quick examples. And you probably have more examples in /usr/share/doc/wpa_supplicant/ directory. I used something like:

Let me introduce you to an excellent tool that simplifys everything: create_ap (by oblique)
That is the official repository: _ap
This tool is part of Arch Linux repositories and should be in Ubuntu repositories too!
It is very easy to use and very effective.
To install it in Ubuntu you must first install the dependencies:

(no compilation with make is needed)
Easy, right?Well the rest is even easier... ...If your device is able to be used as a client and a PA at the same time (like atheros wifi chip - edit: some Intel chip too, see second comment bellow) you simply have to connect to your home router with network manager, as you usually do, and than you execute a command line like that:

And... That's it!Incredible and so easy!Now you just have to connect to the repeated network with your android device. You will see in your laptop terminal the handshake negotiated between your laptop and the client:And you can enjoy a nice bathroom session with internet... Everything is done with a single interface and with one simple command. The tool have a lot of options, for more information visit the github repository of oblique (link given previously) and if you can speak Spanish you can check this forum thread: create_ap: La solucin perfecta para transformar tu ordenador en un repetidor universal todo terreno

Here is my project Linux Wifi Hotspot which has both GUI and command-line interface. It can create a virtual wifi hotspot on the same wifi adapter which is connected to the internet. It has additional features such as MAC filter, Change channel/frequency band, view connected devices etc.

As you can see in the comments to this answer ther IS a way to do this. It's documented for FreeBSD (which is not Ubuntu/Linux) here: -to-multiple-ap-with-one-wifi-adapter-under-linux-freebsd (Link from the comment). It does not seem to work exactly the same way on Linux, but it should be similar. Unfortunately I wasn't able to find more detailed information about this topic.

The probably easiest and most common way is using two physical network interfaces. So you may buy another wifi stick or just use another technology to connect further and do just one of them via Wifi. The possibilities are for example:

Once I noticed that Ubuntu Linux is capable of managing two wifi devices at once without being complicated. I did not test this in ways of sharing the internet connection etc, but it should be possible. The way how complicated it will be is probably depending of the type of connections you use. On Linux you probably do not need and kind of special software. It should be possible to share connections without the need for any special tools. Unfortunately I cannot try it at this time.

I recommend you try Wifi to Wifi if you have another wifi stick anyway and otherwise LAN or Bluetooth (which is built-in in most notebooks). 3G/LTE sharing is a bit bad because of providers dataplans and so on.

The first line should be your network adapter name. The 2nd line should not be changed in most cases, unless you were not lucky and you require a 3rd party driver. The 3rd line does not require explanation. The 4th line should be your WiFi access point name (SSID). The fifth line identifies your network as a/b/g/n mode. The next line is your network channel. The remaining lines set security and encryption. In most cases, you only require to change pass phrase.

First line points to main network adapter configuration file. 2nd line tells hostapd to run in DAEMON mode in background on boot. The last line tells hostapd to log every message. The important trick here is if you like to use two different wireless network adapters to setup a Dual Band Access Point, you should create to separate original config files (1st file) for each ard and change it like this:

As far as two adapters... Windows and free bsd can do it... As of now i'm still trying to figure it out as I only approached this scenario for myself as of yesterday! I will report back... Linux can do it as well.. It is not an hardware limitation for the adapters that can do it with other operating systems...

Like Purushoth's answer, this answer also requires 2 WiFi adapters (ex: one internal and 1 external USB Wi-Fi adapter). I couldn't get his answer to work for me, however, so here's what I did instead.

How to configure the Ubuntu/Xubuntu PC as a WiFi hotspot (ex: for use in airports or on airplanes in order to share a single, paid connection from your PC with your phone and other devices):

on latest ubuntu (04.20) - there is a built in options in the wifi settings.so when you turn on wifi, you have the 3-dots button on top - one of the options there is "turn on hotspot", there, you'll set the wifi SSID and password, and that's it.Note: every wifi adapter can be used only for one action at once - or hotspot of connect to network. so if you have only one adapter and you're connected only via wifi - won't do...

GitHub - lakinduakash/linux-wifi-hotspot: Feature-rich wifi hotspot creator for Linux which provides both GUI and command-line interface. It is also able to create a hotspot using the same wifi card which is connected to an AP already ( Similar to Windows 10).

Yes, when disabling systemd-resolved and configuring networkmanager with dnsmasq like in the wiki, the hotspot does not shut down anymore after 30 seconds. However, my devices still give the error 'Incorrect password' and cannot connect.

I wanted to point out that the service occupying the port is probably resolved.
resolved and dnsmasq have overlapping features, your preference determines which you will use but running them in parallel will require some more elaborate configuration to keep them away from each other.
NM however according to the wiki will prefer/rely on dnsmasq, so there you go.

You're aware that the very most likely cause for that is still that you're issuing the wrong password?
Are there any chars outside the ASCII range (8-byte conflict utf8/iso)?
I'd try changing the password (for testing purposes) to "abcdefghi" and see whether the error remains.

I double checked this multiple times. The password itself is auto-generated by gnome settings(?), so I doubt any non-ASCII characters are causing the issue.
I tested with multiple passwords and also tried the generated QR-code to connect to the hotspot, but no success.

Thx, didn't know the difference between the two.
I double checked and the wifi mode of the hotspot in networkmanager was indeed "hotspot" and not "ad-hoc", so not sure why my android device won't connect.

The resulting test_ssid can be joined by iPhone, Windows, and even Intel MacBook Pros running macOS 12.6. But it can't be joined by an M1 MacBook Pro running macOS 13.0. Does anyone know why, or if there's a way to get M1 Macs to join Linux WiFi hotspots, or if there's a way to get debug output from the connection attempt? When I try to join the network from the M1 MBP, it says The Wi-Fi network "test_ssid" requires a WPA3 Personal., which is odd.

This will disable SAE and force the use of WPA2 Personal/SHA-256/AES. It would be preferable to get WPA3/SAE working, but I have not been able to do so with my Qualcomm Atheros QCA6174. I suspect this card performs the authentication itself rather than delegate it to the OS (Linux in this case), and because it's from 2015 or so, is too old to do SAE.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages