batmanz28
Posts: 6
Joined: Sun Jun 26, 2016 6:23 am

No internet Connection

Sun Jun 26, 2016 6:40 am

Hello, just downloaded PI3 with Raspbian was able to connect to my home wifi but I cannot access any webpage. I am able to access my home router through the PI3 and all the settings look ok. Besides, wifi works perfect on all other devices. Has anyone had this problem? Thanks

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: No internet Connection

Sun Jun 26, 2016 3:56 pm

ping your router.
ping 8.8.8.8
ping www.google.com

Post results here, use code tags.

batmanz28
Posts: 6
Joined: Sun Jun 26, 2016 6:23 am

Re: No internet Connection

Sun Jun 26, 2016 5:09 pm

ping router
ping: icmp open socket: Operation not permitted
ping:8.8.8.8
connect: network is unreachable
ping www.google.com
ping: unknown host www.google.com

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

Re: No internet Connection

Sun Jun 26, 2016 5:24 pm

Get the output from the following commands and post it on here.

ifconfig -a
ip route
ping -c3 $(ip route | awk '/default/ {print $3}')
ping -c3 8.8.8.8
cat /etc/resolv.conf
ping -c3 google.com
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.

batmanz28
Posts: 6
Joined: Sun Jun 26, 2016 6:23 am

Re: No internet Connection

Sun Jun 26, 2016 5:59 pm

Code: Select all

pi@raspberrypi:~ $ ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:d2:45:bd  
          inet6 addr: fe80::bcb6:38e0:3854:980/64 Scope:Link
          UP 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)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:196 errors:0 dropped:0 overruns:0 frame:0
          TX packets:196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:15792 (15.4 KiB)  TX bytes:15792 (15.4 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:87:10:e8  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ed4f:3ca0:4404:45ea/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3610 errors:0 dropped:923 overruns:0 frame:0
          TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:620510 (605.9 KiB)  TX bytes:19071 (18.6 KiB)

pi@raspberrypi:~ $ ip route
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.3  metric 303
pi@raspberrypi:~ $ ping -c3 $(ip route | awk'/default/ {print $3}')
bash: awk/default/ {print $3}: No such file or directory
Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface]
            [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos]
            [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option]
            [-w deadline] [-W timeout] [hop1 ...] destination
pi@raspberrypi:~ $ pig -c3 8.8.8.8
bash: pig: command not found
pi@raspberrypi:~ $ ping -c3 8.8.8.8
connect: Network is unreachable
pi@raspberrypi:~ $ cat/etc/resolv.conf
bash: cat/etc/resolv.conf: No such file or directory
pi@raspberrypi:~ $ ping -c3 google.com
ping: unknown host google.com
pi@raspberrypi:~ $

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

Re: No internet Connection

Sun Jun 26, 2016 6:03 pm

What's the gateway router for your 192.168.1.0/24 network?

Take a look on your Windows machine by running ipconfig in a command window and looking for the line

Code: Select all

Default Gateway . . . . . . . . . : 192.168.1.xxx
Then set that address as the gateway on your RPi with
sudo ip route add default via 192.168.1.xxx # using the result from Windows.

Then you need to look at your home router/switch/access point to see why it's not working properly and why it's not handing out the gateway address on the DHCPOFFER packet for your RPi.
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.

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: No internet Connection

Sun Jun 26, 2016 6:06 pm

As far as I can see, no gateway and no DNS.

How did you set the WLAN up ?

(In hindsight that should have been my first question.)

batmanz28
Posts: 6
Joined: Sun Jun 26, 2016 6:23 am

Re: No internet Connection

Sun Jun 26, 2016 6:12 pm

Wow thanks Dougie!!!!

I went ahead and added the default gateway number I pulled from my windows PC and inserted it via sudo ip route add default via 192.168.1.xxx and internet is functional. Your awesome!!! Thanks so much. Can you please try to explain what you think happened. Really appreciate it!!!

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

Re: No internet Connection

Sun Jun 26, 2016 6:23 pm

Your router (which is running the DHCP server on your network) is supposed to give each machine two data items #1 their IP address #2 the default gateway address.

For some (unknown) reason, your RPi didn't get the gateway address, so it has nowhere to send any packet destined for an address outside 192.168.1.0 to 192.168.1.255 (your subnet, because its got a /24 (255.255.255.0) mask). Those packets going outside your network get dumped in the bit-bucket.

Adding the gateway address means a packet destined for 8.8.8.8 gets handed to the router, the router knows that has to go to your upstream ISP (usually on a point-to-point ADSL or VDSL2 network) and they know how to get it on the wide area network to route it to Google.
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.

batmanz28
Posts: 6
Joined: Sun Jun 26, 2016 6:23 am

Re: No internet Connection

Sun Jun 26, 2016 6:33 pm

Thanks so much. This totally explains why the packets were getting dumped. You are the man!!!

DennisT
Posts: 3
Joined: Tue Jul 05, 2016 8:45 pm

Re: No internet Connection

Tue Jul 05, 2016 9:14 pm

Is there any info on why a RPi doesn't get the gateway address? I have a Win 2012 R2 server that is providing DHCP to my network. I have the DHCP server giving out gateway, DNS, etc info and Windows and Linux clients work fine.

I'm working on a production device using a RPi 3 & Raspbian. Using the default network setup the RPi gets a DHCP address and DNS settings come across fine (servers and dns domain name).

However on the RPi there is no gateway. I realize I could manually set it, but the purpose behind using DHCP is to ease network configuration. Plus if I have a gateway change SSHing into every RPi device and manually changing the gateway isn't high on my fun things to do list.

edit: I have been able to work around this by defining Classless Static Routes (121) in my DHCP scope options. However the Router (003) should be working for the gateway.

DenS1950
Posts: 12
Joined: Mon Jan 09, 2017 3:40 pm

Re: No internet Connection

Mon Jan 30, 2017 9:27 pm

DougieLawson wrote:What's the gateway router for your 192.168.1.0/24 network?
Then you need to look at your home router/switch/access point to see why it's not working properly and why it's not handing out the gateway address on the DHCPOFFER packet for your RPi.
I had the same issue with a new RpI 3B. WiFi internet just quit. WiFi was fine just no internet. After Doug's fix it worked ???

Any ideas what to check for to see what went wrong?

vijayraghavan
Posts: 1
Joined: Fri Aug 25, 2017 2:28 am

Re: No internet Connection

Fri Aug 25, 2017 2:47 am

Hi I'm facing the same problem of No internet connection with RPi3.
ifconfig - a does not show any ipv4 addr:
ping 192.168.1.1 reply: Connect: network is unreachable
For any Ping , result is network is unreachable
iproue does not give any reply. come back to prompt.
sudo ip route add default via 192.168.1.1 .reply:RTNETLINK answers:Network is unreachable.

My router works fine with other devices such as laptop ,mobiles etc.
Can anyone advice further.

pablitonatal
Posts: 1
Joined: Wed Jan 22, 2020 4:55 pm

Re: No internet Connection

Wed Jan 22, 2020 4:58 pm

Brilliant!!! For dont know what reason my Pi got disconnected to WiFi. Then I could reconnect to WiFi but no internet. Setting again the default to my router gateway solved it.

Thank you.

Pablo

DougieLawson wrote:
Sun Jun 26, 2016 6:03 pm
What's the gateway router for your 192.168.1.0/24 network?

Take a look on your Windows machine by running ipconfig in a command window and looking for the line

Code: Select all

Default Gateway . . . . . . . . . : 192.168.1.xxx
Then set that address as the gateway on your RPi with
sudo ip route add default via 192.168.1.xxx # using the result from Windows.

Then you need to look at your home router/switch/access point to see why it's not working properly and why it's not handing out the gateway address on the DHCPOFFER packet for your RPi.

Return to “Troubleshooting”