User avatar
SerenityNetworks
Posts: 24
Joined: Wed Jun 06, 2012 7:21 pm
Location: Texas, USA
Contact: Website

Wireless IP Setup

Mon Mar 10, 2014 3:43 am

I'm having difficulty setting up my RPi to use wireless. I've gone to sudo nano /etc/network/interfaces and entered:
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.0.82
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.1.254
auto wlan0
allow-hotplug wlan0
iface eth0 inet static
address 192.168.0.82
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.1.254
wpa-ssid "myssid"
wpa-psk "mypassword"

The setup works fine for Ethernet, but not wireless. My router's security mode is "WPA2 Personal". Encryption is "TKIP or AES".

Is my configuration string incorrect &/or how do I troubleshoot? I'm suspecting I need to change the last two lines of the configuration string, but I'm not sure to what.

Thanks in advance,
Andrew
There are some ideas so preposterous that only an intellectual will believe them.
- Malcolm Muggeridge

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wireless IP Setup

Mon Mar 10, 2014 9:09 am

If you are trying to connect both at the same time, especially if you are trying to configure it with the ethernet connected, then I suggest you give each interface a different IP address. And of course "myssid" and "mypassword" will be the name and password of your wifi network.

You can check the wifi can work using the command

Code: Select all

sudo iwlist wlan0 scan
This should show a list of nearby networks if the wifi adaptor is OK and the driver is loaded and installed OK.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wireless IP Setup

Mon Mar 10, 2014 9:13 am

Also you don't really need both

Code: Select all

auto wlan0
allow-hotplug wlan0
One should be sufficient. I always use

Code: Select all

allow-hotplug wlan0
MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
SerenityNetworks
Posts: 24
Joined: Wed Jun 06, 2012 7:21 pm
Location: Texas, USA
Contact: Website

Re: Wireless IP Setup

Mon Mar 10, 2014 5:20 pm

I'll need to follow up on this later tonight when at home, but here are a few notes:
- I installed using NOOBS.
- I'm using the Edimax (EW-7811UN) adapter recommended.
- Once I get wireless working then I will seldom go back to Ethernet (although sometimes I will still use Ethernet, so I don't want to lose the functionality and I want to keep the IP static).
- I have not done anything to configure the adapter (I thought this one was plug 'n' play with the RPi.
- Yes, the "myssid" and "mypassword" are just placeholders for the real values.

Thanks,
Andrew
There are some ideas so preposterous that only an intellectual will believe them.
- Malcolm Muggeridge

RobHenry
Posts: 452
Joined: Fri Sep 21, 2012 9:04 pm
Location: UK

Re: Wireless IP Setup

Mon Mar 10, 2014 6:15 pm

One more point - you are defining eth0 twice.

iface eth0 should be wlan0 the second time it appears

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wireless IP Setup

Mon Mar 10, 2014 9:54 pm

Hi RobHenry

True, didn't notice that. Must get some new spectacles ;)

Hi Andrew
I've just tried one of my Pi's with fixed IP's and it all appears to work OK using the following

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.16.150
netmask 255.255.255.0
gateway 192.168.16.2

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.16.151
netmask 255.255.255.0
gateway 192.168.16.2
wpa-ssid "network-name"
wpa-psk "network-password"
Also noted in your file the address is 192.168.0.82 but the gateway is 192.168.1.254 which would put the gateway on a different network. I would expect the first 3 numbers to be the same, either 192.168.0.xxx for both or 192.168.1.xxx with xxx being the final number of each IP.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
SerenityNetworks
Posts: 24
Joined: Wed Jun 06, 2012 7:21 pm
Location: Texas, USA
Contact: Website

Re: Wireless IP Setup

Tue Mar 11, 2014 1:55 am

Thanks. I obviously had some typo's in the configuration. (And I just got new spectacles!)

Anyway, following is the code I entered as-well-as the result of the scan. I can PuTTY using Ethernet without any issues. But I still cannot connect via WiFi.

I'm not sure where to go from here.

Thanks,
Andrew

============================================================

auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.82
netmask 255.255.255.0
gateway 192.168.1.254

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.16.83
netmask 255.255.255.0
gateway 192.168.1.254
wpa-ssid "WRT160N-Gadget"
wpa-psk "mypassword"

============================================================

Using username "pi".
pi@192.168.1.82's password:
Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 11 01:37:46 2014 from primarydesktop
pi@raspberrypi ~ $ sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:23:69:D3:2B:11
ESSID:"WRT160N-Gadget"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:on
Bit Rates:300 Mb/s
Extra:wpa_ie=dd1c0050f20101000050f20202000050f2040050f20201000050f2020c00
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
Extra:rsn_ie=30180100000fac020200000fac04000fac020100000fac020c00
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
IE: Unknown: DD6F0050F204104A00011010440001021041000100103B00010310470010EB335F51E5596683907CEE504DED001C102100074C696E6B737973102300075752543136304E102400063132333435361042000234321054000800060050F2040001101100075752543136304E100800020084
Quality=100/100 Signal level=100/100
There are some ideas so preposterous that only an intellectual will believe them.
- Malcolm Muggeridge

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wireless IP Setup

Tue Mar 11, 2014 2:34 am

Hi Andrew,

iwlist shows the wifi is working as it lists your network so you're getting close to getting the wifi networking running.

Just one thing - in your current /etc/network/interfaces it shows wlan0 IP address is defined as 192168.16.83. Is that right or a typo? 192.168.1.83 would be more useful.

One thing I've found when changing networking settings is it sometimes helps to run the two commands

Code: Select all

sudo ifdown wlan0
sudo ifup wlan0
or

Code: Select all

sudo ifdown --force wlan0
sudo ifup --force wlan0
which are rather more persistent. And often repeating them more than once can then get things up and running properly.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
SerenityNetworks
Posts: 24
Joined: Wed Jun 06, 2012 7:21 pm
Location: Texas, USA
Contact: Website

Re: Wireless IP Setup

Tue Mar 11, 2014 2:45 am

Whoohoo! I'm in.

I'm going to have to talk to my eye doctor. She obviously got my recent prescription wrong. I know I proofed that config file more than once. "192168.16.83" sure looked to me like "192.168.1.83" :oops:

Thanks for catching my mistake. Correcting the typo' and running your tips had it working in seconds. I am now headless via WiFi.

Thanks again,
Andrew
There are some ideas so preposterous that only an intellectual will believe them.
- Malcolm Muggeridge

Return to “Beginners”