-   Linux - Newbie (
-   -   Problem setting up wlan0 as a router (

garryg68 03-30-2016 01:59 PM

Problem setting up wlan0 as a router
I was trying to setup a Raspberry PI as as router with an ethernet and wlan port using Raspian.
I have the WiFi dongle showing as:

wlan0 Link encap:Ethernet HWaddr 00:1c:df:78:6e:61
inet addr: Bcast: Mask:
inet6 addr: fe80::5041:c9fc:317b:2df4/64 Scope:Link
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

All the setup files looked ok, but when I run "$ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf" I got the following error:
Configuration file: /etc/hostapd/hostapd.conf
Could not set interface wlan0 flags (UP): No such file or directory
nl80211: Could not set interface 'wlan0' UP
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan0 wasn't started

I later realised that the address appears to be updating when I ran "$ sudo ifconfig wlan0" I also get the message: "SIOCSIFFLAGS: No such file or directory"

I'm relatively new to this so what does it mean?
Have I missed something obvious here?
Any help on where I may be going wrong would be appreciated.

beachboy2 03-30-2016 02:14 PM


This may help you:

garryg68 03-30-2016 04:13 PM

Hello, beachboy2,

I already did all the config this says.

When I first ran "sudo ifup wlan0" I got the message "RTNETLINK answers: No such file or directory"
What "file or directory" is it looking for exactly, wlan0?

Then it changed to: RTNETLINK answers: File exists Failed to bring up wlan0.

I think I'll just wipe the SD card and try again with a fresh Raspian install, and maybe just follow this tutorial step-by-step and see what happens!

garryg68 03-31-2016 07:19 AM

I've got this to work.. sort off.

I didn't realize the Belkin Stick I was using could have more than one type of firmware, so had to add another firmware driver.

my /etc/hostapd/hostapd.conf file is setup as follows (and is running):

After some more tweaking I got this working by running it from the command prompt e.g. "/usr/sbin/hostapd /etc/hostapd/hostapd.conf"

It also works if I run this as a background process. But it doesn't seem to run automatically on startup. The router setup is also working with TOR through the PI, and that all seems fine when the connection is actually running!

After testing I assumed the only extra commands needed to set this up automatically would be :
service hostapd start
service isc-dhcp-server start
update-rc.d hostapd enable
update-rc.d isc-dhcp-server enable

My /etc/network/interfaces file is set to:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
up iptables-restore < /etc/iptables.ipv4.nat

Am I missing something? I've been going through the RASPBERRY PI USERS GUIDE book to try and figure this out, if anyone knows of a better reference for the PI, feel free to let me know.

beachboy2 03-31-2016 08:18 AM


Glad to see you are making progress.

This is one of several additional RPi guides:

All times are GMT -5. The time now is 03:53 PM.