Urndis

It is possible to get internet connection from android based smartphones thanks to Urndis.

I am not sure if it's possible to get usb tethering from iPhone, but it is possible to share internet connection from smartphones that come with Android (which is based on linux kernel) using USB tethering option.

That's a good option for someone, who would like to use openBSD on his laptop/computer with wireless network card that is not supported by openBSD. That's for example my case, I have got a Lenovo laptop that comes with "Realtek 8723BE" card, that has linux drivers, but doesn't have support on openBSD (Possibly because it requires proprietary drivers).

For example when I type

$ apropos Realtek

it displays list of realtek wi-fi cards supported by the openBSD. My 8723BE is not there.

I could either get USB a wi-fi dongle with supported chipset or share internet connection with openBSD laptop using Android Smartphone. So there are two options, it is possible to share connection using mobile data like 4G or connect to wifi on smartphone and then share the internet connection to the laptop using usb-tethering, but how?

So I am using Samsung S8 in that case. When I connect the smartphone to my laptop via USB I get asked what do I want to use the device for, normally default option is something like charging phone only. There's also for example transferring files, MIDI or USB Tethering. So we gotta choose the usb tethering option

or I can open:

Settings > Connections > Mobile Hotspot and Tethering > USB tethering:

switching the usb tethering on will share the internet connection from the smartphone to the laptop! but that's not everything.

If I type $ dmesg | less after I connect the smartphone I can see that android device has been detected as:

urndis0 at uhub0 port 2 configuration 1 interface 0 "SAMSUNG SAMSUNG_Android" rev 2.10/4.00 addr 2
urndis0: using RNDIS, address 02:00:57:55:6c:3a

but we still have to tell the computer to get ip address from the smartphone to do that we have to type this line in terminal as root

# echo dhcp > /etc/hostname.urndis0

now we gotta reboot make sure that you enable usb tethering again on the phone as soon as openBSD starts to boot up! now during the boot openBSD will automatically get configured to share the internet connection between the smartphone and computer!

now we need to have either mobile data or wi-fi enabled on the smartphone, and we should be able to get the internet connection we can test it by typing this in terminal:

$ ping duckduckgo.com

if we get ping and internet connection then congratulations! You can now connect to the internet without having wireless card on the machine :)