I need some help rather urgently and hope someone may be able to respond asap.
I have a functioning USB 4G dongle on my Rpi (3B+)
This Rpi is connected via ethernet to a router (Netgear DGN2200v4) and through to two more Rpis
Currently, when the USB dongle is connected, I can access the Internet but not the other machines via the router, due I suspect to network conflicts.
The USB dongle gets a DHCP IP in the range 192.168.8.xx
The router is also issuing DHCP in the range 192.68.0.xx
From Googling around I guess I need to set up DHCP on the master Rpi and dumb the router down to act as a hub.
Here’s a tutorial which is very close to what I need to achieve. I just don’t have the time to make a mess and sort it out.
I have installed Teamviewer on the Rpi and, if someone has the skills and time to configure this for me I will enable remote access.
I am also happy to pay for the time it takes.
Have you tried connecting your Pi router directly to one of the three computers to try to determine where the problem lies? It sounds to me like a configuration in the RPi but it would be good to be certain that it’s not the ethernet switch.
Thanks for your interest.
The Master Pi can communicate fine with the other two pi’s via the router when the 4G USB Dongle isn’t active. All the machines are then served DHCP leases from the router, on the same 192.168.0.xx IP range.
It’s only when the USB Dongle is plugged in that the master is ‘taken over’ by it and assumes an IP address in the 192.168.8.xx range to match that served up by Optus, my mobile data provider.
So I can do all the housekeeping and configuration I need, as long as I’m on location and plugged into the router with my laptop, with no USB modem plugged in. However, I’m about to deploy this device several miles away and need access to configure it remotely. The master Rpi will be powered up on a schedule to enable this.
How have you configured the network interfaces on the “master” pi? Is IP forwarding turned on?
I’ve made some progress… having replaced the Netgear Router with a simple hub which doesn’t serve DHCP.
I have installed dnsmasq on the master Rpi and it’s serving DHCP to the other RPis (lets call them slaves) connected to the hub.
I can now remotely access the machines and perform essential work however I would like the slaves to be able to see the Internet and currently they can’t. It’s a DNS issue that I’m trying to solve now with Google help.
If you are familiar with dnsmasq and DNS please chime in.
I would suggest checking 2 things.
What routes are defined on the slaves? Use the route command to list/show them. This can be configured in the network/interfaces file to add/delete the default gateway when the interface is brought up/down.
What name servers have you defined? Check resolve.conf to see what’s there.
I am pretty rusty on this stuff, but hopefully this will help.
running route command on a slave I get this result
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 202 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
and this is the resolv.conf on the same slave
root@piB3_CameraTwo:/home/pi# cat /etc/resolv.conf
Generated by resolvconf
the dhcp server is set as 192.168.0.1 and issuing IP’s in the 192.168.0.200+ range
To me this says that the slaves can talk to any machine with a 192.168. IP address directly, anything else goes via the 192.168.0.1 machine which I take to be the DHCP / DNSMasq machine. So, is IP forwarding set up on your master machine?
The master machine is also set as the DNS server. So the master must handle the DNS request from the slave or forward the request. I can’t remember if DNS requests use UDP as well as TCP. This stuff is probably being set in the DHCP negotiation. But still needs IP forwarding set up on the master if the slaves are to access the internet.
You can use nslookup to see what is or isn’t working with name resolution, including setting the name server inside the command.
If you want to access the slaves from the internet, you need to go much further, but get access to internet from the slaves working first.
To me this says that the slaves can talk to any machine with a 192.168. IP address directly, anything else goes via the 192.168.0.1 machine which I take to be the DHCP / DNSMasq machine.
So, is IP forwarding set up on your master machine?
I haven’t done that and it’s a new area for me.
I did follow a promising tutorial which showed how to bridge two interfaces to allow internet traffic from slave machines but it was specifically for sharing a wifi access point with other machines on a LAN and it didn’t get me all the way.
I can now access the slave machines now, via first sshing into the master then sshing to each slave in turn, However I can’t install or update anything on the slaves because they haven’t got access to the Net.
I’m pretty happy that I’ve got over the initial problem of accessing the slaves from the master.
I will Google tomorrow for some IP Forwarding material for Raspbian Stretch
Thanks for the pointer
Hi Nigel, In my experience it is never a good idea to have two DHCP servers on the same subnet - this is why it works fine with simple network switch arrangement but not when going through the daisy chained routers.
Using a 4G dongle is fine for the internet connection, but maybe disable that DHCP and connect it to the router as a ‘WAN’ connection. This might require some reconfiguration for you.
Hope this helps, I am no expert and a bit old school (but that is not always a bad thing) - keep it as simple as possible is my attitude, the more complexity the more likely to have issues.
I hear you. I hadn’t thought of the Wifi Dongle as containing it’s own router but I guess it may have to dish out IPs in order for it’s host Rpi to get one.
I haven’t had time today to look into IP forwarding. Allowing the slaves access to the Net would be nice and convenient, However having solved the major task of remote access I can at least continue in a working fashion. Even if it does mean sshing into the Master then sshing to the slaves from there on in.
WiFi enabled 4G dongles (commonly referred to as 'Wingles") or non WiFi dongles do have a DHCP server embedded in them because they work as a router for WiFi or USB connected devices.
If you don’t use any WiFi component of a Wingle or just a dongle, then you should be able to disable that devices DHCP. I say should, because the setup of two ‘routers’ can be tricky at times, and require at least some NAT translation.
How are you connecting this device to the Rpi (Master)? via USB - which probably is implemented as a USB ethernet port. You can likely hard code that port to a suitable static IP address/subnet in the range provided by the other router (or get an address from the router DHCP although you might be better connecting the Rpi (Master) to the WAN port on the other router. The other router will like include NAT and other capabilities including IP forwarding and the like, which could be useful to you and also manage some of the remote access needs
I use a Wingle as the second WAN in a dual WAN configuration on my NBN connection via a separate ASUS router. this allows me some peace of mind when there the NBN broadband service slows or fails. I also have another Telstra router/gateway inside my local network (handling VoIP), plus two other AP’s which use the main router for IP addressing and LAN gateway services. it works well, with plenty of bandwidth shared around many devices. Touch wood, reliability is great with no LAN outages in nearly 2 years - just manual router firmware updates.
The above arrangement is fairly similar to what you are trying to do, I think. As part of some development work I am doing with a Pycom Gpy - I have also tested the network using the GPy LTE connection as the main WAN - no issues at all other than the reduced bandwidth of the 4G service
The 4G dongle I am using on this rig is a Huawei E3372
Its not wifi enabled as far as I know.
It comes up in the Rpi as eth1
Current config of the Rpi has it acting as DCHP server using DNSMASQ, dishing out in the range 192.168.0.200 - 192.168.0.300
I don’t know how to access the router settings on the dongle. If you have any suggestions, other than Google, I’d appreciate some pointers.
Sounds like you’re much more comfortable in networking than I. I think of it as the dark art of IT.
Thanks again for your interest. It’s nice not to feel alone in a world of not quite appropriate, often outdated and frequetnly confusing and incomplete tutorials, especially with networking, where one wrong detail can leave one locked out of access. I’ve had to hard reboot my slaves several times now, for lack of connectivity. I wince every time I pill the power, hoping the SD card doesn’t decide to write something at the same time.
Hi Nigel, The E3372 is a single device 4G dongle (note there are several variants of the device with a couple of those specific to Oz). So it connects to a single device (i.e. PC or modem) by USB and has an inbuilt DHCP server, to provide the connected device with an IP address. It sounds like you haven’t changed the device settings at all so the USB Dongle will probably have an IP of 192.168.8.1. If you have a PC on the same network/subnet (or plug the dongle into your laptop), type that address into the search bar of your browser- it should connect and bring up the home page, Look on there until you find the Login option and click on that. the username and password will be defaults (admin/password or admin/admin etc.) - if the IP address is different or any of that doesn’t work try pressing the reset button on the device as the USB modem may have been reconfigured. You might want to search for a manual too :-).
Once logged in there will be a menu bar where you can select Settings. When that screen comes up, the menu on the left side (i think) will show a an option for LAN - have a hunt around there for the DHCP settings… you can set the device IP, DHCP range or enable/disable DHCP. Depending on whether you want to keep another router on your LAN, I’d disable the USB DHCP but there will be setting required to get it working properly. Don’t forget to Apply/Save any changes you make and remember that if you change the device IP or DHCP, you will need to log in again… Good luck - it’s worth the effort to get it figured out.
Those USB modems are from a few years back - I’m pretty sure I have one in my drawer somewhere so I will find it and plug it in and try to help you further.
Newer models (including WiFi wingles) are not expensive even when new from a telco, Officeworks, Australia Post and hardly normal all stock them. if you buy a prepaid one, you can use a postpaid SIM (Telstra/Optus) in it - I have several of the newer ones, the builtin WiFi is handy for wireless connectivity to the device and attached network.
Nigel, that DHCP range you quoted is incorrect - max is 192.168.0.254.
Thanks again for your continued support and information,
I will get into the settings on my dongle today.
I also have a wireless version, which I could swap in and might be just as useful in the short term because, although I now have remote access, I am not yet in a position to leave the master pi turned on all the time.
The rig is solar powered (with battery back up) and my attempts to schedule daily waking times for it aren’t yet working.
I am working on an Arduino solution for this and will implement it asap.
PS. of course, 255 is the max range for each of the four IP ranges… I will change that today.
You are correct in your assumption that the IP address of the Huawei is 192.168.8.1
I’m just wondering, if I change that to a fixed IP, in the same range (subnet?) ie. 192.168.0.xx that dnsmasq on the Rpi is issuing to the slaves attached to the hub, will the slaves get access to it and, by extension, the Net?
It seems too good to be true, so it probably isn’t.
I’ll try it after breakfast.
Hi Nigel, changing the dongles IP to a static one, in the same range as the router is worth a try… a few variable in that but would be a neat solution. Just ensure that IP you set is outside the DHCP range of the router to avoid conflicts. The other option is to look at port forwarding and NAT. Is the ‘eth1’ port on the Rpi just a normal LAN port or a WAN port?
You’ll find the WiFi 4G dongle useful and with more documentation/support available.
Managing power of remote devices is always a challenge!
I just browsed to the USB dongles config page at 192.168.8.0 and couldn’t find any settings to change from DHCP to static IP.
There’s a bunch of settings related to mobile data that I don’t recognise but nothing visible in any tabs regarding DHCP. Later today I will try the experiment the other way around… ie change the Rpi Master dnsmasq DHCP assignment range from
That I can do. will report back later