<?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>驱动 &#8211; Simon</title>
	<atom:link href="https://www.luisimon.com/tag/%E9%A9%B1%E5%8A%A8/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.luisimon.com</link>
	<description>blog</description>
	<lastBuildDate>Tue, 28 May 2024 07:20:30 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>https://www.luisimon.com/wp-content/uploads/2019/09/cbrks-x5t4i-001.ico</url>
	<title>驱动 &#8211; Simon</title>
	<link>https://www.luisimon.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>FreeNAS Realtek RTL8168H 驱动程序编译与安装（教程）</title>
		<link>https://www.luisimon.com/2020/05/25/325/</link>
		
		<dc:creator><![CDATA[Alan]]></dc:creator>
		<pubDate>Mon, 25 May 2020 13:21:10 +0000</pubDate>
				<category><![CDATA[技艺分享]]></category>
		<category><![CDATA[編程三兩事]]></category>
		<category><![CDATA[FreeNAS]]></category>
		<category><![CDATA[Realtek]]></category>
		<category><![CDATA[RTL8168H]]></category>
		<category><![CDATA[驱动]]></category>
		<guid isPermaLink="false">https://www.luisimon.xyz/?p=325</guid>

					<description><![CDATA[前言 在最近一段时间我自己购买了一些硬件组装了一个mini主机用作FreeNAS文件服务器，并且组RAID1。 ... <a title="FreeNAS Realtek RTL8168H 驱动程序编译与安装（教程）" class="read-more" href="https://www.luisimon.com/2020/05/25/325/" aria-label="继续阅读FreeNAS Realtek RTL8168H 驱动程序编译与安装（教程）">阅读更多</a>]]></description>
										<content:encoded><![CDATA[
<p class="has-text-color has-large-font-size has-vivid-cyan-blue-color"><strong>前言</strong></p>



<p>在最近一段时间我自己购买了一些硬件组装了一个mini主机用作FreeNAS文件服务器，并且组RAID1。</p>



<p><strong>主要硬件如下：</strong></p>



<ul class="wp-block-list"><li>Intel(R) Celeron(R) G4900T CPU @ 2.90GHz </li><li>ADATA 8GB DDR4</li><li>LITEON  128GB（原笔记本换下来）</li><li>TOSHIBA 2TB 64MB 7200RPM  ×2</li><li><strong>TP-LINK TG-3269E  Gigabit PCIe</strong></li><li>Cooler Master CPU Fan</li><li>Onda  B365CD4 </li><li>BUBALUS  250W</li><li>山寨 Node6 机箱</li></ul>



<p>由于过于大意，主板选购时候没有检查网卡最大传输速率，结果是装完机发现是100M自适应板载网卡， 是的，之前还错买了DDR3插槽的主板，但是这次拆了包装不能退货 。众所周知1Gigabit才是NAS的灵魂所在。在购买这张PCIe网卡之前我也尝试了USB千兆网卡，但是其速度和稳定性令人堪忧，所以退货选购了<strong>TP-LINK TG-3269E</strong>这张卡，但是当我装上之后发现FreeNAS并不能识别出这张网卡，有点心凉，于是乎我几番搜索终于找到我官方驱动以及安装驱动的一些方法。</p>



<p class="has-text-color has-large-font-size has-vivid-cyan-blue-color"><strong>正文</strong></p>



<p><a href="https://www.luisimon.com/goto/z08r" rel="nofollow">Realtek官方驱动源码</a></p>



<p><a href="https://www.luisimon.com/goto/2624" rel="nofollow">驱动文件if_re.ko</a> 提取码: s4uu</p>



<p class="has-medium-font-size"><strong>直接使用</strong></p>



<p>几番周折，发现FreeNAS不具备编译驱动程序的环境，最后我选择FreeBSD原版ISO镜像在虚拟机上安装，虽然有文章说可以通过git从github拉取源码到<strong>/usr/src/</strong>目录下在进行编译，但是依旧缺失一些基本的编译工具，所以我最后还是在FreeBSD原版镜像安装的系统中编译驱动程序源码。</p>



<p>我的虚拟机环境</p>



<ul class="wp-block-list"><li>CPU：Intel i5 7th Gen </li><li>网卡：千兆Intel有线网卡</li></ul>



<p>如上，在正文的开头我已经提供了在以上环境中编译好的驱动程序模块文件，可以尝试在你的FreeNAS中加载此驱动程序，看是否可用，请注意程序的位元数（i386=32bit &amp; amd64=64bit）。官方介绍 <strong>TP-LINK TG-3269E</strong> 是支持WOL功能的，但我未能通过此网卡实现，同时板载是可以使用WOL，不清楚什么原因导致，有清楚的同学可以在评论区留言，感谢了！</p>



<p class="has-medium-font-size"><strong>编译</strong></p>



<p>通过FreeBSD官方ISO文件安装完系统后，解压驱动程序源码包，通过FTP工具传到FreeBSD系统中。</p>



<p>官方驱动程序源码包含以下文件</p>



<ul class="wp-block-list"><li>if_re.c</li><li>if_rereg.h</li><li>Makefile</li><li><strong>Readme.txt</strong></li></ul>



<p>其中 <strong>Readme.txt</strong> 是官方编译教程</p>



<pre class="wp-block-code"><code># 保存系统原有设备代码
cd /usr/src/sys/dev/re
cp if_re.c if_re.c.org
cd /usr/src/sys/modules
cp Makefile Makefile.org
cd /usr/src/sys/modules/re
cp Makefile Makefile.org
cd /usr/src/sys/i386/conf/ #这里再次强调，i386表示32位系统，如果你的系统是64位，请改为amd64
cp GENERIC GENERIC.org
#编译系统内核
vi /usr/src/sys/i386/conf/GENERIC #删除 “re” 所在的行，同上，i386是指32位元
vi /usr/src/sys/modules/Makefile #删除 “re” 所在的行
cd /usr/src/sys/i386/conf  #同上 i386指32位元
/usr/sbin/config GENERIC
cd ../compile/GENERIC
make cleandepend &amp;&amp; make depend
make &amp;&amp; make install &amp;&amp; reboot #这句开头的make会执行很久，具体取决于电脑性能，在虚拟机器中大概30分钟
#把驱动程序源码更新到系统源码中
cd /root/rtl_bsd_drv_v195.00 #注意，请转到你驱动程序源码的目录下
cp if_re.c if_rereg.h /usr/src/sys/dev/re
cp if_rereg.h /usr/src/sys/dev/re
cp Makefile /usr/src/sys/modules/re
#build网卡驱动程序
cd /usr/src/sys/modules/re
make clean &amp;&amp; make
#测试和部署驱动程序
kldload ./if_re.ko #把if_re.ko传输FreeNAS中，然后使用kldload加载驱动程序模块，在到FreeNAS的“网络”→“接口”中查看
cp if_re.ko /boot/kernel #复制驱动程序模块文件到内核文件夹中
vi /boot/loader.conf.local #在此文件中首行加入一下内容
if_re_load="YES" # tp-link 1000M #此行不是命令,需要加入文件中
#其中在FreeNAS的“系统”→“微调”中添加，变量=if_re_load,值=YES，类型=loader，描述=tp-link 1000M</code></pre>



<p>到此你可以尝试重启你的FreeNAS，查看是否能开机加载PCIe网卡，并在后面配置好你的网络</p>



<p class="has-text-color has-vivid-red-color">写在最后：吐槽一下，通过此事发现，现在太缺互联网分享精神了。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
