mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Wifi setup

Sat Mar 19, 2016 1:30 am

I am connecting to the pi using ethernet and vncserver using putty. I have made a static ip. My wifi is not working. The interfaces file is given below. What should I do/change?

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.60
netmask 255.255.255.0
gateway 192.168.1.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Wifi setup

Sat Mar 19, 2016 12:00 pm

If you are using Raspbian Jessie then you set the static address in /etc/dhcpcd.conf

Add this at the end of that file:

Code: Select all

interface eth0
static ip_address=192.168.1.60/24
static routers=192.168.1.1
And undo the changes you made to /etc/network/interfaces

Code: Select all

iface eth0 inet static
should be

Code: Select all

iface eth0 inet manual

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sat Mar 19, 2016 8:10 pm

Thank you. I have made the changes. still not working for some reason. any idea why?
Besides, it says debian. Is that different from jessie?

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Wifi setup

Sat Mar 19, 2016 9:02 pm

What is the output of

Code: Select all

cat /etc/os-release
It gives more details about the exact flavour of Debian

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sat Mar 19, 2016 10:21 pm

This is the output

PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Wifi setup

Sat Mar 19, 2016 10:57 pm

Ok. that seems to be OK.

Can you see your wifi dongle with

Code: Select all

lsusb
If you can, check the output of

Code: Select all

ifconfig
If it is working then you should see wlan0 listed.
Can you post the output of these two commands.

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sat Mar 19, 2016 11:08 pm

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]



eth0 Link encap:Ethernet HWaddr b8:27:eb:cd:ca:51
inet addr:192.168.1.60 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:391 errors:0 dropped:0 overruns:0 frame:0
TX packets:419 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29621 (28.9 KiB) TX bytes:56788 (55.4 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1642 (1.6 KiB) TX bytes:1642 (1.6 KiB)

wlan0 Link encap:Ethernet HWaddr 74:da:38:56:16:25
inet addr:192.168.0.30 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:350 errors:0 dropped:81 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45208 (44.1 KiB) TX bytes:5430 (5.3 KiB)

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Wifi setup

Sat Mar 19, 2016 11:26 pm

Your wifi connection has an IP address.
So what exactly is not working?

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sat Mar 19, 2016 11:34 pm

I try to connect it and browse the internet and it does not work

https://www.dropbox.com/s/ng7hrtlsfildq77/1.png?dl=0

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Wifi setup

Sun Mar 20, 2016 12:11 am

Try this in a LXTerminal command window:
ip route
ping -c3 $(ip route | awk '/default/ {print $3}')
ping -c3 8.8.8.8
ping -c3 www.google.ca
cat /etc/resolv.conf


Tell us the results from each command (or take another screen shot).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sun Mar 20, 2016 12:28 am

ip route

default via 192.168.1.1 dev eth0 metric 202
default via 192.168.0.1 dev wlan0 metric 304
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.30 metric 304
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.60 metric 202

ping -c3 $(ip route | awk '/default/ {print $3}')

PING 192.168.0.1 (192.168.0.1) 56(124) bytes of data.
--- 192.168.0.1 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2003ms

ping -c3 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.1.60 icmp_seq=1 Destination Host Unreachable
From 192.168.1.60 icmp_seq=2 Destination Host Unreachable
From 192.168.1.60 icmp_seq=3 Destination Host Unreachable

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2008ms
pipe 3

ping -c3 http://www.google.ca

PING http://www.google.ca (24.244.4.119) 56(84) bytes of data.
From raspberrypi.local (192.168.1.60) icmp_seq=1 Destination Host Unreachable
From raspberrypi.local (192.168.1.60) icmp_seq=2 Destination Host Unreachable
From raspberrypi.local (192.168.1.60) icmp_seq=3 Destination Host Unreachable

--- http://www.google.ca ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2002ms
pipe 3

cat /etc/resolv.conf

# Generated by resolvconf
domain hitronhub.home
nameserver 192.168.0.1

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Wifi setup

Sun Mar 20, 2016 12:45 am

Your default route isn't set correctly. You've got two different subnets one for each interface and the default route appears to point to the wrong network.

Check what shows up on your laptop with an ipconfig command

Code: Select all

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : lan
   IPv6 Address. . . . . . . . . . . : 2001:ssss:ssss:ssss:cdb4:3ddf:c381:14b4
   Temporary IPv6 Address. . . . . . : 2001:ssss:ssss:ssss:fc5e:a0fe:e2a0:7686
   Link-local IPv6 Address . . . . . : fe80::cdb4:3ddf:c381:14b4%4
   IPv4 Address. . . . . . . . . . . : 192.168.1.68
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::ba27:ebff:fe85:c936%4
                                       192.168.x.1
You're interested in the IPv4 default gateway address.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sun Mar 20, 2016 12:49 am

Wireless LAN adapter Wi-Fi:

Connection-specific DNS Suffix . : hitronhub.home
IPv6 Address. . . . . . . . . . . : fd00:bc4d:fb71:ca92:d6f:abbd:a2bd:cffa
Temporary IPv6 Address. . . . . . : fd00:bc4d:fb71:ca92:a905:cd5e:19a2:b558
Link-local IPv6 Address . . . . . : fe80::d6f:abbd:a2bd:cffa%9
IPv4 Address. . . . . . . . . . . : 192.168.0.18
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Wifi setup

Sun Mar 20, 2016 1:14 am

That's odd because your RPi can't ping that gateway address.

Put /etc/network/interfaces and /etc/dhcpcd.conf back to the way they were when you first installed Raspbian.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sun Mar 20, 2016 1:24 am

Now the ip address is not static. How can I know the ip address?

mazhar897
Posts: 11
Joined: Sat Mar 19, 2016 1:23 am

Re: Wifi setup

Sun Mar 20, 2016 2:14 am

I figured it out. It works now. Thank you everyone.

Return to “Beginners”