0

I used this tutorial to make my Raspberry 3 an access point. After following that, I can't connect to the internet—neither via Wi-Fi nor via cable.

With this tutorial when I see the DHCP status—it says failed—but when I make wlan0 up my Raspberry turns to an access point and give IP to my cell phone.

I need a VPN to connect to my internet and I don't have one on my Raspberry so I can't connect with cable.

I want to use my Raspberry as Picroft so I need Internet. so I need a way to switch between these modes. Can someone help me?

Update from the comments:

The RPi is an access point. To this access point I can connect to its wifi for example with my cell phone.

The RPi is connected with an ethernet cable to my pc windows 10 that get wifi internet from a modem. the modem is dhcp that give 192.168.1.114 ip to my pc. Before i connect pi to PC with cable it gives IP to my phone but the pi and phone both didn't have internet.

On the RPi is a VPN client running that should connect to a VPN server somewhere in the internet but i don't have internet on my RPi so i can't make a pi VPN.

My RPi IP before turning it into access point was 192.168.1.115. but in tutoral i use a static ip and the static ip of Rpi is 192.168.42.1 an gives ip to my phone and other devices in range of 192.168.42.10 to 50

Ingo
  • 42,107
  • 20
  • 85
  • 197
ali
  • 37
  • 1
  • 5
  • Your question is a bit confusing for me. I guess You have a router that connected to the internet and it has ethernet ports. This LAN is complete working with DHCP server. Devices connected to this LAN will get an ip address and can go into the internet. The router does not span a wifi network. For this you will have your RasPi. Right? You will use a VPN to connect to the internet but VNPs are not used for that. It is used to connect to other private devices far away on the other side of the internet. Why do you think you have to switch between modes? VPN could be used with access point. – Ingo Aug 20 '18 at 16:50
  • my raspi became a router router that connected to the internet and it has one ethernet port. and the router it self is a DHCP server. it allocate ip to devices in the LAN and router it self can't connect to the WiFi. i want to switch between modes to have internet. the access point mod doesn't have internet.to use VPN with access point mode i nedd to run some command like install sth or update sth and it needs internet. can you help me ? – ali Aug 20 '18 at 17:02
  • i need internet in access point mode how can i have it? – ali Aug 20 '18 at 18:18
  • or i should switch between modes to have internet and i do'nt know this too – ali Aug 20 '18 at 18:19
  • I have started an answer and given a scheme for what I understand so far. Please correct me with comments under the answer. – Ingo Aug 20 '18 at 18:41
  • Is your RPi a router or a bridge? – Dmitry Grigoryev Aug 21 '18 at 07:47
  • pi is a router i want to make a bridge but not now. – ali Aug 28 '18 at 16:21

2 Answers2

1

Your post is a bit busy, but I believe I understand what you're trying to accomplish. At the end of this post I provide a link to an opensource repo that will config your Pi 3 into an AP for you.

Like you, I use an ADSL modem but uplink it to a Mikrotik RB4011. I don't use a VPN.

So instead of connecting your Windows PC directly to the Internet modem, connect the Pi- which will be an AP- to the Internet modem. Then join the Windows laptop to the Pi Access Point. Then both the Pi and the laptop will have connectivity to each other and the Internet. Unless I'm misunderstanding something, it appears (might not be the case) that your networking is unduly complex.

Try using "pi-ap"- a Github repo that automates configuring a Pi into a wireless AP. It's quick and easy to use; don't need to be a networking guru. In addition to the README.md, there's also a Wiki on Github and the scripts themselves are extremely well commented, enabling users to tweak them to suit their particular use-cases:

https://github.com/f1linux/pi-ap/

Anyhoo, hope this helps you solve your problem Ali-

F1Linux
  • 1,667
  • 1
  • 12
  • 30
1

I guess this setup. The RPi is an access point. To this access point you can connect to its wifi for example with your cell phone. The RPi is connected with an ethernet cable to the internet router. The internet router has a DHCP server running and provides ip addresses to all connected devices, e.g. to the RPi and the phone. The internet router is connected to the internet and gives this to all connected devices. On the RPi is a VPN client running that connected to a VPN server somewhere in the internet.

                       D    10.10.10.2                    D        +----------+  10.10.10.1
                       H       /      vpn-tunnel          H        |          |      \
                       C      //=====================\\   C   //=====================> VPN-SERVER
                       P (tun0)                       \\  P  //    |          |
PHONE ~.~.~.~> (wlan0)RPI(eth0) ----------> PC ~.~.~.~> MODEM ---> | INTERNET |
     \  wifi                  \  ethernet  /  \  wifi         wan  |          |
   (dhcp)                     ip???    ip???  (dhcp)               +----------+

You want to use Picroft:

The Picroft project is an enclosure for a stock Raspberry Pi connected to a speaker and basic USB microphone. This is built around a Raspbian Jessie Lite installation. The entire project is available as a pre-built micro-SD image ready to be burned and placed into a Raspberry Pi.

As said it is a closed setup within an image. I'm afraid it is not easy to modify it without breaking its functionality. Also it use the obsolete Jessie version. I'm not familiar with Jessie.

I see three posibillities to solve your problem:

  1. Try to modify the Picroft installation either with scripts to switch between the network modes you need (that's what you prefer) or by setup an access point together with vpn. I think the latter is easier to set up because it is only one step forward to add a vpn to your access point installation.
  2. Make a dual boot installation with a boot manager for example with U-boot which is in the repositories. So you can switch by booting into Picroft without the need to modify it and you can boot into any other installation with the network setup you need.
  3. You invest into a second Raspberry Pi only for Picroft. That is for what Picroft is made.

If you ask me I would prefer point 3.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • The RPi is an access point. To this access point you can connect to its wifi for example with your cell phone. this line is correct – ali Aug 21 '18 at 05:26
  • The RPi is connected with an ethernet cable to the internet router. the internet router you say is my pc windows 10 that get wifi internet from a modem. the modem is dhcp that give 192.168.1.114 ip to my pc. – ali Aug 21 '18 at 05:32
  • before i connect pi to PC with cable it gives IP to my phone but. the pi and phone both didn't have internet. – ali Aug 21 '18 at 05:35
  • On the RPi is a VPN client running that connected to a VPN server somewhere in the internet.for this line i want to do this but i don't have internet o my RPi so i cant make a pi VPN. – ali Aug 21 '18 at 05:37
  • my Rpi IP before turning it into access point was 192.168.1.115. but in tutoral i use a static ip and the static ip of Rpi is 192.168.42.1 an gives ip to my phone and other devices in range of 192.168.42.10 to 50 – ali Aug 21 '18 at 05:40
  • @ali I see a solution but there are some questions and it is not an easy setup. Please let us go into the chat room because comments are limited: https://chat.stackexchange.com/rooms/81995/discussion-for-switch-raspberry-pi-3-between-access-point-and-non-access-point. I have asked something there. – Ingo Aug 21 '18 at 18:31