Raspberry pi refusing connection to bottle server - linux

I'm trying to host a bottle server on my raspberry pi (4, zero w or zero 2 with newest pi os) to supply some configuration for a project.
The raspberry pi itself will not have internet access but will be its own wifi accespoint.
i set it up in the way the docs describe (search for "Setting up a Routed Wireless Access Point")
I have skipped the "Enable Routing and IP Masquerading" step because i don't need traffic to be rerouted to another network
The tutorial works fine and i'm able to connect to the hotspot. I'm also able to run the bottle server example and connect to it locally.
However, i'm not able to connect to it from a device that is connected to the hotspot. i'm getting an ERR_CONNECTION_REFUSED(when supplying the ip of the raspberry and port of the bottle server to the browser)
I don't really know where to start looking
Is there a firewall setting i missed?
Should i have done the "Enable Routing and IP Masquerading" step?
Is there something entirely different i need to look at?
Can someone point me in the right direction?

Try starting bottle on the 0.0.0.0 interface rather than localhost. That makes it listen for incoming connections on all interfaces, whereas if you start on localhost it only listens for connections from the local host.

Related

SSH connection not established, but standard TCP/IP connection works

I'm working on a custom yocto Linux for a Raspberry PI 3 and try to get the WIFI connection working with SSH. However when trying to connect from my PC (Ubuntu 19.10, SSH OpenSSH_8.0p1 Ubuntu-6build1, OpenSSL 1.1.1c 28 May 2019) to the PI on which Dropbear v2019.78 runs, the connection attempt times out. But only when I try this via SSH, and via wlan0. Other TCP/IP traffic works, and also using the same participants but with eth0. As this is for a robot, I would prefer to not use a tether though...
To try & debug this, I
enabled a serial console so I can work on the PI
disabled eth0
started a tcpdump on the PI (ip.host == 192.168.0.105)
started a tcpdump on the PC (ip.host == 192.168.0.106)
used a dirt-simple TCP/IP socket example written in Python (taken from https://realpython.com/python-sockets/#echo-server) to verify I can in fact communicate. The transmission is successful. I am aware that the example is lacking (no proper protocol etc), but that's not the point of it. It just works enough. The PI runs the server listening on port 2222.
attempted a SSH connection, it timed out.
I filtered the resulting PCAP down to contain just TCP, as there is other information (e.g. Dropbox discovery) that I don't think matters and might potentially be information leaking. On the host side (enp4s0-tcp-and-pi.pcap) I also filtered with ip.host == 192.168.0.105 to only contain any traffic to the PI.
Another note on my setup here: I use a TP-Link router which LAN ports the PC is connected to, and who provides the 2.4GHz WIFI for the PI. So both are part of the same subnet, and no special routing or anything is configured.
Also I stopped the dropbear daemon and adapted my Python code to use port 22. It works.
I'm only broadly aware of the inner workings of TCP, so I can't really make much sense of the things I see here. Any insights are more than welcome.
https://www.dropbox.com/s/5o4rqr5zdws2wq7/wlan0-tcp-only.pcap?dl=0
https://www.dropbox.com/s/amypjtk1nvja4qb/enp4s0-tcp-and-pi.pcap?dl=0

Send request from Webserver to Local server

I have a nodejs webserver running on a vserver (rented by me) and a local Raspberry Pi node server.
I dont want to open any ports for beeing accesable from the webserver.
My problem is that I want to create a web application you can interact with and the rpi should do things when any button is pressed on the webserver.
I thought it would be smart to create a json file on the webserver and my local server would listen on the json file.
Is there any better Idea?
Thx for your advice!
your problem can be solved using reverse proxy softwares that establishes secure tunnels from a public endpoint such as internet to a locally running network service.
ngrok is one of the best that I prefer to use.
To establish a communication between the raspberry and the webserver you need to open a port on the webserver.
However, you can restrict it to allow connections from the raspberry pi IP address only. Or do the connection via ssh and let the raspberry pi authenticate using its public key.

Unable to open apache website from internet of my Raspberry Pi B+ V2

I setup Apache server on my Raspberry Pi.
In LAN it is working fine.
But when I tried to open it with my public IP it simply gets Timed Out.
I opened a Port : 2323
Checked on canyouseeme.org
Means I have configured port forwarding correctly...?
Now I am trying to open this page with url: 122.175.144.237:2323 it shows Time Out Error.
I have 2 devices
Binatone ADSL2/2+ Modem+router
Tenda N3 Wirless N150 WiFi Router
and my Raspberry Pi is connect with WIFI with static IP 192.168.192.99
I searched for this problem but till now not found any appropriate solution.
Is there any problem in configuration of Apache? or I missed some configuration. or it is because of apache restricting to open page with public IP or not allowing to open over internet.
Is there any way..?
Even if the port is open on the external interface of your router, that doesn't necessarily imply that port forwarding is setup correctly, just that the router isn't flat-out rejecting that traffic. Also, as you have a second wireless router in your network (that is probably itself running NAT), you must also have port forwarding setup on that as well.
Apache must also be configured to answer for the virtual host it is being addressed as. It should answer on it's IP with a default page, but without knowing specifics I couldn't rule it out.
That should get you started, but at this point you still need to narrow the problem down quite a bit before proceeding.

How to login into beaglebone black remotely

I have my beaglebone black running stock Angstrom Linux and is connected to ethernet at my home. I can login from any PC connected to my home network using SSH. I would like to know how can I login from another network, say I am at my office and I am connected to internet. I want to login into my beaglebone black which is connected to internet at my Home. How can I do this?
Thanks in Advance
You have a public IP address, that is given to you by your Internet operator. This public IP however will be different than the IP of your Beagle in your local network.
To login to your Beagle from the Internet, you need to connect to your public IP address, and need to add port forwarding to your router, so that port 22, which is the socket port that is used by ssh, is forwarded from your public IP to your local IP.
So, you need to login to your router management console, and go to "port forwarding" options, and select to forward TCP/IP connections to port 22 be forwarded to your Beagle IP. For this to work longer term, you should set static IP address to your Beagle, otherwise if your board stays offline for long time, the DHCP server on your router will probably assign different IP at some point, and the forwarding would need to be setup again.
There is a good guide on the static IP address setting in Beagle/Angstrom here: http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/
One more thing: Since your operator will also assign different public IP for you from time to time, you might want to have some kind of Dynamic DNS service in use. With this kind of service, you can create your "custom" DNS address (for example user3180454.no-ip.com), that will always point to your Public IP address to which you can create ssh connection (the service will require some method to keep this IP address up to date, you will see instructions on how to do it from the service you use).
Couple services like this:
http://no-ip.com/
http://freedns.afraid.org/
You might also want to try out the Weaved connection service installer for BeagleBone Black. I'm using it to connect:
SSH on port 22
BBB web server on port 80
tightVNC server on port 5901
Shell in a Box on port 4200
Apache web server on port 8080
See:
https://developer.weaved.com/portal/members/betabeagle.php
If you are:
Connecting to from a BeagleBoard via USB Ethernet
from Mac Air running Mavericks & connected to web via Wifi
I found this very helpful:
http://makezine.com/2012/07/16/use-your-mac-laptop-as-a-wireless-proxy-for-raspberry-pi/
In short >> install/run a proxy server (with Squidman) & your life will be easier.
I know this is an old question. But I thought I'd suggest another option. I use TeamViewer (https://www.teamviewer.com) to connect to my work/home computers. You could use something like this to connect to your home computer from the office. Once connected to your home computer, you could then do whatever you need to do on your home network. No port forwarding required.

How to set up Dynamic DNS to view Pi camera stream remotely

I have followed the main tutorials to set up a motion activated raspi camera. I can get it to stream locally. On my pi's IPadress on port 8080 like so, IPADDRESS:8080
It only works on my local network. I also tried setting up a dynamic dns service, which I can now also view my feed at username.dnsdynamic.com:8080, but it STILL does not work outside my local network.
I have searched through tons of tutorials but there are zoo many and none of them have worked for me so far.
I am utterly confused with networking stuff. I am pretty tech savvy, but I am at a loss. Any help would be greatly appreciated!
If you are connecting the pi to a router you will have configure port forwarding on your router so that requests from outside your local network gets forwarded to the pi.
You will at least need to forward the HTTP traffic from some port on your routers internet facing interface to the correct port (8080) and ip address for your pi. If the camera stream uses another port you will have set up port forwarding for that port as well.

Resources