I'm trying to get rpi to connect to the Internet via wifi (wlan0) - it will connect to a mobile hotspot. It also has to have wired connection (eth0) to a router that is not connected to the Internet.

My desktop PC is also connected to the router. I'm doing this so that I can access a web application running on rpi from my desktop pc, while rpi has its own wifi connection to the Internet.

I understand that this is a bit strange, but this is the only way that I can run local web applications in my office without hopefully breaking any security policies.

I've followed the instructions on this post. My rpi can only ping www.google.com but not my router 192.168.1.1.

I've been tinkering around for over two hours now but I still can't have it so that rpi will respond when I ping from my desktop pc, and at the same time google will respond when I ping www.google.com from rpi.

I'd really appreciate it if someone could give me a hand on this...

  • does this work from the Pi - ping -I eth0 192.168.1.1 ? <-- that is a capital i and not a lowercase l before eth0...What IP address does eth0 have ? – Lawrence Sep 26 '13 at 5:45
  • 1
    Welcome to Raspberry Pi Stack Exchange! Please don't add "thanks" to your question. Upvote answers you like, this is the Raspberry Pi Stack Exchange way of saying thank you. – ppumkin Sep 26 '13 at 8:38
  • What does netstat -r show? – HeatfanJohn Sep 26 '13 at 13:40
  • 3
    @Lawrence: I still get "Destination Host Unreachable" message when I ping the router. All the configuration settings are exactly the same as described on this post (except for ssid and pass of course): (raspberrypi.stackexchange.com/questions/8851/…) – Ji Park Sep 27 '13 at 4:25
  • 1
    @Lawrence: dang it... this is very embarrassing... the ethernet cable was disconnected this whole time! so it's working now. Thank you for taking a look into this! – Ji Park Sep 28 '13 at 5:16
up vote 1 down vote accepted

Using the USB Wi-fi adapter, I was able to connect RPi to the Internet via a mobile hotspot. It has a wired connection to a router as well. Also, I have a PC connected to the router, which means I can access web applications running on RPi. Please note that just as described in the original post, I was able to accomplish this by following the instructions on this post. Here are the configuration settings that I have on my RPi:

pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="PASSWORD"
id_str="home"
priority=5
}

pi@raspberrypi ~ $ sudo cat /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.42
netmask 255.255.255.0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.43.142
netmask 255.255.255.0
broadcast 192.168.43.255
gateway 192.168.43.1
iface default inet dhcp

pi@raspberrypi ~ $ sudo cat /etc/default/ifplugd

INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

pi@raspberrypi ~ $ sudo cat /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sudo ifplugd eth0 --kill
sudo ifup wlan0
exit 0

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.