0

I am running my Raspberry Pi 2 on a wifi network and also used this article to connect my android phone via USB tethering (for ssh connection):

http://elinux.org/How_to_use_an_Android_tablet_as_a_Raspberry_Pi_console_terminal_and_internet_router

Now the problem is, the wifi router has ip 192.168.0.x but the USB tethering has 192.168.42.x

And I can't see a way to connect both at the same time. If I connect my phone then internet is gone :(

Do I have to make some settings on router, phone or Pi?

Edited

Here's the /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

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

#allow-hotplug usb0
#iface usb0 inet dhcp

iface usb0 inet static

EDIT 2

Here's the result of top command http://pastebin.com/QL4Jbi3x

  • Can you add the settings at /etc/network/interfaces to your question – Tolga Varol Jul 22 '15 at 10:28
  • @TolgaVarol Just edited the question – Rizwan Jul 22 '15 at 21:31
  • What do you use wlan0 wlan1 and eth0 for? – Tolga Varol Jul 23 '15 at 13:44
  • wlan0 has it's connection with my home wifi (192.168.0.x) and other two are not in use. – Rizwan Jul 23 '15 at 13:56
1

Can you comment out whole the stanzas of eth0 and wlan1 since you aren't using them and can you change the stanza of wlan0 as

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid "yourSSID"    #i.e. mine is wpa-ssid "Actual Network"
        wpa-psk "yourPSWRD"    #i.e. mine is wpa-psk "fawfjr21i20"

and change usb0 settings as

allow-hotplug usb0
iface usb0 inet dhcp

and restart the Pi, also don't forget to comment out iface usb0 inet static

Edit

USB tethering will always have an IP as 192.168.42.x and according to this post : https://android.stackexchange.com/questions/46499/how-configure-the-dhcp-settings-of-wifi-tetheringhotspot-in-android

it is hardcoded. But changing that IP address wouldn't mean anything so its not the thing. The thing is connecting to internet from your phone if I didn't misunderstood. I also have a similar problem with my Pi since I have 2 WiFi adaptors, one for WAN and one for local area in AP mode. I suppose the situation is analogue. What you need to do is to bridge those two interfaces wlan0 and usb0. So that when usb0 receives a request it will deliver it to wlan0. For doing that you can check this example : bridge eth0 static wlan0 static wlan1 dhcp . Pi should work as a router when a request comes from usb0 interface.

Also this is another guide you might make use of https://wiki.debian.org/BridgeNetworkConnections

Hope this helps. By the way, you only have to make settings on Pi.

  • This is strange, but since I made my last changes you mentioned above, my wifi USB adapter isn't working. I tried on my PC too. :/ – Rizwan Jul 24 '15 at 9:57
  • Can you type top and add the output to your question too and also can you change wlan0's (the one I put above) stanza as I edited now @Rizwan – Tolga Varol Jul 24 '15 at 14:53
  • Hi @TolgaVarol, just edited the question again and added the result of top command. Sorry for late reply, I had to purchase new Wifi Adapter as old one isn't working anymore. And also, I updated /etc/network/interfaces but still no good. – Rizwan Jul 26 '15 at 2:42
  • Sorry for late reply, thanks for the edit, I wondered your top output since I thought maybe there was some process which was causing this but after some more search I found that it was not about another process, I'm editing the answer with new findings @Rizwan – Tolga Varol Jul 26 '15 at 20:27
  • Thanks, I'll check it in the morning. Going to sleep now, it's 2:56 AM here – Rizwan Jul 26 '15 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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