Create a web server using gsm module - raspberry-pi

I am using raspberry pi
I am using signalR to send data to my client browser.
If my raspberry is on the same network via Ethernet or WiFi then I can get it to work.
If I now disconnect Ethernet and WiFi and switch on my gsm module I get assigned a dhcp address like 10.126.88.4 etc
If I now go to a client browser and type that ip address in the browser it will eventually time-out and upon investigation I find the raspberry pi has been assigned a different IP address.
This happens every time I refresh the browser.
After googling I find that it is the network providers doing this to stop the gsm being used as a server gateway.
One of the solutions is to use a proxy server but I could potentially have a lot of data passing through and
my initial idea was to have client browser talking directly to the raspberry pi device using gsm and thus not going through my own server.
Is there a solution to my predicament?

Related

How do I connect to my raspberry pi in a different network?

Let me explain what I want to happen.
I have an http server program that displays a website every time I connect to my raspberry pi's ip address on port 8080. But this only works on my current network. I want to be able to access this raspberry pi from any network by typing a website address. How would I connect my URL to this raspberry pi so that I can just type the domain and it will take me to my raspberry pi?
P.S. I have already tried searching for this extensively, but none of the results fits my needs
Thank you in advance,
Nick.
Assuming that your current network is your home network and any network is the internet as such, I think your question points into the direction of dynamic DNS (DDNS).
DDNS allows you to assign a fixed domain name to the (usually) varying external IP adresses of your home network.
This would make your PI reachable to the outside world.
Search for DDNS providers.

UDP packets over NB-IoT

I'm trying to send UDP packets over the t-mobile NB-IoT network using AT-commands on a SIM7020E chip. I used the product wiki as reference. The starter version of the sim card I have doesn't support TCP, but I'm planning on using that later if I can succesfully communicate using UDP.
I created a UDP-socket on a Raspberry Pi using "nc -u -l 9999". I set an A-record on my hosting provider to refer dev.mydomain.com to the IP address of the Raspberry Pi. I verified the portforward and A-record settings by sending UDP packets from my laptop on another network using "nc -u dev.mydomain.com 9999" and typing some teststrings, so this all works.
On the 4G chip I use the following AT-commands:
// Check network
AT+CSQ
+CSQ: 21,0
AT+CGREG?
+CGREG: 0,5
AT+COPS?
+COPS: 0,2,"20416",9
AT+CGCONTRDP
+CGCONTRDP: 1,5,"iot.t-mobile.nl","x.x.x.x.255.255.255.0" <-- crossed out my ip
// Create UDP socket
AT+CSOC=1,2,1
+CSOC: 0
// Connect socket 0 to the listening port on the Raspberry Pi
AT+CSOCON=0,9999,"dev.mydomain.com"
OK
// Send "test"
AT+CSOSEND=0,0,"test"
At this point I expect to see "test" appear in the command line on the Raspberry Pi, but nothing happens. In the T-mobile portal it shows a PDP-context is successfully activated.
Also, setting the APN manually with AT*MCGDEFCONT="IP","iot.t-mobile.nl","username","password" doesn't work.
Did you work this out Hans? I was plodding along with a SIM7020E following https://www.waveshare.com/wiki/Pico-SIM7020E-NB-IoT code examples. Was successfully sending HTTP GETS to a server (without having to use micropython's wretched urequests lib) via the CHTTPCREATE/CHTTPCON/CHTTPSEND AT cmds, that seem to be be able to send packets over LTE to a server without specifying TCP/UDP etc or using a socket. Maybe give it a try?
Sadly I got the bright idea of trying an 'AT+POWD=1' cmd over the uart (was supposed to power the 7020E down) & now the module now does nothing but echo AT cmds (still auto connects to the LTE network & slow flashes the network led, just won't do anything else.) Real shame, nice little module otherwise.

Periodically the Internet disappears in the router Mikrotik

Good afternoon need help. There is a router Mikrotik. The Internet and wi-fi started to disappear, but the connection is periodically resumed. The Mac address is specified by my router in an error.
Error in logs : bridge port received packet with own address as source address (ee:ee:8c:0c:ee:fd), probably loop.
You need share a better environment description.
However, assuming you're using wireless interface, you can try proxy ARP on Wireless interface for avoid loops under WiFi bridge.
/interface wireless set arp=proxy-arp
More info here.

MQTT broker connect without pre-set IP address

I am building a application to use raspberry as MQTT broker & client and receive the message from ESP32 which is another MQTT client. I need to have ESP32 to get the broker connected without pre-setting IP address manually. Does anyone know how to let raspberry share the IP address wirelessly and safely? Or could the raspberry pi get a static IP address no matter what network configuration user changed? Thank you for any help or discuss.
These two instructions gave some help: to build mDNS lookups in raspberry and mDNS client to receive string input. More logic needed to define the principle of "blind search" but considering the security reason, we preferred to transfer string host name by BLE from app side.
mDNS client in ESP32 to receive string input
How is the ESP32 (DOIT DevKit) finding another host in the same LAN via mDNS?
to build mDNS lookups in raspberry:
http://root42.blogspot.com/2015/02/how-to-setup-mdns-lookups-on-raspberry.html

2 router in cascade with 2 DHCP and remote access

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.