Use a model on your own second computer
Connect to an Ollama instance over SSH while keeping the model server bound to the host’s loopback address.
Check the model host first
Use two computers you control or have permission to use. The host runs Ollama and has the model downloaded. The client is where you write prompts. The host needs working SSH access, and you need its username, address, and verified SSH host key.
On the host, confirm that the model works and keep Ollama on its default loopback address.
ollama list
ollama run qwen2.5:1.5b "Name a gardening tool."
Open a local forward from the client
Replace youruser@model-host with your SSH login. Verify the host key with the host owner if SSH asks on first connection. Keep this terminal open while you use the model.
ssh -N -o ExitOnForwardFailure=yes -L 127.0.0.1:11435:127.0.0.1:11434 youruser@model-host
The first address and port are on the client. The second address and port are reached from the SSH host. SSH handles access to the tunnel, so the model API can stay on the host’s loopback interface. The host still receives and processes the prompts.
Send a request through SSH
In a second client terminal, check the forwarded API. On Windows PowerShell, use curl.exe if curl invokes a PowerShell alias.
curl --fail http://127.0.0.1:11435/api/tags
In the Python lesson’s local_chat.py, change the port in the request URL from 11434 to 11435 and run it on the client.
The client lists the model installed on the host and prints a generated reply. Stop SSH with Ctrl+C when you finish. If the port is already in use, choose another client port and use it in both commands.
Check your understanding
Which computer’s memory holds the model?
The host loads the weights and generates the reply. The client sends the request and displays the response.
Sources
Progress is saved in this browser.