0

I do not have internet except by using my mobile phone. Last week I bought my first raspberry pi its a 4b and is really amazing. I'm an experienced programmer but a networking failure. I have linux & windows machines so I wanted to use the raspberry pi 4b as a NAS which meant getting an ubiquity edgerouter x with 5 RJ45 ports and no usb ports and no wireless. I hoped to run a home LAN without internet connectivity but it seems I need internet for various reasons. Connecting my samsung J6+ to the raspberry pi wirelessly and by USB works perfectly. I know that as a wireless hot spot the phone lets me connect multiple computers to the internet but in USB tethered mode it only works with one machine - I believe this enables a phone with a static address to use a phone supplied dhcp server to connect to 1 or many depending upon how connected. I do need the phone to go through the router.

Reading in many places (including here) I realised that I should repurpose my rasperry pi to being a bridge between phone and router ie set phone on USB tethering; connect phone to the pi; run ethernet cable from pi to router eth0 ie wan. From a good article here I have set up the pi and installed a dhcp server, told the pi to use my static ip address on my phone which is of the form 10.123.12.123/24 and I believe I effectively set up virtual eth0 and eth1 on my pi. It all seemed reasonable but I'm not sure if all is running correctly at this stage - I do not really know how and what sort of output I could get to ensure it is good so far.

Anyway assuming it is good I then went onto my router and turned of dhcp on my router, set eth0 as a static address exactly the same as my phone. but I'm required to set up a gate way and dns address which seems to be contrary to the answer I was trying to impliment. Looking at my pi changes it seems to setting up a single static address on all 3 components and using port forwarding to pass information to and from the static ipaddress about gateway & dns. I imagined the dhcp server on the pi would manage everything and the router would thank the pi and go about its business of connecting to clients.

Could somebody

  1. Tell me if my understanding is right or wrong,
  2. give me a clue about the router settings that are required (eg gateway, DNS) and
  3. confirm that the ethernet cable should go into the wan port (eth0) of my router.

In programming I know how to put in debug code to see how it is running but linking bits of hardware together is all a bit magical.

I think I'll be getting an internet connection within the next few months but I think this is a good first project for me. And I need it now - which means getting another pi for my NAS to run owncloud and OMV. By the way, instead of scrapping my augmented noobs flash card is there a way to rollback the changes I made. Any hints or tips would be appreciated - the more I have to read, contrast and compare the greater becomes my understanding.

  • From the description it seems to look good so far with the setup. But what exactly is the question? It's too vague asking "is my setup OK?". Yes, seems to be. I don't understand the role of the router. It seems to act more like a switch. And using static ip addresses is not a good idea. It make things more complex than simplify it. You should avoid it if possible. The DHCP server knows it better. Please note that we are not a discussion style forum and open ended invitations to brainstorm are not appropriate to the format. Do you can get into the internet with a device connected to the router? – Ingo Dec 23 '20 at 12:42
  • Thank you for replying. I appologise for asking your help for the wrong reason. I withdraw my request for support. I have been looking deeper anyway and it seems the advice I was given to use a static adress was wrong because I have checked my ipaddress on my phone several times now and it changes so it is not static. I am making headway on understanding gateways etc so all I need to do is figure out if I need to extract it from my phone or if I am simply overcomplicated things. I was not trying to brainstorm I simply wanted to know more about gateways etc on mobile phones. Thankyou. – Mike Bassett Dec 23 '20 at 13:51

1 Answers1

1

Well done so far. I will give an overview how I would set up the network and try to answer your questions. Because it is a bit opinion based, you have to decide what network technology to use. There are classic Linux networking where you will find examples all over the internet. And there is a newer, modern technology, coming up more and more the last time. I like to use systemd-networkd for general networking because I think it is the future. You cannot mix up it very well with classic networking (it is possible with restrictions). I think it is a good idea to start with it as an introduction to network technology. Lets have a look at.

I imagined the dhcp server on the pi would manage everything and the router would thank the pi and go about its business of connecting to clients.

It seems the router cannot do much (no wireless, no USB, only 5 wired ports) and because we are on the Raspberry Py site, I will use the RasPi as central device that managed the network, provide a wireless access point and connect to the internet. I will see the router as switch that only connects the wired network part.

Your smartphone will be connected with an USB cable to the RasPi if needed, so you can unplug it and carry with you. USB tethering is supported by the Linux kernel and working out of the box. The RasPi is creating an access point so you can use WiFi to connect to your local network. The wired interface will be bridged to the access point so you will have the same ip address range and broadcast domain on the wired and wireless part of your network.

Just start with a fresh flashed Raspberry Pi OS Lite. We do not need a Graphical User Interface. I have an example for a setup: How can I set my pi 3 up to be WiFi AND ethernet router simultaneously?. Just connect the wired port to the router instead to the laptop as shown in that schema. All other 4 devices connected to the router will have access to the internet then and can communicate to each other device on the network. It is important that you have only one DHCP server running on the network, that on the RasPi. If you run into problems, just ask a new question.

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • Thank you, your solution looks perfect for me but I hit a problem implimenting it. I will raise another question relating to this because my comment was too long. – Mike Bassett Dec 26 '20 at 12:38