From a7790b7115aba9aec7bfc6df5fb834ecbcdbdb6e Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sun, 22 Feb 2026 16:46:18 -0800 Subject: [PATCH] chore(local-llms): add WSL Ollama connectivity test script Add a helper script to quickly verify Ollama reachability across localhost, WSL gateway, and nameserver paths to speed up Windows+WSL troubleshooting. Co-authored-by: Cursor --- __LOCAL_LLMs/windows_specific/test-ollama.sh | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 __LOCAL_LLMs/windows_specific/test-ollama.sh diff --git a/__LOCAL_LLMs/windows_specific/test-ollama.sh b/__LOCAL_LLMs/windows_specific/test-ollama.sh new file mode 100644 index 00000000..15d52796 --- /dev/null +++ b/__LOCAL_LLMs/windows_specific/test-ollama.sh @@ -0,0 +1,53 @@ +#!/bin/bash +echo "=== Testing Ollama connectivity from WSL ===" +echo "" + +echo "1. localhost:11434" +if curl -s --max-time 3 http://localhost:11434/api/tags >/dev/null 2>&1; then + echo " [OK] Reachable" + curl -s http://localhost:11434/api/tags | python3 -c "import sys,json; d=json.load(sys.stdin); print(f' Models: {len(d.get(\"models\",[]))}')" 2>/dev/null +else + echo " [FAIL] Not reachable" +fi +echo "" + +echo "2. Default gateway (ip route)" +GW=$(ip route show default 2>/dev/null | awk '{print $3}' | head -1) +echo " IP: ${GW:-not found}" +if [ -n "$GW" ]; then + if curl -s --max-time 3 "http://${GW}:11434/api/tags" >/dev/null 2>&1; then + echo " [OK] Reachable" + curl -s "http://${GW}:11434/api/tags" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f' Models: {len(d.get(\"models\",[]))}')" 2>/dev/null + else + echo " [FAIL] Not reachable" + fi +fi +echo "" + +echo "3. resolv.conf nameserver" +NS=$(grep nameserver /etc/resolv.conf 2>/dev/null | awk '{print $2}' | head -1) +echo " IP: ${NS:-not found}" +if [ -n "$NS" ]; then + if curl -s --max-time 3 "http://${NS}:11434/api/tags" >/dev/null 2>&1; then + echo " [OK] Reachable" + curl -s "http://${NS}:11434/api/tags" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f' Models: {len(d.get(\"models\",[]))}')" 2>/dev/null + else + echo " [FAIL] Not reachable" + fi +fi +echo "" + +echo "4. host.docker.internal" +if curl -s --max-time 3 http://host.docker.internal:11434/api/tags >/dev/null 2>&1; then + echo " [OK] Reachable" +else + echo " [FAIL] Not reachable" +fi +echo "" + +echo "5. Windows Ollama binding check" +echo " Ollama needs OLLAMA_HOST=0.0.0.0 on Windows to listen on all interfaces." +echo " If only localhost works on Windows but not from WSL, set this env var" +echo " on Windows and restart Ollama." +echo "" +echo "=== Done ==="