Static IP for WiFi in Access Point mode

Hey there

I followed this guide https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software and got all the way through, but with no /etc/network/interfaces file, since OSMC uses ConnMan to manage the networking.

My hostapd is running happily and my devices can connect to the AP, but don’t get assigned an IP address.

isc-dhcp-server has the following error:

osmc@osmc:~$ sudo service isc-dhcp-server status
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server)
   Active: failed (Result: exit-code) since Tue 2015-04-28 05:20:01 UTC; 3min 46s ago
  Process: 242 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

Apr 28 05:19:59 osmc dhcpd[293]:
Apr 28 05:19:59 osmc dhcpd[293]: No subnet declaration for wlan0 (no IPv4 addresses).
Apr 28 05:19:59 osmc dhcpd[293]: ** Ignoring requests on wlan0.  If this is not what
Apr 28 05:19:59 osmc dhcpd[293]: you want, please write a subnet declaration
Apr 28 05:19:59 osmc dhcpd[293]: in your dhcpd.conf file for the network segment
Apr 28 05:20:01 osmc isc-dhcp-server[242]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. .....iled!
Apr 28 05:20:01 osmc isc-dhcp-server[242]: failed!
Apr 28 05:20:01 osmc systemd[1]: isc-dhcp-server.service: control process exited, code=exited status=1
Apr 28 05:20:01 osmc systemd[1]: Failed to start LSB: DHCP server.
Apr 28 05:20:01 osmc systemd[1]: Unit isc-dhcp-server.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

Can someone help me assign a static IP for wlan0 please? I’ve tried running connmanctl interactively, but it looks like it only allows me to configure IP addresses once I’ve joined a WiFi network. (Which I don’t want, since my Pi will act as an AP.)

Thanks a lot!

to keep referring to the howto you posted - you probably have not defined this:

subnet 192.168.42.0 netmask 255.255.255.0 {
	range 192.168.42.10 192.168.42.50;
	option broadcast-address 192.168.42.255;
	option routers 192.168.42.1;
	default-lease-time 600;
	max-lease-time 7200;
	option domain-name "local";
	option domain-name-servers 8.8.8.8, 8.8.4.4;
}

in /etc/dhcpd/dhcpd.conf

for details

man /etc/dhcpd/dhcpd.conf

Hi @mk01, thanks for the reply. I’ve definitely added that :slight_smile:

From reading online I have interpreted the isc-dhcp-server error to mean that my wlan0 interface has

No subnet declaration for wlan0 (no IPv4 addresses).

I think the important part is the “no IPv4 addresses” part:

When I do ifconfig -a I see that only my eth0 has an IPv4 address, but wlan0 has only an IPv6 address. I figured this is because I couldn’t follow the /etc/network/interfaces part of the guide and I need a ConnMan specific solution to assign a static IP address to wlan0 without connecting it to some network.

Do you know how I’d do that?

@rdrey

I’m just wondering why dhcp insist on having segment address - dhcp queries and answers are completely independent.

I use hostapd too and although all howtos configure wlan0 with static ip, it has no meaning (if you are bridging with lan (eth0 for instance)).
So if you do the bridging, move the dhcp server to any other network adapter in the bridge (having actual IP address).
Or if you have already dhcp server on network, don’t install isc-dhcp-server at all and just take care you bridge ALL traffic, not just tcp / udp packets.

so what exactly is your setup ?

Hi

We are already working on adding ‘Tether’ mode (from both Ethernet to WiFi and WiFi to Ethernet) in the OSMC Settings menu.

I would recommend you wait for this

Sam

Awesome, thanks Sam. Yeah, this isn’t particularly high priority for me in any case :slight_smile:

Hi,
I understand that the plan is to eventually allow people to Tether. Still it would be nice if somebody knowledgeable could provide hints on how to replace the “Interface” file until the tethering mode is enabled. Anyway, I will bring this question to the Raspberry PI forum.
If I cannot progress, I will revert to a previous version of Raspbmc and re-install OSMC when I am back from vacations.
for me the equation is simple:
(IPAD+NPLAYER) && (AP/OSMC/SAMBA/USBHARDRIVE)= (More sleep in the morning)
when at the rented cottage…

Thanks,

Ben

You are replying to a 3 month old post. Tethering was implemented some time ago however not all wireless adapters support wifi tethering - it depends on the individual wifi driver. All drivers should support Ethernet tethering.

Shame on me. :blush:

This is what happens when:

  1. you post too late at night.
  2. you do not follow your own advise: RTFM :wink:

I had a built-in recipe for RASPBMC, and did not revise that even if OSMC is a totally new (and improved) beast.

Positive thing is since I uses noobs, I was able to make the AP work on the RASPIAN OS (Had to learn how to configure SAMBA share)

I will check this tonight in OSMC ( I am using the widely adopted RTL8188CUS)
.
Thank you,

And again sorry for wasting your time.
Ben

The kid is still learning :grinning:

Humm tethering is not working with two different realtek dongles.
SO I reverted to using and AP in RASPIAN & Samba to access the local drive content.

my post about Tethering failing to activate

I will keep a look on the tethering various thread.

Ben

Realtek and ConnMan are not friends. Certainly not with tethering. I’m not sure what we can do here.

Sam

Understood but Sad,

The Realtek chipset RTL8188CUS were/Are? very popular and worked very will out of the box with RASPIAN. So many PI owners have them in hands.

Realtek chipset RTL8188CUS are also easy to configure as AP in Raspian Whezzy:

That being said, I will try to install hostapd in OSMC and see if I can setup an AP outside of the OSMC menu.
Worst thing that will happen… Re-install :wink:

Ben

The problem is connman only supports the more modern nl80211 interface for enabling Host AP mode, while many of the realtek drivers only support the rtl871xdrv interface, which is both specific to realtek and now obsolete and no longer actively supported.

Hostapd supports both, which is why those drives might work with Hostapd. The only real solution is for Realtek to update their drivers to support nl80211 like most other vendors, as it’s very unlikely connman will ever be updated to add support for the obsolete driver interface.

Have you succeeded this tutorial with the Connman commands and Rpi3 under Krypton ?

You realize that this post has been dead for a year? Krypton has only been here a month. Please don’t resurrect long dead threads.

Why ? It’s the same problem today…

Because this thread is clearly dead. And you have already posted a current thread addressing your issues.