<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>LAN on KnightLi Blog</title>
        <link>https://www.knightli.com/en/tags/lan/</link>
        <description>Recent content in LAN on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Sat, 11 Apr 2026 16:43:52 +0800</lastBuildDate><atom:link href="https://www.knightli.com/en/tags/lan/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>How to Access a Local Ollama API Over LAN on Windows</title>
        <link>https://www.knightli.com/en/2026/04/11/ollama-api-lan-access-windows/</link>
        <pubDate>Sat, 11 Apr 2026 16:43:52 +0800</pubDate>
        
        <guid>https://www.knightli.com/en/2026/04/11/ollama-api-lan-access-windows/</guid>
        <description>&lt;p&gt;If you want other devices in the same LAN to access your local Ollama API, follow these steps.&lt;/p&gt;
&lt;h2 id=&#34;set-the-listening-host&#34;&gt;Set the listening host
&lt;/h2&gt;&lt;p&gt;First, set Ollama to listen on all network interfaces:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;OLLAMA_HOST=0.0.0.0:11434&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;open-the-firewall&#34;&gt;Open the firewall
&lt;/h2&gt;&lt;p&gt;In Windows Firewall advanced settings, create an inbound rule and allow the target port (for example &lt;code&gt;8080&lt;/code&gt;):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press Win + S, search and open &amp;ldquo;Windows Defender Firewall&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Advanced settings&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Select &amp;ldquo;Inbound Rules&amp;rdquo; -&amp;gt; &amp;ldquo;New Rule&amp;hellip;&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Choose &amp;ldquo;Port&amp;rdquo;, then click &amp;ldquo;Next&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Select protocol (usually TCP), enter the target port in &amp;ldquo;Specific local ports&amp;rdquo; (for example &lt;code&gt;8080&lt;/code&gt;), then click &amp;ldquo;Next&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Choose &amp;ldquo;Allow the connection&amp;rdquo;, then click &amp;ldquo;Next&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;In &amp;ldquo;Profile&amp;rdquo;, select Domain, Private, and Public, then click &amp;ldquo;Next&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Name the rule (for example &lt;code&gt;OpenPort8080&lt;/code&gt;) and click &amp;ldquo;Finish&amp;rdquo;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-ollama&#34;&gt;Run Ollama
&lt;/h2&gt;&lt;p&gt;Ollama run 模型&lt;/p&gt;
&lt;h2 id=&#34;access-the-model-through-api&#34;&gt;Access the model through API
&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;curl http://192.168.x.xxx:11434/api/generate -d &lt;span class=&#34;s1&#34;&gt;&amp;#39;{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s1&#34;&gt;  &amp;#34;model&amp;#34;: &amp;#34;gemma4&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s1&#34;&gt;  &amp;#34;prompt&amp;#34;: &amp;#34;这个是什么模型?&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s1&#34;&gt;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
        </item>
        
    </channel>
</rss>
