I have a Raspberry Pi with a 4G USB dongle connected to it for internet access. Everything works on power-up, everything auto-connects and connectivity is established.
In fact if I leave the Raspberry Pi on my desk powered up it stays connected through the 4G dongle for weeks without any issues.
As soon as I leave my mobile cell area, connectivity drops out and does not recover. I also want to be able to unplug the USB 4G dongle and reconnect it and have the cell link auto recover. I am using USB-Modeswitch and wvdial.
Is there anyway I can get the 4G dongle to auto recover?
Thanks for reading.
Brodes.
OK I think I have found the solution I was looking for....
I created this script that sends 5 pings to the other end of a VPN tunnel. If the pings fail then the Raspberry Pi reboots.
#!/bin/bash
# This script checks for an active Internet connection by pinging.
# If the pings fail, it will reset the USB modem dongle.
ping -c5 10.8.0.1
let a=$?
if [ "$a" != "0" ]; then
/sbin/shutdown -r now Connection lost, rebooting...
fi
Then I created a cronjob to run this script every 2 minutes.
If anyone has a better idea please let me know.
Cheers,
Brodes.
Related
I am new to Home Assistant and I currently have a disc image of the software installed on a Raspberry Pi 3b. I have managed to get this up and running successfully by connecting my PI to an internet connection via an ethernet cable and connecting my laptop to the same network wirelessly. The problem I am facing is that I wish to run this locally without an internet connection and simply connecting my laptop to the PI with the Ethernet cable does not seem to be working. I have tried looking around for support but I cannot seem to find much on the matter.
Home Assistant's default port is 8123 not 8023.
If there is a direct connection between your laptop and the Raspberry Pi then the chance is high that mDNS won't not work. Thus, homeassistant.local is not reachable.
Add a static IP address for your Home Assistant host and your laptop.
The installation is in a holidays house (so no permanent internet access)
I have a 4g-Routerm (ROUTER-1 = huawei B525-b23) that enable the internet access. I switch it on one day a week.
I have another router (ROUTER-2 = GL-MT300N-V2).
ROUTER-2 is always plugged on electricity.
On ROUTER-2 is connected through ethernet port a Raspberry-Pi3 (with Home Assistant on it).
On ROUTER-2 is connected through WIFI a Camera IP
ROUTER-1 and ROUTER-2 are connected together through ethernet.
When ROUTER-1 is not plug to electricity, none have acces to internet, but it's not an issue.
The camera save picture on the Rapbery Pi3, the Home Assistat is recording some sensor data.
When I switch on the electricity on the ROUTER-1, everyone have access to internet.
What I want is to have remote Access to my router-2 and my Rasberry and my Camera when ROUTER-1 is online
How should I do ?
Hi I can think of two solutions for this setup but both involve buying a second hand cheap router.
I think the use of a single router would make this setup a lot easier. Any router would work that supports:a USB 4g Modem to be attached to it, and has support for setting up a openvpn server and you need to be OK with leaving the Internet on all the time just make sure you dont have any services running that use up bandwidth and you should be ok. You can can connect both raspberry pi and IP camera to that router. Setup Openvpn server open the UDP port required and download the certificates, You should be able to vpn into your network and manage it through SSH or something remotely.
The second option is tailored to you but still requires swapping the 4G Modem with another one that supports these things: Wake on LAN, openvpn server, supports ssh into it over LAN and either has 4G support through a sim card slot or a usb port with modem support.
You can then have it setup so this new Router-1 is switched off with wake on lan configured on it and the raspberry pi to send the magic packet. You can use something like this to get an idea of how WoL https://www.lifewire.com/wake-on-lan-4149800. You can use cron on your raspberry pi to send WoL signal to Router 1 once a week which would eventually give you internet access once the router is up. You have to setup a vpn server on it and forward the required port and download the certificates. When your scheduled WoL cron runs make sure you are able to connect through vpn then access network resources you wish, at the end when you are done you can ssh into the router-1 and turn it off.
I hope this helps. I had a look at the router models you are using and it doesnt leave you with many options. You can get cheap second hand routers online that support everything that is required.
I wanna catch probe requests of mobile devices that are not connected to a network using monitor mode on Raspberry pi 3. I am using Raspbian OS. I used "Wifite" command but it only shows the mac addresses of access points and not of the non connected mobile device. I am a beginner in networking and Raspberry pi. Kindly guide me which commands should I use for this purpose?
You might try looking into sniff-probes.
It switches WiFi channels every two seconds and captures incoming packets using tcpdump.
I'm playing arround with a Raspberry pi zero but it has some issues powering my WIFI dongle.
Nov 21 21:42:49 raspberrypi kernel: [ 456.466068] usb 1-1.1: rejected 1 configuration due to insufficient available bus power
It works, but it requires some manual labour to to turn it on:
echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue
In my case, this enables the device and then all is well. However, I need to repeat this step after each boot (tried init script, no luck yet).
My question is how to solve this problem. Preferably i'd just like to disable the power check (if possible) and just have the kernel configure the device.
Is this possibe/is there a better solution?
I had a similar problem (my router sometimes acted weird and my Pi didn't reconnect) and I use a script that checks every minute if the Pi has a wifi connection, if not it "reboots the wifi". (Got it from this tutorial http://alexba.in/blog/2015/01/14/automatically-reconnecting-wifi-on-a-raspberrypi/)
#!/bin/bash
# The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8
# Only send two pings, sending output to /dev/null
ping -c2 ${SERVER} > /dev/null
# If the return code from ping ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
then
# Restart the wireless interface
ifdown --force wlan0
ifup wlan0
fi
Although it probably is not the most elegant solution you could just follow this tutorial and replace
ifdown --force wlan0
ifup wlan0
with this I guess:
echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue
But since you say that you say that you just need to run this script on boot and it works until you power the Pi back off again making a simple python script like
import os
os.system("echo 1 > /sys/bus/usb/devices/1-1.1/bConfigurationValue")
and making sure it starts on boot by adding this line in the /etc/rc.local file just above the exit 0 in that file:
sudo python /path/to/the/python/script/this_script.py
This should do the trick although I'm pretty sure the Pi has a good reason disabling your Wifi dongle (I'm pretty sure you could 'burn out' your Pi by using to much current if there was no protection). What Wifi dongle are you using and what are your powering you Pi with? I'm sorry for my not so clear answer, I'm just starting to get into the Pi but I hope I was at least of some help.
I have a Raspberry PI with Win 10 IoT installed.
The device is connected through Ethernet, I can ping it
I've connected through Powershell, changed admin password. Followed instructions here: http://ms-iot.github.io/content/en-US/win10/samples/PowerShell.htm
I can connect to the device's web based interface http://ip:8080
However, WindowsIoTCoreWatcher.exe does not show or list my device. I tried Refresh button, run as admin. Still no result.
How can I fix the issue?
Thank you,
WindowsIoTCoreWatcher listens for UDP broadcasts that are sent every five seconds by a process running on the device: C:\Windows\System32\ebootpinger.exe. It appears that this process occasionally dies or stops broadcasting, particularly if the device has not been rebooted in several days. It can be restarted with the PowerShell command (e.g. in a remote interactive session):
Start-Process ebootpinger.exe