monapi
Posts: 35
Joined: Tue Aug 07, 2018 7:53 am

couldn't ping raspberry pi wlan0 IP

Sat Nov 10, 2018 12:46 pm

i run a raspberry pi with raspbian stretch OS and i want to ping raspberry pi wlan0 IP from my PC. at first when the raspberry pi boot i can ping it but when a few minutes pass and i ping another time it gives "destination host unreachable". according to what i searched, the reason is the raspberry pi firewall doesn't let routing between raspberry and PC. i run command
sudo iptables -L -nv
and the result shows firewall is disabled in my raspberry pi.
does anyone know what the problem is and how should i solve it?
thank you.

User avatar
DougieLawson
Posts: 34096
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: couldn't ping raspberry pi wlan0 IP

Sat Nov 10, 2018 1:10 pm

"destination host unreachable" is nothing to do with your lack of iptables rules.

It means one of a few things
  • Your raspberry isn't connected to your router
  • Your raspberry doesn't have a valid IP address
  • Your raspberry has an IP address that conflicts with another on your LAN
  • Your laptop isn't connected to your router
  • Your laptop doesn't have a valid IP address
  • Your laptop has an IP address that conflicts with another
  • Or you've simply tried to use the wrong IP address for either your raspberry or your laptop
Get the output from the following commands

On your Raspberry
ip addr show
ip route
ping -c3 $(ip route | awk '/default/ {print $3}')
ping -c3 8.8.8.8


On your laptop (I'm assuming it's windows)
ipconfig /all
route print
ping /n3 8.8.8.8


From all that stuff you should be able to determine that a) your raspberry is connected b) your laptop is connected and c) the IP addresses of each device so you can connect from one to the other.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

lbog
Posts: 125
Joined: Sun Mar 06, 2016 9:44 am

Re: couldn't ping raspberry pi wlan0 IP

Sat Nov 10, 2018 10:42 pm

monapi wrote:
Sat Nov 10, 2018 12:46 pm
... i want to ping raspberry pi wlan0 IP from my PC. at first when the raspberry pi boot i can ping it but when a few minutes pass and i ping another time it gives "destination host unreachable"....
Instead the ping try an arping from your PC to the PI:

Code: Select all

sudo apt-get install iputils-arping
arp -av
and

Code: Select all

sudo arping -c 3 -I <Interface-PC> -s <IP-address-PC> <IP-addres-PI>
For example:

Code: Select all

:~$ sudo arping -c 3 -I wlan1 -s 192.168.178.22 192.168.178.43
ARPING 192.168.178.43 from 192.168.178.22 wlan1
Unicast reply from 192.168.178.43 [B8:27:EB:A8:6A:64]  6.988ms
Unicast reply from 192.168.178.43 [B8:27:EB:A8:6A:64]  10.086ms
Unicast reply from 192.168.178.43 [B8:27:EB:A8:6A:64]  17.741ms
Sent 3 probes (1 broadcast(s))
Received 3 response(s)

Return to “Beginners”