I had also been using the hotspot (= LAN → WLAN Tethering) option in OSMC, but I found it inconvenient for one reason: it builds up a completely separate (wireless) network which runs its own DHCP server and thus also has its own IP address range. So if like the OP you already have a wireless network in your house but would like to add the OSMC device as second access point within the same network, the Tethering does not allow very seamless switching between the two access points.
So I have played a bit and now have a working setup for a bridged access point, which took a few extra steps that I’m trying to detail below. I’d be interested to hear suggestions for improvements or maybe there is a much easier way after all?
I’m assuming in the following that your OSMC device is connected by Ethernet to your router. In principle it could also be possible to be connected to your router by wireless and span your own access point with the same wireless interface [**] but I don’t have any experience with that.
I. Set up network bridge
(Notabene: Do the following with a cabled keyboard connected to the OSMC device, since the network session will have to be restarted during the procedure. You can get to the console login by selecting the Exit/Quit option in OSMC and hitting Escape when the boot splash screen shows.)
I.1 Unfortunately I didn’t find out how to achieve a bridged setup with the “connman” network manager that is used by default in OSMC. Thus I had to disable it first with the following steps (and for some reason just disabling it in systemctl didn’t prevent it from starting) [*]
$ sudo systemctl disable --now wpa_supplicant.service
$ sudo systemctl disable --now connman
$ cd /lib/systemd/system
$ sudo mv connman.service connmanoriginal.service
$ sudo ln -s /dev/null connman.service
Best to reboot after this and check that really no network is enabled anymore.
I.2 Set up and enable “systemd-networkd”, the network manager built into systemd.
I.2.a) You have to create the following files to prepare the bridge from the LAN interface (eth0 by default on a RPi3). Note that the WLAN interface is not added to the bridge here yet, that will be done by hostapd automatically later.
/etc/systemd/network/MyBridge.netdev
[NetDev]
Name=br0
Kind=bridge
/etc/systemd/network/MyBridge.network
[Match]
Name=br0
[Network]
DHCP=ipv4
/etc/systemd/network/MyEth.network
[Match]
Name=eth*
[Network]
Bridge=br0
I.2.b) Enable systemd-networkd and systemd-resolved (the latter seems to be necessary for DNS resolution):
$ sudo systemctl enable --now systemd-networkd
$ sudo systemctl enable --now systemd-resolved
$ sudo rm /etc/resolv.conf
$ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
I.3 I found it useful to check at this stage a few diagnostics, including that the wlan0 is not marked as blocked by rfkill:
$ ip a s
-> br0 should now have an IP address from your (router's) DHCP
$ rfkill list all
-> wlan0 should not be blocked, otherwise it might still be in use by some other program, and hostapd won't be able to use it
II. Set up access point using hostapd
II.1) Install hostapd and bridge-utils: $ /usr/bin/apt-get install hostapd bridge-utils
II.2) Create the following two files with the two replacements in capital letters
==> /etc/hostapd/hostapd.conf: <==
# Bridge-Betrieb
bridge=br0
# Schnittstelle und Treiber
interface=wlan0
# WLAN-Konfiguration
ssid=YOURSSID
channel=8
hw_mode=g
ieee80211n=1
ieee80211d=1
country_code=DE
wmm_enabled=1
# WLAN-Verschluesselung
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=YOURPASSWORD
==> /etc/default/hostapd <==
DAEMON_CONF="/etc/hostapd/hostapd.conf"
II.3) Enable hostapd: systemctl restart hostapd
Now check whether everything works, ideally also after a reboot! In case you already have a wireless network e.g. from your router, I found it useful to try with a separate SSID first for debugging, before setting it identical to the existing SSID.
Hope this works, but I wouldn’t be surprised if I forget some steps when writing this up afterwards. Let me know if you encounter any problems and I can try to help!
Best,
Frank
[*] In case you use Bluetooth, note that disabling connman also disables the OSMC Bluetooth setup. So you would have to connect manually, e.g. with
bluetoothctl
power on
agent on
default-agent
scan on
pair <address, e.g. 01:02:03:04:05:06>
trust <...>
connect <...>
quit
This can be made persistent by creating the following file:
/etc/bluetooth/main.conf
[Policy]
AutoEnable=true