0

I am using 2012-07-15-wheezy-raspbian OS on my Raspberry Pi. I have connected Raspberry Pi to the router through lan cable. My laptop is connected to the router through Wifi and hence i can connect to Raspberry Pi. But i have no internet due to access point problem. Hence Raspberry Pi cannot connect to the internet.

But my mobile hotspot can be used for internet sharing. Now i want to connect my laptop and Raspberry Pi to the same network that generated by my mobile hotspot. So that i can access Raspberry Pi through my laptop and also they have access to internet. I want to use ethernet cable to share this internet through the router by connecting lan cable to the input of router and so the devices under the network generated by the router also can access the internet.

How can i configure the Raspberry Pi to work this condition?

Please help me i am new to raspberry pi. I have found lot of tutorial and i didn't understand it. What code should be written in /etc/network/interfaces/ and wpa_supplicant.conf?

1 Answer 1

0

I understand your mobile hotspot to have Internet access and to provide it to other devices through a Wifi/WLAN hotspot. As from your post both your PC and the Raspberry Pi have WLAN.

The easy route:

Forget about Ethernet (I'm explaining why in a second) and connecting both devices directly to your mobile hotspot. This way you can achieve your usecase without gettling lost in difficult network setup details.

Why no Ethernet? There are two reasons: first, your home router not only is a switch, but it also has a DHCPv4 server built in. You would need to disable it. Second, you would need to set up your Pi as a Wifi-to-Ethernet router. A bridge configuration wouldn't work, due to the 3-MAC-address restriction of Wifi. So, your Pi would need to NAT your Internet access (again). In addition, you would need to run a DHCPv4 server on your Pi.

The difficult route thus looks like this:

  1. Connect your Pi via Wifi to your mobile hotspot.
  2. Configure your Pi to act as a MAT router between Wifi and Ethernet, see here: http://www.glennklockwood.com/sysadmin-howtos/rpi-wifi-island.html ... but with one important exception: don't change the interfaces configuration of wlan0, keep it as it is so it still autoconfigures. Check the IP address and netmask you get from your mobile hotspot. These must not conflict with the IP address set for eth0. If it does, you need to change the configuration accordingly.
  3. Make sure to switch off the DHCPv4 server in your old home router, so it works only as a switch/bridge on Ethernet/Wifi
  4. Connect your Pi via Ethernet to your old home router.
  5. You should now be able to access the Internet from you PC: PC-->home (router) switch-->Pi (new home router with NAT/DHCPv4)-->mobile hotspot-->...
1
  • Thanks for your reply. consider now i have successfully connected to my mobile hotspot and i can access Rpi through my laptop. Now laptop, Rpi are on the same network generated by my mobile hotspot. Now i want to connect another PC to Rpi through lan cable and that PC can access the internet provided by my mobile hotspot. What will be the configuration to make it possible?
    – vishnu m c
    Commented Jul 28, 2017 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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