Use virtual AP on Ubuntu 18.04 LTS to sub-monitor old iPad

As a result of previous, the iPad could be sub-monitored without a wireless network by going through the Ubuntu hotspot. However, in reality, it would be difficult to operate a PC without connecting to the Internet, so I set it as the previous purpose.

--Also, make it possible to connect to the Internet from Ubuntu

I will be addicted to it even more deeply with the aim of realizing.

Create virtual access point → failed

Speaking of hotspots, I imagined Windows 10's "mobile hotspots", so I thought that I should be able to "become a WiFi hotspot while connecting to a wireless network", and the following posts matched. I was there, so I proceeded.

(reference) "Create_ap", which can turn a Linux machine into an instant wireless LAN router with a single command, was very convenient. https://qiita.com/KuwaK/items/5903c7584657151d576a

$ sudo apt install hostapd
$ git clone https://github.com/oblique/create_ap
$ cd create_ap ← #Created in the current directory
$ sudo make install

What I want to do is to connect to the Internet and use the same built-in wireless interface for the AP, so specify the built-in wireless IF for the Wifi I / F and AP I / F and execute!

$ sudo ./create_ap wlp12s0 wlp12s0 ubuntu_ap passwd
ERROR: Your adapter does not support AP (master) mode

Oh, I got angry.

Is the built-in wireless adapter compatible with AP? → Not supported

It means that "the adapter does not support anything", so for confirmation [this site](https://wakanya.wordpress.com/2016/09/18/wifi%E3%82%A2%E3 % 83% 80% E3% 83% 97% E3% 82% BF% E3% 81% 8Cap% E5% AF% BE% E5% BF% 9C% E3% 81% 8B% E8% AA% BF% E3% 81 % B9% E3% 82% 8B% E6% 96% B9% E6% B3% 95iw% E3% 82% B3% E3% 83% 9E% E3% 83% B3% E3% 83% 89 /) I proceeded.

$iw dev
phy#0
	Interface wlp12s0
		ifindex 3
		wdev 0x1
		addr 00:1b:77:9f:65:3b
		ssid aterm-b1d711-a
		type managed
		channel 36 (5180 MHz), width: 20 MHz (no HT), center1: 5180 MHz
		txpower 15.00 dBm

Since the physical number was found to be "phy0", detailed information is displayed.

$ iw phy phy0 info
Wiphy phy0
:
	Supported interface modes:
		 * IBSS
		 * managed
		 * monitor
	Band 1:
:
	interface combinations are not supported
:
$

It is said that if "AP" is included in this Supported interface modes, it will operate as an AP, but unfortunately AP is not included. Also, if combination is supported, it is said that both WiFi connection and AP can be compatible, but this is also not support.

As I expected, it turned out that the purpose = wireless network and sub-monitor via hotspot cannot be compatible with the built-in wireless adapter of the old notebook.

What about external wireless adapters? → AP compatible! But ...

I couldn't help it, so I searched for a box in which I had thrown in an imaginary device. Was found, so I connected each to a PC and checked with the iw command.

(For PC card)

$ iw dev
phy#2
	Interface wlp29s0
		ifindex 5
		wdev 0x200000001
		addr 00:16:01:c6:44:30
		type managed
		txpower 20.00 dBm
:

$ iw phy phy2 info
:
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
        Band 1:
:
        software interface modes (can always be added):
                 * AP/VLAN
                 * monitor
        valid interface combinations:
                 * #{ managed } <= 2048, #{ AP, mesh point } <= 4,
                   total <= 2048, #channels <= 1
:

USB is omitted, but it is judged that it can be used because "AP" is displayed as above and combinations are not not supported.

However, when I ran create_ap


$ sudo ./create_ap wlp29s0 wlp29s0 ubuntu_ap passphrase
Config dir: /tmp/create_ap.wlp29s0.conf.dueX6muc
PID: 9149
Network Manager found, set ap0 as unmanaged device... DONE
wlp29s0 is already associated with channel 36 (5180 MHz), fallback to channel 36
Creating a virtual WiFi interface... ap0 created.

ERROR: Your adapter can not transmit to channel 36, frequency band 5GHz.


Doing cleanup.. done

So I got an error again.

Create a virtual access point again

From the result of iw list, the external wireless adapter can handle only one channel, but if it is connected to the wireless with 36ch, it would not be strange to create a virtual AP with the same 36ch. In fact, because we recognize that create_ap also uses 36ch, we are trying to create a virtual AP with 36ch (default is created with 1ch).

But what does an error mean?

Also, when I googled around, the truth is not true, but when I look at Exchange here, there seems to be some problem on the 5GHz side. I was able to read it.

So I reconnected to the wireless network at 2.4GHz and started by explicitly specifying the channel confirmed by the iw dev command as the create_ap option (-c 9).

$ iw dev
phy#1
	Interface wlp29s0
:
		channel 9 (2452 MHz), width: 20 MHz (no HT), center1: 2452 MHz
		txpower 20.00 dBm
:
$ sudo ./create_ap -c 9 --freq-band 2.4 wlp29s0 wlp29s0 ubuntu_ap passphrase
Config dir: /tmp/create_ap.wlp29s0.conf.OsntY19U
PID: 17368
Network Manager found, set ap0 as unmanaged device... DONE
wlp29s0 is already associated with channel 9 (2452 MHz)
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp29s0.conf.OsntY19U/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp29s0.conf.OsntY19U/hostapd.conf
Using interface ap0 with hwaddr 00:16:01:c6:44:31 and ssid "ubuntu_ap"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED 

in ifconfig

$ ifconfig
ap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.12.1  netmask 255.255.255.0  broadcast 192.168.12.255
:
wlp29s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.8  netmask 255.255.255.0  broadcast 192.168.0.255
:

iw dev

$ iw dev
phy#1
	Interface ap0
:
		channel 9 (2452 MHz), width: 20 MHz (no HT), center1: 2452 MHz
	Interface wlp29s0
:
		channel 9 (2452 MHz), width: 20 MHz (no HT), center1: 2452 MHz
:

So, I finally made a new I / F called "ap0" using one channel.

By the way, when I first checked the procedure, I could make a virtual AP with 5Ghz (36ch), but when I reconfirmed it, I couldn't make it on the 5GHz side no matter how much I tried. The procedure may not be exactly the same, but if you look at the uncertain movement at 5GHz, you can't deny the possibility of a problem (although it was possible at 2.4GHz, I will not pursue it any further).

If you connect to the IP address (192.168.12.1) of the virtual AP from the iPad in this state, the log will flow to the terminal that started create_ap, and you could connect to the AP from the iPad (the iPad was given 192.168.12.64). ).

:
ap0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
ap0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: associated (aid 1)
ap0: AP-STA-CONNECTED xx:xx:xx:xx:xx:xx
ap0: STA xx:xx:xx:xx:xx:xx RADIUS: starting accounting session 020ACAFD110D9584
ap0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)
ap0: STA xx:xx:xx:xx:xx:xx WPA: group key handshake completed (RSN)
:
※xx:xx:xx:xx:xx:xx is the MAC address of the iPad

Then, when you connect to the AP (192.168.12.1) from the VNC Viewer on the iPad, the screen of the PC appears on the VNC on the iPad! ..

Furthermore, it was confirmed that Yahoo and Google can be accessed from the browser of the PC in this state. In this way, we succeeded in realizing both Internet connection via wireless network and sub-monitoring via AP (^^)

If the wireless adapter supports AP, the sub monitor can be realized by this method of creating a virtual AP instead of switching to a hotspot when there is no network.

Sub monitor drawing speed

It's a story limited to my own environment, but I feel that the display speed has increased when it is almost directly connected to the hotspot / AP than when it is connected via a wireless network (*).

So, sub-monitoring via VNC is slow! If you feel that, by making this "almost directly connected", the stress may be relieved a little.

Summary

The contents scattered in the three articles are summarized below.

Pre-work

Mandatory

--PC: Virtual display settings (cvt, xrandr settings, and automation) --PC: Activate [Settings] → [Sharing] → [Screen Sharing](enable vino, set password) --Tablet: Install VNC Viewer

Option (if you want to sub-monitor without network)

--PC: Change [Screen Sharing] from active to enabled --PC: Manual startup of vino-server (and autorun settings)

Realization method

First, enable the virtual display on the PC and apply it to two screens. Then, take the following steps according to the environment.

When the network can be used freely, such as in the house

--Tablet: Connect to the same network as your PC --Tablet: Connect by specifying the PC address with VNC and display the virtual display side

When there is no network such as on the go

--PC: Enable hotspot or create virtual AP with hostapd + create_ap --Tablet: Connect to hotspot or virtual AP --Tablet: Connect to hotspot or virtual AP with VNC and display virtual display side

If you can connect to the internet but cannot use it freely, such as free WiFi

--PC: Creating a virtual AP with hostapd + create_ap --Tablet: After connecting to the virtual AP --Tablet: Connect to virtual AP with VNC and display virtual display side

Precautions

--VNC server is supposed to use ubuntu standard (screen sharing) --Virtual AP creation is limited to AP-compatible wireless adapters. Note that older ones may not be supported (check iw list)

Miscellaneous feelings

――Although the practicality is not certain, I am satisfied because I was able to realize what I envisioned. ――It was good in terms of studying that I was a little bit messed up with virtual APs and device status confirmation methods. --You could use droidcam via virtual AP, but you can also use droidcam with a USB connection. If you can make it a sub monitor with a USB connection, it wouldn't be so difficult ... So please make someone who works on ubuntu.

Recommended Posts

Use virtual AP on Ubuntu 18.04 LTS to sub-monitor old iPad
Preparing to use electron-react-boilerplate on Ubuntu 20.4
How to install multiple JDKs on Ubuntu 18.04 LTS
Use mkdir on ubuntu
Apache2 on Ubuntu20.04 LTS
Use cpplapack on ubuntu
Old notebook + Ubuntu 18.04 LTS makes old iPad a sub monitor
Building WebGIS on Ubuntu20.04 LTS
I want to use screen sharing on the login screen on Ubuntu 18
How to Install Elixir and Phoenix Framework on Ubuntu 20.04 LTS
Record video on ubuntu18.04 LTS
Installing OpenMX on Ubuntu 18.04.5 LTS
Install raspi-config on Ubuntu 20.04 (LTS)
Install WordPress 5.5 on Ubuntu 20.04 LTS
How to install java9 on elementaryOS Freya or Ubuntu 14.04 LTS
Ubuntu 18.04 LTS makes old iPad a sub monitor without WiFi
Results of trying to use NVENC (CUDA) with Ubuntu 18.04 on WSL2
How to install and use Composer on an ECS instance on Ubuntu 16.04
How to use Ruby on Rails
Wake on Lan settings on Ubuntu 20.04.1 LTS
How to install WildFly on Ubuntu 18.04
How to build vim on Ubuntu 20.04
Grub broke after upgrading Ubuntu on Azure VM from 18.04 (LTS) to 20.04 (LTS) → Recovery
A memorandum on how to use Eclipse
How to use Apache Derby on Eclipse
[Ruby on Rails] How to use CarrierWave
Use docker in proxy environment on ubuntu 20.04.1
How to install production Metabase on Ubuntu
I want to install PHP 7.2 on Ubuntu 20.04.
How to change the timezone on Ubuntu
Use cljstyle with Spacemacs on Ubuntu on WSL2
[Ruby on Rails] How to use redirect_to
Serially connect to Ubuntu on Raspberry Pi
Make it possible to handle the camera with old notebook + Ubuntu 18.04 LTS (droidcam)