#!/bin/bash # Run this ON THE GPU VM to fix firewall echo "=== Fixing Firewall for Ollama ===" echo "" # Check what firewall is running if command -v ufw > /dev/null 2>&1; then echo "Detected UFW firewall" echo "Current status:" sudo ufw status | head -5 echo "" echo "Allowing port 11434..." sudo ufw allow 11434/tcp echo "✓ Port 11434 allowed" elif command -v firewall-cmd > /dev/null 2>&1; then echo "Detected firewalld" sudo firewall-cmd --permanent --add-port=11434/tcp sudo firewall-cmd --reload echo "✓ Port 11434 allowed" else echo "Checking iptables..." if sudo iptables -L -n | grep -q 11434; then echo "Found iptables rules for 11434" else echo "Adding iptables rule..." sudo iptables -A INPUT -p tcp --dport 11434 -j ACCEPT echo "✓ Rule added (may need to save: sudo iptables-save)" fi fi echo "" echo "Verifying Ollama is accessible..." sleep 1 curl -s http://localhost:11434/api/tags | head -c 100 echo "" echo "" echo "✓ Done! Test from your local machine:" echo " curl http://10.0.30.63:11434/api/tags"