LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2016, 02:59 PM   #1
garryg68
Member
 
Registered: Jan 2010
Posts: 33

Rep: Reputation: 14
Question 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:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0
inet6 addr: fe80::5041:c9fc:317b:2df4/64 Scope:Link
BROADCAST MULTICAST MTU:1500 Metric:1
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 192.168.42.1" 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.
 
Old 03-30-2016, 03:14 PM   #2
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Ubuntu MATE, Mint MATE & antiX MX-15
Posts: 1,664
Blog Entries: 5

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
garryg68,

This may help you:

http://raspberrypihq.com/how-to-turn...a-wifi-router/
 
Old 03-30-2016, 05:13 PM   #3
garryg68
Member
 
Registered: Jan 2010
Posts: 33

Original Poster
Rep: Reputation: 14
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!

Last edited by garryg68; 03-30-2016 at 05:45 PM.
 
Old 03-31-2016, 08:19 AM   #4
garryg68
Member
 
Registered: Jan 2010
Posts: 33

Original Poster
Rep: Reputation: 14
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):
interface=wlan0
driver=nl80211
ssid=OnionPi
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=onionberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

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
address 192.168.42.1
netmask 255.255.255.0
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.

Last edited by garryg68; 03-31-2016 at 08:30 AM.
 
Old 03-31-2016, 09:18 AM   #5
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Ubuntu MATE, Mint MATE & antiX MX-15
Posts: 1,664
Blog Entries: 5

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
garryg68,

Glad to see you are making progress.

This is one of several additional RPi guides:

http://neil-black.co.uk/raspberrypi/...ginners-guide/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem setting up wlan0 using DLink harpoon45 Linux - Wireless Networking 10 10-31-2007 08:37 AM
Problem with setting up my SuSE as router proff Linux - Networking 20 07-24-2006 04:35 PM
Setting up PC as router, eth1 problem talking to modem NeXuS_2006 Linux - Networking 6 01-17-2005 02:23 PM
problem setting up router in linux http server mkepler1 Linux - Networking 1 12-18-2003 01:42 PM


All times are GMT -5. The time now is 11:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration