<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Paradiso</title>
	<atom:link href="https://sam.liho.tw/feed/" rel="self" type="application/rss+xml" />
	<link>https://sam.liho.tw</link>
	<description>Everyone has his own paradiso. You may find me on the way to the paradiso.</description>
	<lastBuildDate>Mon, 16 Mar 2026 02:25:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">103145657</site>	<item>
		<title>PDF 移除密碼</title>
		<link>https://sam.liho.tw/2026/03/16/pdf-%e7%a7%bb%e9%99%a4%e5%af%86%e7%a2%bc/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Mon, 16 Mar 2026 02:25:41 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[pdf]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7780</guid>

					<description><![CDATA[方法 1：用 qpdf（Linux / macOS / Windows 都可） 這是最常用的 CLI 工具。 安裝 macOS（brew）： Rocky / RHEL / CentOS： Ubuntu： 移除密碼 例如： 完成後 unlocked.pdf 就沒有密碼了。 方法 2：用 Ghostscript 如果系統有 Ghostscript： 如果有密碼： 方法 3：直接用瀏覽器（最簡單） 用： 步驟： 新存的 PDF 就沒有密碼。]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">方法 1：用 qpdf（Linux / macOS / Windows 都可）</h2>



<p>這是最常用的 CLI 工具。</p>



<h3 class="wp-block-heading">安裝</h3>



<p>macOS（brew）：</p>



<pre class="wp-block-code"><code>$ brew install qpdf</code></pre>



<p>Rocky / RHEL / CentOS：</p>



<pre class="wp-block-code"><code>$ sudo dnf install qpdf</code></pre>



<p>Ubuntu：</p>



<pre class="wp-block-code"><code>$ sudo apt install qpdf</code></pre>



<h3 class="wp-block-heading">移除密碼</h3>



<pre class="wp-block-code"><code>$ qpdf --password=YOUR_PASSWORD --decrypt input.pdf output.pdf</code></pre>



<p>例如：</p>



<pre class="wp-block-code"><code>$ qpdf --password=123456 --decrypt secret.pdf unlocked.pdf</code></pre>



<p>完成後 <code>unlocked.pdf</code> 就沒有密碼了。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">方法 2：用 Ghostscript</h2>



<p>如果系統有 Ghostscript：</p>



<pre class="wp-block-code"><code>$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
-sOutputFile=output.pdf \
-c .setpdfwrite \
-f input.pdf</code></pre>



<p>如果有密碼：</p>



<pre class="wp-block-code"><code>$ gs -sPDFPassword=YOUR_PASSWORD -q -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite \
-sOutputFile=output.pdf \
input.pdf</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">方法 3：直接用瀏覽器（最簡單）</h2>



<p>用：</p>



<ul class="wp-block-list">
<li>Google Chrome</li>



<li>Microsoft Edge</li>



<li>Preview</li>
</ul>



<p>步驟：</p>



<ol class="wp-block-list">
<li>開啟 PDF</li>



<li>輸入密碼</li>



<li><strong>列印 (Print)</strong></li>



<li>選擇 <strong>Save as PDF</strong></li>
</ol>



<p>新存的 PDF 就沒有密碼。</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7780</post-id>	</item>
		<item>
		<title>用 ssh tunnel 跳別台機器</title>
		<link>https://sam.liho.tw/2025/10/08/%e7%94%a8-ssh-tunnel-%e8%b7%b3%e5%88%a5%e5%8f%b0%e6%a9%9f%e5%99%a8/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Wed, 08 Oct 2025 12:49:01 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[SOCKS]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7775</guid>

					<description><![CDATA[例如我有一台 168.95.x.95 電腦 然後我想透過這台電腦跳入內網 192.168.x.95。可以透過下列步驟： 先登入後，建立 localhost 的 1080 port 提供 Proxy protocol . 使用 SOCKS 5 然後就可以用另外一個視窗跳入內網. 192.168.95.95 以上請參考]]></description>
										<content:encoded><![CDATA[
<p>例如我有一台 168.95.x.95 電腦 然後我想透過這台電腦跳入內網 192.168.x.95。可以透過下列步驟：</p>



<pre class="wp-block-code"><code> $ ssh -D 1080 168.95.x.59</code></pre>



<p>先登入後，建立 localhost 的 1080 port 提供 Proxy protocol . 使用 SOCKS 5</p>



<pre class="wp-block-code"><code>$  netstat -an|grep 1080
tcp4 0 0 127.0.0.1.1080 <em>.</em> LISTEN
tcp6 0 0 ::1.1080 <em>.</em> LISTEN</code></pre>



<p>然後就可以用另外一個視窗跳入內網. 192.168.95.95</p>



<pre class="wp-block-code"><code>$ ssh -o "ProxyCommand=/usr/bin/nc -X 5 -x 127.0.0.1:1080 %h %p" 192.168.x.95</code></pre>



<p>以上請參考</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7775</post-id>	</item>
		<item>
		<title>SNMP 讀取設備溫度</title>
		<link>https://sam.liho.tw/2024/06/12/snmp-%e8%ae%80%e5%8f%96%e8%a8%ad%e5%82%99%e6%ba%ab%e5%ba%a6/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Wed, 12 Jun 2024 03:17:08 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[snmp]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7595</guid>

					<description><![CDATA[以下範例為 HPE ProLiant DL380 伺服器範例： 以下為 Dell PowerEdge R710 伺服器範例： #]]></description>
										<content:encoded><![CDATA[
<p>以下範例為 HPE ProLiant DL380 伺服器範例：</p>



<pre class="wp-block-code"><code># snmpwalk -v1 -c public 192.168.x.x 1.3.6.1.4.1.232.6.2.6.8.1.4.0.1
iso.3.6.1.4.1.232.6.2.6.8.1.4.0.1 = INTEGER: 23</code></pre>



<p>以下為 Dell PowerEdge R710 伺服器範例：</p>



<p>#</p>



<p></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7595</post-id>	</item>
		<item>
		<title>Linux 預約關機</title>
		<link>https://sam.liho.tw/2024/04/25/linux-%e9%a0%90%e7%b4%84%e9%97%9c%e6%a9%9f/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Thu, 25 Apr 2024 01:49:54 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7589</guid>

					<description><![CDATA[偶爾會有 Linux 機器預約關機的需求，下列範例預約將近的 9:30AM 關機： 系統回應 用 shutdown -c 取消 還不賴]]></description>
										<content:encoded><![CDATA[
<p>偶爾會有 Linux 機器預約關機的需求，下列範例預約將近的 9:30AM 關機：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# shutdown -h 09:30
Shutdown scheduled for Fri 2024-04-26 09:30:00 CST, use 'shutdown -c' to cancel.</code></pre>



<p>系統回應 用 shutdown -c 取消 還不賴</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7589</post-id>	</item>
		<item>
		<title>macOS 防火牆設定</title>
		<link>https://sam.liho.tw/2024/02/17/macos-%e9%98%b2%e7%81%ab%e7%89%86%e8%a8%ad%e5%ae%9a/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Sat, 17 Feb 2024 02:43:10 +0000</pubDate>
				<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[macOS]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7576</guid>

					<description><![CDATA[蘋果預設狀態防火牆應該是關閉的，可以到 系統偏好 的 防火牆 開啟 然後，可以選擇哪些服務開通： 可是，從 macOS 預設的 GUI 防火牆設定不太能設定一些進階的規則，只能設定允許哪些 ports 無法限制來自於哪些 ip。這樣不是很實用，也不夠安全。所以必須手動編輯防火牆規則。先打開終端機用管理者權限編輯 /etc/pf.conf 檔案。假設你要架設網頁只能允許某特定的網段或是ip瀏覽： 然後重新啟動防火牆設定 這樣就只能允許 192.168.1.0/24 網段和來自於 10.10.10.10 的 ip 的設備連入 另外，假設你只要設定來至於某網路介面的特定 ip 可以使用 ssh ，那可以用下列設定：]]></description>
										<content:encoded><![CDATA[
<p>蘋果預設狀態防火牆應該是關閉的，可以到 系統偏好 的 防火牆 開啟</p>



<figure class="wp-block-image size-large"><a href="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM.png"><img fetchpriority="high" decoding="async" width="1024" height="897" src="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-1024x897.png" alt="" class="wp-image-7577" srcset="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-1024x897.png 1024w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-300x263.png 300w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-768x673.png 768w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-700x613.png 700w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM-332x291.png 332w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.04 AM.png 1435w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>然後，可以選擇哪些服務開通：</p>



<figure class="wp-block-image size-large"><a href="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM.png"><img decoding="async" width="1024" height="897" src="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-1024x897.png" alt="" class="wp-image-7578" srcset="https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-1024x897.png 1024w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-300x263.png 300w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-768x673.png 768w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-700x613.png 700w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM-332x291.png 332w, https://sam.liho.tw/wp-content/uploads/2024/02/Screenshot-2024-02-17-at-10.25.15 AM.png 1430w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>可是，從 macOS 預設的 GUI 防火牆設定不太能設定一些進階的規則，只能設定允許哪些 ports 無法限制來自於哪些 ip。這樣不是很實用，也不夠安全。所以必須手動編輯防火牆規則。先打開終端機用管理者權限編輯 /etc/pf.conf 檔案。假設你要架設網頁只能允許某特定的網段或是ip瀏覽：</p>



<pre class="wp-block-code"><code>sam@liho ~ % sudo vi /etc/pf.conf

block return in proto tcp from any to any port 443
pass in inet proto tcp from 10.10.10.10 to any port 443 no state
pass in inet proto tcp from 192.168.1.0/24 to any port 443 no state
pass in inet proto tcp from 127.0.0.1 to any port 443 no state</code></pre>



<p>然後重新啟動防火牆設定</p>



<pre class="wp-block-code"><code>sam@liho ~ % sudo pfctl -f /etc/pf.conf
sam@liho ~ % sudo pfctl -E</code></pre>



<p>這樣就只能允許 192.168.1.0/24 網段和來自於 10.10.10.10 的 ip 的設備連入</p>



<p>另外，假設你只要設定來至於某網路介面的特定 ip 可以使用 ssh ，那可以用下列設定：</p>



<pre class="wp-block-code"><code>sam@liho ~ % sudo vi /etc/pf.conf

block on en1 proto tcp from any to 10.10.10.10 port 22
pass on en1 proto tcp from 168.95.x.x to port 22 no state

修改後記得重新啟動防火牆</code></pre>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7576</post-id>	</item>
		<item>
		<title>Linux 指令 &gt;, &gt;, </title>
		<link>https://sam.liho.tw/2024/02/16/linux-%e6%8c%87%e4%bb%a4/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Fri, 16 Feb 2024 05:13:11 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7565</guid>

					<description><![CDATA[有時候會被 linux 指令搞得暈頭轉向 XD 所以記錄一下筆記 用 「>」 大於符號，代表將右邊的輸出結果導向右邊的某個檔案或指令，例如： 用 「&#60; 」小於符號，代表將左邊的輸出結果導向左邊的某個檔案或指令，例如： 用 「>> 」兩個大於符號，代表將左邊的輸出結果附加到某個檔案或指令，例如： 用 「&#60;&#60; 」兩個小於符號，代表將右邊的輸出結果附加到某個檔案或指令 ，常見的用法就是透過 script 建立檔案，例如： 用 「&#38;」and 符號，代表將程式放到背景執行： 用 「&#38;&#38;」兩個 and 符號，代表分開兩個指令，前面執行成功後再執行後面的指令，例如編譯程式： 例如檢查某目錄是否存在，存在就執行後面的指令： 用 「&#124;」pipe line 符號，代表將執行結果導入另外一個指令： 用 「&#124;&#124;」兩個 pipe line 符號，代表分開兩個指令，前面執行失敗後才會執行後面的指令，例如： 如果要將某目錄不存在建立好之後並改變一次權限可以用下列指令： 如果要將某目錄不存在建立好之後並每次都改變權限可以用下列指令：]]></description>
										<content:encoded><![CDATA[
<p>有時候會被 linux 指令搞得暈頭轉向 XD 所以記錄一下筆記</p>



<p>用 「<strong>></strong>」 大於符號，代表將右邊的輸出結果導向右邊的某個檔案或指令，例如：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ echo "hello wolrd" > helloworld.txt
&#91;sam@liho ~]$ cat helloworld.txt
hello wolrd</code></pre>



<p>用 「<strong>&lt;</strong> 」小於符號，代表將左邊的輸出結果導向左邊的某個檔案或指令，例如：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ read messages &lt; helloworld.txt
&#91;sam@liho ~]$ echo $messages
hello wolrd</code></pre>



<p>用 「<strong>>></strong> 」兩個大於符號，代表將左邊的輸出結果附加到某個檔案或指令，例如：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ echo "i'm sam." >> helloworld.txt
&#91;sam@liho ~]$ cat helloworld.txt
hello wolrd
i'm sam.</code></pre>



<p>用 「<strong>&lt;&lt;</strong> 」兩個小於符號，代表將右邊的輸出結果附加到某個檔案或指令 ，常見的用法就是透過 script 建立檔案，例如：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ cat &lt;&lt;EOF > foo.txt
i'm foo.
you are bar.
we are foo and bar.
EOF
&#91;sam@liho ~]$ cat foo.txt
i'm foo.
you are bar.
we are foo and bar.
</code></pre>



<p>用 「<strong>&amp;</strong>」and 符號，代表將程式放到背景執行：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ sleep 5 &amp;
&#91;1] 58352
&#91;sam@liho ~]$
&#91;1]  + done       sleep 5</code></pre>



<p>用 「<strong>&amp;&amp;</strong>」兩個 and 符號，代表分開兩個指令，前面執行成功後再執行後面的指令，例如編譯程式：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ make &amp;&amp; make install</code></pre>



<p>例如檢查某目錄是否存在，存在就執行後面的指令：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ ls -ld bin
drwxr-xr-x  5 sam  sam  160 Nov 29 12:53 bin
&#91;sam@liho ~]$ &#91;&#91; -d "bin" ]] &amp;&amp; echo "i found bin"
i found bin
&#91;sam@liho ~]$ ls -ld foo
ls: foo: No such file or directory
&#91;sam@liho ~]$ &#91;&#91; -d "foo" ]] &amp;&amp; echo "i found foo"
&#91;sam@liho ~]$</code></pre>



<p>用 「<strong>|</strong>」pipe line 符號，代表將執行結果導入另外一個指令：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ ls -ld bin --full-time
drwx------ 3 sam sam 11776 2023-11-14 14:26:39.000000000 +0800 bin
&#91;sam@liho ~]$ ls -ld bin --full-time | awk '{print $6}'
2023-11-14</code></pre>



<p>用 「<strong>||</strong>」兩個 pipe line 符號，代表分開兩個指令，前面執行失敗後才會執行後面的指令，例如：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ cat dog.txt || echo "there is no dog.txt"
cat: dog.txt: No such file or directory
there is no dog.txt

&#91;sam@liho ~]$ cat dog.txt &amp;&amp; echo "there is no dog.txt"
cat: dog.txt: No such file or directory</code></pre>



<p>如果要將某目錄不存在建立好之後並改變一次權限可以用下列指令：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ &#91; -d /scratch/$USER ] || ( mkdir /scratch/$USER ; chmod 750 /scratch/$USER )</code></pre>



<p>如果要將某目錄不存在建立好之後並每次都改變權限可以用下列指令：</p>



<pre class="wp-block-code"><code>&#91;sam@liho ~]$ &#91; -d /scratch/$USER ] || mkdir /scratch/$USER ; chmod 750 /scratch/$USER</code></pre>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7565</post-id>	</item>
		<item>
		<title>如何讓 macOS 透過指令朗讀文字？</title>
		<link>https://sam.liho.tw/2024/02/16/%e5%a6%82%e4%bd%95%e8%ae%93-macos-%e9%80%8f%e9%81%8e%e6%8c%87%e4%bb%a4%e6%9c%97%e8%ae%80%e6%96%87%e5%ad%97%ef%bc%9f/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Fri, 16 Feb 2024 03:05:28 +0000</pubDate>
				<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[mac]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7562</guid>

					<description><![CDATA[先簡單示範一個 hello world 也可以直接讀某文字檔案 甚至可以把語音內容轉換成檔案]]></description>
										<content:encoded><![CDATA[
<p>先簡單示範一個 hello world</p>



<pre class="wp-block-code"><code>sam@liho ~ % say Hello World</code></pre>



<p>也可以直接讀某文字檔案</p>



<pre class="wp-block-code"><code>sam@liho ~ % cat hello.txt
hello world. this is a text file.
sam@liho ~ % say -f hello.txt</code></pre>



<p>甚至可以把語音內容轉換成檔案</p>



<pre class="wp-block-code"><code>sam@liho ~ % say -o hello.m4a --data-format=alac -f hello.txt</code></pre>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7562</post-id>	</item>
		<item>
		<title>使用 Google Nest Mini 串流 AirPlay 藉由 macOS</title>
		<link>https://sam.liho.tw/2024/01/27/%e4%bd%bf%e7%94%a8-google-nest-mini-%e4%b8%b2%e6%b5%81-airplay-%e8%97%89%e7%94%b1-macos/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Sat, 27 Jan 2024 05:21:06 +0000</pubDate>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[AirPlay]]></category>
		<category><![CDATA[Google Nest Mini]]></category>
		<category><![CDATA[macOS]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7548</guid>

					<description><![CDATA[之前有寫一篇「使用 Google Nest Mini 串流 AirPlay 藉由 Raspberry Pi」，後來發現效能不是很好有點 lag，所以改用 Mac 桌機來幫忙串流。目標還是把 Google Nest Mini 變成可以透過 AirPlay 串流音樂。 可以先瀏覽&#160;AirConnect&#160;使用已經發佈的版本：https://github.com/philippe44/AirConnect/releases 然後我選擇當前的版本 1.7.0 ，先下載好該版本 AirConnect-1.7.0.zip 。建議先建立好一個目錄再解開，要不然會有一堆檔案散落在您的 Downloads 目錄。 安裝前先安裝 openssl 如果 homebrew 位於 /opt/homebrew 路徑，那要變成 root 並設定 openssl 環境 然後把下載預先編譯好的執行檔案複製到相對應的地方，並且設定可以執行。 可以先用 aircast 執行確認一下是否有抓到 Google Nest Mini，因為我的環境有兩個網段，所以要指定綁定在哪個網段。如果沒有別的網段就可以忽略 -b 的選項。 執行後會出現安全警告，的確也要注意因為有可能裡面會有惡意程式，我選擇相信它 ，所以先按 Cancel： 然後進入「系統偏好」內「安全及隱私」允許 &#8230;]]></description>
										<content:encoded><![CDATA[
<p>之前有寫一篇「<a href="https://sam.liho.tw/2023/06/18/%e4%bd%bf%e7%94%a8-google-nest-mini-%e4%b8%b2%e6%b5%81-airplay/" data-type="post" data-id="7442" target="_blank" rel="noreferrer noopener">使用 Google Nest Mini 串流 AirPlay 藉由 Raspberry Pi</a>」，後來發現效能不是很好有點 lag，所以改用 Mac 桌機來幫忙串流。目標還是把 Google Nest Mini 變成可以透過 AirPlay 串流音樂。</p>



<p>可以先瀏覽&nbsp;<a href="https://github.com/philippe44/AirConnect" target="_blank" rel="noreferrer noopener">AirConnect</a>&nbsp;使用已經發佈的版本：<a href="https://github.com/philippe44/AirConnect/releases">https://github.com/philippe44/AirConnect/releases</a></p>



<p>然後我選擇當前的版本 <a href="https://github.com/philippe44/AirConnect/releases/tag/1.7.0">1.7.0</a> ，先下載好該版本 AirConnect-1.7.0.zip 。建議先建立好一個目錄再解開，要不然會有一堆檔案散落在您的 Downloads 目錄。</p>



<pre class="wp-block-code"><code>sam@liho ~ % mkdir ~/Downloads/AirConnect-1.7.0
sam@liho ~ % cd ~/Downloads/AirConnect-1.7.0
sam@liho AirConnect-1.7.0 % unzip ~/Downloads/AirConnect-1.7.0.zip
Archive:  /Users/sam/Downloads/AirConnect-1.7.0.zip
  inflating: aircast-freebsd-x86_64
  inflating: aircast-freebsd-x86_64-static
  inflating: aircast-linux-aarch64
  inflating: aircast-linux-aarch64-static
  inflating: aircast-linux-arm
  inflating: aircast-linux-arm-static
  inflating: aircast-linux-armv5
  inflating: aircast-linux-armv5-static
  inflating: aircast-linux-armv6
  inflating: aircast-linux-armv6-static
  inflating: aircast-linux-mips
  inflating: aircast-linux-mips-static
  inflating: aircast-linux-mipsel
  inflating: aircast-linux-mipsel-static
  inflating: aircast-linux-powerpc
  inflating: aircast-linux-powerpc-static
  inflating: aircast-linux-sparc64
  inflating: aircast-linux-sparc64-static
  inflating: aircast-linux-x86
  inflating: aircast-linux-x86-static
  inflating: aircast-linux-x86_64
  inflating: aircast-linux-x86_64-static
  inflating: aircast-macos
  inflating: aircast-macos-arm64
  inflating: aircast-macos-arm64-static
  inflating: aircast-macos-static
  inflating: aircast-macos-x86_64
  inflating: aircast-macos-x86_64-static
  inflating: aircast-solaris-x86_64
  inflating: aircast-solaris-x86_64-static
  inflating: aircast-static.exe
  inflating: aircast.exe
  inflating: airupnp-freebsd-x86_64
  inflating: airupnp-freebsd-x86_64-static
  inflating: airupnp-linux-aarch64
  inflating: airupnp-linux-aarch64-static
  inflating: airupnp-linux-arm
  inflating: airupnp-linux-arm-static
  inflating: airupnp-linux-armv5
  inflating: airupnp-linux-armv5-static
  inflating: airupnp-linux-armv6
  inflating: airupnp-linux-armv6-static
  inflating: airupnp-linux-mips
  inflating: airupnp-linux-mips-static
  inflating: airupnp-linux-mipsel
  inflating: airupnp-linux-mipsel-static
  inflating: airupnp-linux-powerpc
  inflating: airupnp-linux-powerpc-static
  inflating: airupnp-linux-sparc64
  inflating: airupnp-linux-sparc64-static
  inflating: airupnp-linux-x86
  inflating: airupnp-linux-x86-static
  inflating: airupnp-linux-x86_64
  inflating: airupnp-linux-x86_64-static
  inflating: airupnp-macos
  inflating: airupnp-macos-arm64
  inflating: airupnp-macos-arm64-static
  inflating: airupnp-macos-static
  inflating: airupnp-macos-x86_64
  inflating: airupnp-macos-x86_64-static
  inflating: airupnp-solaris-x86_64
  inflating: airupnp-solaris-x86_64-static
  inflating: airupnp-static.exe
  inflating: airupnp.exe
  inflating: libcrypto-1_1.dll
  inflating: libssl-1_1.dll
  inflating: ucrtbase.dll
  inflating: vcruntime140.dll</code></pre>



<p>安裝前先安裝 openssl</p>



<pre class="wp-block-code"><code>sam@liho AirConnect-1.7.0 % brew install openssl</code></pre>



<p> 如果 homebrew 位於 /opt/homebrew 路徑，那要變成 root 並設定 openssl 環境</p>



<pre class="wp-block-code"><code>sam@liho AirConnect-1.7.0 % sudo -s
Password:
root@liho AirConnect-1.7.0 # ln -s /opt/homebrew/lib/libssl.dylib /usr/local/lib/libssl.dylib
root@liho AirConnect-1.7.0 # ln -s /opt/homebrew/lib/libcrypto.dylib /usr/local/lib/libcrypto.dylib</code></pre>



<p>然後把下載預先編譯好的執行檔案複製到相對應的地方，並且設定可以執行。</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # mkdir -p /usr/local/bin
root@liho AirConnect-1.7.0 # cp aircast-macos-x86_64-static /usr/local/bin/aircast
root@liho AirConnect-1.7.0 # chmod 755 /usr/local/bin/aircast</code></pre>



<p>可以先用 aircast 執行確認一下是否有抓到 Google Nest Mini，因為我的環境有兩個網段，所以要指定綁定在哪個網段。如果沒有別的網段就可以忽略 -b 的選項。</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # /usr/local/bin/aircast -b en0</code></pre>



<p>執行後會出現安全警告，的確也要注意因為有可能裡面會有惡意程式，我選擇相信它 ，所以先按 Cancel：</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large is-style-default"><a href="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM.png"><img decoding="async" width="744" height="808" data-id="7549" src="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM.png" alt="" class="wp-image-7549" srcset="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM.png 744w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM-276x300.png 276w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM-700x760.png 700w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.49.41-PM-332x361.png 332w" sizes="(max-width: 744px) 100vw, 744px" /></a></figure>
</figure>



<p>然後進入「系統偏好」內「安全及隱私」允許 aircast 這支程式，解鎖然後按「Allow Anyway」</p>



<figure class="wp-block-image size-large"><a href="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM.png"><img loading="lazy" decoding="async" width="1024" height="918" src="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-1024x918.png" alt="" class="wp-image-7550" srcset="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-1024x918.png 1024w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-300x269.png 300w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-768x688.png 768w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-1536x1376.png 1536w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-700x627.png 700w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM-332x298.png 332w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.05-PM.png 1560w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>再次執行前述指令「/usr/local/bin/aircast -b en0」，然後按「Open」繼續。</p>



<figure class="wp-block-image size-large"><a href="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM.png"><img loading="lazy" decoding="async" width="727" height="1024" src="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM-727x1024.png" alt="" class="wp-image-7551" srcset="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM-727x1024.png 727w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM-213x300.png 213w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM-700x986.png 700w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM-332x468.png 332w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-12.50.41-PM.png 744w" sizes="auto, (max-width: 727px) 100vw, 727px" /></a></figure>



<p>用上述的指令，就可以啟動服務，但是還沒設定成背景執行。 先用 command ⌘ + C 跳出來。然後產生 config 檔案，用下列指令：</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # mkdir -p /usr/local/etc
root@liho AirConnect-1.7.0 # /usr/local/bin/aircast -b en0 -i /usr/local/etc/aircast.xml</code></pre>



<p>然後進入「/usr/local/etc/aircast.xml」檔案編輯，看哪些要 disable 哪些要重新命名。下面的範例省略其他裝置，如果要 disable 就把 「&lt;enabled&gt;1&lt;/enabled&gt;」改成「&lt;enabled&gt;0&lt;/enabled&gt;」，如果要改名就編輯在「&lt;name&gt;XXXXXXX&lt;/name&gt;」裡面的值。</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # vi /usr/local/etc/aircast.xml
(omit)
&lt;device&gt;
&lt;udn&gt;FE49198C-0AFE-4687-A516-XXXXXXXXXXXX&lt;/udn&gt;
&lt;name&gt;Google Nest Mini&lt;/name&gt;
&lt;mac&gt;cc:cc:b7:XX:XX:XX&lt;/mac&gt;
&lt;enabled&gt;1&lt;/enabled&gt;
&lt;/device&gt;
(omit)</code></pre>



<p>然後用下列指令啟動服務：</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # /usr/local/bin/aircast -b en0 -l -z -x /usr/local/etc/aircast.xml</code></pre>



<p>沒有問題的話應該可以看到剛剛設定的 Google Nest Mini</p>



<figure class="wp-block-image size-full"><a href="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-1.13.27-PM.png"><img loading="lazy" decoding="async" width="692" height="584" src="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-1.13.27-PM.png" alt="" class="wp-image-7552" srcset="https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-1.13.27-PM.png 692w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-1.13.27-PM-300x253.png 300w, https://sam.liho.tw/wp-content/uploads/2024/01/Screen-Shot-2024-01-27-at-1.13.27-PM-332x280.png 332w" sizes="auto, (max-width: 692px) 100vw, 692px" /></a></figure>



<p>然後在 console 按 command ⌘ + C 跳出來，開始設定每次開機自動執行 aircast 程式，先產生 Launch Daemons 組態檔。</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # vi /Library/LaunchDaemons/aircast.plist
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
&lt;plist version="1.0">
    &lt;dict>
        &lt;key>Label&lt;/key>
        &lt;string>aircast&lt;/string>
        &lt;key>ProgramArguments&lt;/key>
        &lt;array>
            &lt;string>/usr/local/bin/aircast&lt;/string>
            &lt;string>-b&lt;/string>
            &lt;string>en0&lt;/string>
            &lt;string>-l&lt;/string>
            &lt;string>-z&lt;/string>
            &lt;string>-x&lt;/string>
            &lt;string>/usr/local/etc/aircast.xml&lt;/string>
        &lt;/array>
        &lt;key>NetworkState&lt;/key>
        &lt;true/>
        &lt;key>RunAtLoad&lt;/key>
        &lt;true/>
        &lt;key>LaunchOnlyOnce&lt;/key>
        &lt;true/>
        &lt;key>KeepAlive&lt;/key>
        &lt;true/>
        &lt;key>StandardErrorPath&lt;/key>
        &lt;string>/var/log/aircast.log&lt;/string>
        &lt;key>EnvironmentVariables&lt;/key>
        &lt;dict>
            &lt;key>PATH&lt;/key>
            &lt;string>/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin&lt;/string>
        &lt;/dict>
    &lt;/dict>
&lt;/plist></code></pre>



<p>然後設定開機後就執行</p>



<pre class="wp-block-code"><code>root@liho AirConnect-1.7.0 # launchctl enable system/aircast
root@liho AirConnect-1.7.0 # launchctl bootstrap system /Library/LaunchDaemons/aircast.plist</code></pre>



<p></p>



<p>如果開機不想load可以用下列指令：</p>



<pre class="wp-block-code"><code>root@liho ~ # launchctl unload -w /Library/LaunchDaemons/aircast.plist
root@liho ~ # rm -rf /Library/LaunchDaemons/aircast.plist</code></pre>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7548</post-id>	</item>
		<item>
		<title>用 smartmontools 檢查硬碟狀態</title>
		<link>https://sam.liho.tw/2023/12/25/%e7%94%a8-smartmontools-%e6%aa%a2%e6%9f%a5%e7%a1%ac%e7%a2%9f%e7%8b%80%e6%85%8b/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Mon, 25 Dec 2023 01:45:14 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7525</guid>

					<description><![CDATA[偶然有機會用到這個 smartmontools 工具，覺得蠻值得筆記一下，它可以檢查硬碟的健康狀態。 先直接安裝一下 smartmontools 工具： 然後使用 smartctl 指令檢查狀態： 這顆硬碟剛好有延遲錯誤]]></description>
										<content:encoded><![CDATA[
<p>偶然有機會用到這個 <a href="https://www.smartmontools.org/">smartmontools</a> 工具，覺得蠻值得筆記一下，它可以檢查硬碟的健康狀態。 先直接安裝一下  <a href="https://www.smartmontools.org/">smartmontools</a> 工具：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# dnf install smartmontools -y
Last metadata expiration check: 0:41:10 ago on Mon 25 Dec 2023 08:59:32 AM CST.
Dependencies resolved.
==================================================================================================================================================
 Package                               Architecture                   Version                                Repository                      Size
==================================================================================================================================================
Installing:
 smartmontools                         x86_64                         1:7.2-7.el9                            baseos                         548 k

Transaction Summary
==================================================================================================================================================
Install  1 Package

Total download size: 548 k
Installed size: 1.9 M
Downloading Packages:
smartmontools-7.2-7.el9.x86_64.rpm                                                                                5.6 MB/s | 548 kB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                             943 kB/s | 548 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                          1/1
  Installing       : smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1
  Running scriptlet: smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1
Created symlink /etc/systemd/system/multi-user.target.wants/smartd.service → /usr/lib/systemd/system/smartd.service.

  Verifying        : smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1

Installed:
  smartmontools-1:7.2-7.el9.x86_64

Complete!</code></pre>



<p>然後使用  smartctl 指令檢查狀態：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# smartctl -a /dev/sdg
smartctl 7.2 2020-12-30 r5155 &#91;x86_64-linux-5.14.0-284.11.1.el9_2.x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HPE
Product:              MB018000JYCLK
Revision:             HPD3
Compliance:           SPC-4
User Capacity:        18,000,207,937,536 bytes &#91;18.0 TB]
Logical block size:   512 bytes
Physical block size:  4096 bytes
Rotation Rate:        7200 rpm
Form Factor:          3.5 inches
Logical Unit id:      0x5000039cd801d179
Serial number:        XXXXXXXXXXXX
Device type:          disk
Transport protocol:   SAS (SPL-3)
Local Time is:        Mon Dec 25 09:41:50 2023 CST
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Enabled

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK

Current Drive Temperature:     26 C
Drive Trip Temperature:        60 C

Accumulated power on time, hours:minutes 259:50
Manufactured in week 40 of year 2023
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  71
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  71
Elements in grown defect list: 0

Error counter log:
           Errors Corrected by           Total   Correction     Gigabytes    Total
               ECC          rereads/    errors   algorithm      processed    uncorrected
           fast | delayed   rewrites  corrected  invocations   &#91;10^9 bytes]  errors
read:          0       48         0         0          0      69548.551           0
write:         0       15         0         0          0      58096.019           0
verify:        0        0         0         0          0          0.008           0

Non-medium error count:        0

No Self-tests have been logged</code></pre>



<p>這顆硬碟剛好有延遲錯誤</p>



<p></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7525</post-id>	</item>
		<item>
		<title>Linux 手動調整 25GbE 為 10GbE</title>
		<link>https://sam.liho.tw/2023/12/12/linux-%e6%89%8b%e5%8b%95%e8%aa%bf%e6%95%b4-25gbe-%e7%82%ba-10gbe/</link>
		
		<dc:creator><![CDATA[Sam Tseng]]></dc:creator>
		<pubDate>Tue, 12 Dec 2023 08:40:38 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networks]]></category>
		<guid isPermaLink="false">https://sam.liho.tw/?p=7522</guid>

					<description><![CDATA[有時候需要直接指定介面為 10GbE，先查詢一下目前網路介面支援的速度： 目前跑在 10Gb 的速度。如果不想要讓他跑別的速度，可以用下列指令讓網路只跑 10GbE： 上面的設定. 不管怎麼換 GBICs 1G or 25G 都只能跑 10GbE。 如果想恢復原本可以跑多種速度可以先查 ethtool 的 man pages 說明： 把你要的速度加總，例如：0x20000 + 0x80000 + 0x80000000 + 0x100000000 + 0x200000000 = 0x3800a0000 就可以使用下列指令還原本來的速度：]]></description>
										<content:encoded><![CDATA[
<p>有時候需要直接指定介面為 10GbE，先查詢一下目前網路介面支援的速度：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# ethtool ens10f0np0
Settings for ens10f0np0:
	Supported ports: &#91; FIBRE ]
	Supported link modes:   1000baseKX/Full
	                        10000baseKR/Full
	                        25000baseCR/Full
	                        25000baseKR/Full
	                        25000baseSR/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: None	 RS	 BASER
	Advertised link modes:  1000baseKX/Full
	                        10000baseKR/Full
	                        25000baseCR/Full
	                        25000baseKR/Full
	                        25000baseSR/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: None	 RS	 BASER
	Speed: 10000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: FIBRE
	PHYAD: 0
	Transceiver: internal
	Supports Wake-on: g
	Wake-on: g
        Current message level: 0x00000004 (4)
                               link
	Link detected: yes</code></pre>



<p>目前跑在 10Gb 的速度。如果不想要讓他跑別的速度，可以用下列指令讓網路只跑 10GbE：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# ethtool -s ens10f0np0 autoneg on speed 10000 duplex full

&#91;root@liho ~]# ethtool ens10f0np0
Settings for ens10f0np0:
	Supported ports: &#91; FIBRE ]
	Supported link modes:   1000baseKX/Full
	                        10000baseKR/Full
	                        25000baseCR/Full
	                        25000baseKR/Full
	                        25000baseSR/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: None	 RS	 BASER
	Advertised link modes:  10000baseKR/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: None	 RS	 BASER
	Speed: 10000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: FIBRE
	PHYAD: 0
	Transceiver: internal
	Supports Wake-on: g
	Wake-on: g
        Current message level: 0x00000004 (4)
                               link
	Link detected: yes</code></pre>



<p>上面的設定. 不管怎麼換 GBICs 1G or 25G 都只能跑 10GbE。</p>



<p>如果想恢復原本可以跑多種速度可以先查 ethtool 的 man pages 說明：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# man ethtool
.
.
.
(omit)
           advertise N
                  Sets the speed and duplex advertised by autonegotiation.  The argument is a hexadecimal value using one or a combination of the following values:

                  0x001                       10baseT Half
                  0x002                       10baseT Full
                  0x004                       100baseT Half
                  0x008                       100baseT Full
                  0x80000000000000000         100baseT1 Full
                  0x40000000000000000000000   100baseFX Half
                  0x80000000000000000000000   100baseFX Full
                  0x010                       1000baseT Half               (not supported by IEEE standards)
                  0x020                       1000baseT Full
                  0x20000                     1000baseKX Full
                  0x20000000000               1000baseX Full
                  0x100000000000000000        1000baseT1 Full
                  0x8000                      2500baseX Full               (not supported by IEEE standards)
                  0x800000000000              2500baseT Full
                  0x1000000000000             5000baseT Full
                  0x1000                      10000baseT Full
                  0x40000                     10000baseKX4 Full
                  0x80000                     10000baseKR Full
                  0x100000                    10000baseR_FEC
                  0x40000000000               10000baseCR Full
                  0x80000000000               10000baseSR Full
                  0x100000000000              10000baseLR Full
                  0x200000000000              10000baseLRM Full
                  0x400000000000              10000baseER Full
                  0x200000                    20000baseMLD2 Full           (not supported by IEEE standards)
                  0x400000                    20000baseKR2 Full            (not supported by IEEE standards)
                  0x80000000                  25000baseCR Full
                  0x100000000                 25000baseKR Full
                  0x200000000                 25000baseSR Full
.
.
.
(omit)</code></pre>



<p>把你要的速度加總，例如：0x20000 + 0x80000 + 0x80000000 + 0x100000000 + 0x200000000 = 0x3800a0000 就可以使用下列指令還原本來的速度：</p>



<pre class="wp-block-code"><code>&#91;root@liho ~]# ethtool -s ens10f0np0 advertise 0x3800a0000</code></pre>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7522</post-id>	</item>
	</channel>
</rss>
