Silversonic
Posts: 34
Joined: Wed Aug 27, 2014 8:42 pm

Setting up wlan0 to static IP isn't happening automatically.

Sat Oct 04, 2014 5:29 pm

I'm following this guide to make a wireless access point:

https://learn.adafruit.com/setting-up-a ... l-software

I have followed the guide completely, but I'm having issues at the "Set up wlan0 for static IP". If I type

Code: Select all

sudo ifdown wlan0
sudo ifconfig wlan0 192.168.42.1

then the ip-address is changed as desired and my wireless access point works. However after rebooting the pi, wlan0 isn't automatically set to 192.168.42.1 and this causes me issues with dhcp loading. Instead, with ifconfig, I get:

Code: Select all

wlan0     Link encap:Ethernet  HWaddr 80:1f:02:80:03:2c
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 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)
I have to keep typing sudo ifdown wlan0, sudo ifconfig wlan0 192.168.42.1 everytime if I want my wap to work.

Why isn't this being automated? I've follow the guide to a tee and /etc/network/interfaces is set up exactly how it wants me to:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0

auto wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0

#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

up iptables-restore < /etc/iptables.ipv4.nat
Sometimes it does automatically set-up, but more often that not it won't.

Silversonic
Posts: 34
Joined: Wed Aug 27, 2014 8:42 pm

Re: Setting up wlan0 to static IP isn't happening automatica

Sat Oct 04, 2014 10:56 pm

Well I've spent most of the day and some of yesterday on this, and haven't solved the issue. Could swear I've searched the entirety of what the internet has to offer me in regards to this issue - not that there seemed much to find.

Sometimes my Pi boots and 192.168.42.1 is allocated to wlan0 fine; and my OnionPi works like a charm. Other times wlan0 isn't associated any addresses and there are issues. I can't see what causes either case to occur.

In the latter case, just running

Code: Select all

sudo ifconfig wlan0 192.168.42.1
sudo service isc-dhcp-server start
sudo service tor start
Makes it run how it should. So maybe I could just write a script that runs these three commands at the very end of boot, to make doubly sure wlan0 has it's ip set up? I don't know how to do that.

Edit: Maybe the issue comes because the Wifi-dongle peripherals aren't loaded before the /etc/network/interfaces issues the command to change the ip-address to 192.168.42.1?...

Silversonic
Posts: 34
Joined: Wed Aug 27, 2014 8:42 pm

Re: Setting up wlan0 to static IP isn't happening automatica

Sun Oct 05, 2014 12:13 am

Final update for anyone who has this issue; I just added a script to run on start-up which just does;

Code: Select all

sudo ifconfig wlan0 192.168.42.1
this conveniently runs before the dhcp server and tor are started, and so my issues are fixed. It's obviously not the correct way but it's a work around for whatever's preventing this IP address update.

Return to “Troubleshooting”