Unable to Transfer Files: Raspberry Pi Ubuntu Desktop using FastAPI Server with Static IP (172.168.4.50) not Reachable Outside
In this article, we will discuss the issue of transferring files from a Raspberry Pi Ubuntu desktop using a FastAPI server with a static IP address (172.168.4.50) that is not reachable outside of the local network.
Prerequisites:
Before we dive into the solution, let's make sure that you have the following prerequisites in place:
- Raspberry Pi Ubuntu Desktop
- FastAPI Server installed and running
- Static IP address assigned to the Raspberry Pi (172.168.4.50)
FastAPI Server Setup:
To set up the FastAPI server on your Raspberry Pi Ubuntu desktop, follow these steps:
- Install Python and pip:
- Install FastAPI:
- Create a new FastAPI application:
- Edit the main.py file:
- Add the following code:
- Start the FastAPI server:
sudo apt update
sudo apt install python3 python3-pip
pip install fastapi uvicorn
touch main.py
nano main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
uvicorn main:app --host 0.0.0.0 --port 8000
Transferring Files:
Now that we have the FastAPI server set up, let's try to transfer some files. However, we are encountering an issue where the Raspberry Pi Ubuntu desktop with the FastAPI server and static IP address (172.168.4.50) is not reachable outside of the local network.
To troubleshoot this issue, let's check the following:
- Check the network connection:
- Check the firewall:
- Check the router:
Make sure that the Raspberry Pi is connected to the internet and that the static IP address (172.168.4.50) is correctly assigned.
Check if there are any firewall rules blocking incoming connections to the FastAPI server.
Make sure that the router is forwarding incoming traffic to the Raspberry Pi's static IP address (172.168.4.50) and the correct port number (8000 in our example).
Conclusion:
In conclusion, when trying to transfer files from a Raspberry Pi Ubuntu desktop using a FastAPI server with a static IP address (172.168.4.50) that is not reachable outside of the local network, we need to ensure that the network connection is stable, the firewall is not blocking incoming connections, and the router is forwarding incoming traffic to the correct IP address and port number. By following these steps, we should be able to successfully transfer files from the Raspberry Pi Ubuntu desktop using the FastAPI server.