0

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...

Ji Park
  • 111
  • 1
  • 4

1 Answers1

1

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
Ji Park
  • 111
  • 1
  • 4