NECの安鯖を購入したらIntel NICでした。なんとなくUbuntu 12.04LTS Server AMD64を入れました。ふと気になって、NICのドライバーを新しくしてみました。
注意!:
aptitude update
aptitude upgrade
して、rebootしてから↓の作業をしたほうが良さそうです。一度、Linux Kernelが古いまま、ドライバをコンパルしてしまいました。ともかくも、aptitude update upgradeしてからrebootしてから↓の作業を始めましょう。
まずそもそものドライバの確認。dmesgして、ethXXXをgrepすればいいでしょう。(ethXXXが分からなければ、ifconfigしてみると分かるかと。。。)
root@localhost $ dmesg | grep eth0
[ 1.401981] e1000e 0000:00:19.0: eth0: (PCI Express:2.5GT/s:Width x1) d4:3d:7e:0b:26:a6
[ 1.401988] e1000e 0000:00:19.0: eth0: Intel(R) PRO/1000 Network Connection
[ 1.402037] e1000e 0000:00:19.0: eth0: MAC: 10, PHY: 11, PBA No: FFFFFF-0FF
[ 3.663744] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 6.542909] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 10.578272] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
[ 10.579289] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
↑より、どうやらe1000eというのが搭載NICのLinuxでの名前のようです。
また、lspciしてみると、いろいろと分かります。
root@localhost:$ lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation Panther Point KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
中略
↑Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection と書いてありますので、このNICの型番は82579LMと分かりました。
この82579LMは、
インテル公式によると、”Intel® 82579 Gigabit Ethernet Controller” の一つのようです。
さて次に、バージョンを調べます。「modinfo e1000e」で出てきます↓。
root@localhost:$ modinfo e1000e
filename: /lib/modules/3.2.0-29-generic/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko
version: 1.5.1-k
license: GPL
description: Intel(R) PRO/1000 Network Driver
中略
↑どうやら、今入っているバージョンは1.5.1-kのようですね。
さて、ドライバを探しましょう。ここからはブラウザでの作業です。MacでもWindowsでもLinuxでも構いませんがとにかくブラウザでの作業が必要です。terminalではかなり厳しいかと。。。
intelのダウンロードセンターから、落とすことができます。
(直接的なページは
ここです)

こんな感じ↑で3つ選択して、「検索」をクリック。

↑オペレーティングシステムの選択にて、Linuxを選択。

↑すると、下の方にリンクが出るのでそれをクリック。

↑○を付けた、「ダウンロード」をクリック。次に画面で、「使用許諾契約の条項に同意します」を押すとダウンロードされる。
さて、やっとドライバを落とすことが出来ました。scpでコピーしてもいいのですが、落としてきたリンク先を調べることは容易(このドライバは、http://downloadmirror.intel.com/15817/eng/e1000e-2.1.4.tar.gz)ですので、今度はubuntuに戻って、作業します。
ちなみに、以下はインテル公式の、
http://downloadmirror.intel.com/15817/eng/README.txtに書いてあること+α程度ですので、よく分からなければ公式の方も参照してみてください。
まずは必須ソフトのインストールをします。make, gccです。
aptitude install make gcc
次に、適当なディレクトリを作って、↑で探したドライバを落としてきます。
root: $ mkdir my_repos
root: $ cd my_repos/
root: $ wget http://downloadmirror.intel.com/15817/eng/e1000e-2.1.4.tar.gz
--2013-01-17 13:40:18-- http://downloadmirror.intel.com/15817/eng/e1000e-2.1.4.tar.gz
Resolving downloadmirror.intel.com (downloadmirror.intel.com)... 72.246.190.74, 72.246.190.66
Connecting to downloadmirror.intel.com (downloadmirror.intel.com)|72.246.190.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 259786 (254K) [application/x-gzip]
Saving to: `e1000e-2.1.4.tar.gz'
100%[==========================================================================================>] 259,786 --.-K/s in 0.1s
2013-01-17 13:40:19 (1.84 MB/s) - `e1000e-2.1.4.tar.gz' saved [259786/259786]
root:~/my_repos$ ls
e1000e-2.1.4.tar.gz
root:~/my_repos$ tar zxf e1000e-2.1.4.tar.gz
root:~/my_repos$ cd e1000e-2.1.4
root:~/my_repos/e1000e-2.1.4$ cd src/
これで一段落、あとは make install するだけとおもいきや↓
root:~/my_repos/e1000e-2.1.4/src$ make install
Makefile:71: *** Kernel header files not in any of the expected locations.
Makefile:72: *** Install the appropriate kernel development package, e.g.
Makefile:73: *** kernel-devel, for building kernel modules and try again. Stop.
↑このように怒られてしまいました。Kernel headerが必要な様子。
まずは、uname -aしてLinuxのカーネルのバージョンを調べましょう。
root:~/my_repos/e1000e-2.1.4/src$ uname -a
Linux pikachu 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
↑となりますので、どうやら “3.2.0-29-generic”のようです。
↓該当のheaderをインストールしましょう。
root:~/my_repos/e1000e-2.1.4/src$ aptitude install linux-headers-3.2.0-29-generic
The following NEW packages will be installed:
linux-headers-3.2.0-29{a} linux-headers-3.2.0-29-generic
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.7 MB of archives. After unpacking 67.5 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main linux-headers-3.2.0-29 all 3.2.0-29.46 [11.7 MB]
Get: 2 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main linux-headers-3.2.0-29-generic amd64 3.2.0-29.46 [991 kB]
Fetched 12.7 MB in 7s (1,704 kB/s)
Selecting previously unselected package linux-headers-3.2.0-29.
(Reading database ... 53023 files and directories currently installed.)
Unpacking linux-headers-3.2.0-29 (from .../linux-headers-3.2.0-29_3.2.0-29.46_all.deb) ...
Selecting previously unselected package linux-headers-3.2.0-29-generic.
Unpacking linux-headers-3.2.0-29-generic (from .../linux-headers-3.2.0-29-generic_3.2.0-29.46_amd64.deb) ...
Setting up linux-headers-3.2.0-29 (3.2.0-29.46) ...
Setting up linux-headers-3.2.0-29-generic (3.2.0-29.46) ...
↑インストール出来ました。これでやっとmake install出来ます。
make installします↓
root:~/my_repos/e1000e-2.1.4/src$ make install
make -C /lib/modules/3.2.0-29-generic/build SUBDIRS=/root/my_repos/e1000e-2.1.4/src modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-29-generic'
CC [M] /root/my_repos/e1000e-2.1.4/src/netdev.o
CC [M] /root/my_repos/e1000e-2.1.4/src/ethtool.o
CC [M] /root/my_repos/e1000e-2.1.4/src/param.o
CC [M] /root/my_repos/e1000e-2.1.4/src/82571.o
CC [M] /root/my_repos/e1000e-2.1.4/src/ich8lan.o
CC [M] /root/my_repos/e1000e-2.1.4/src/80003es2lan.o
CC [M] /root/my_repos/e1000e-2.1.4/src/mac.o
CC [M] /root/my_repos/e1000e-2.1.4/src/nvm.o
CC [M] /root/my_repos/e1000e-2.1.4/src/phy.o
CC [M] /root/my_repos/e1000e-2.1.4/src/manage.o
CC [M] /root/my_repos/e1000e-2.1.4/src/kcompat.o
LD [M] /root/my_repos/e1000e-2.1.4/src/e1000e.o
Building modules, stage 2.
MODPOST 1 modules
CC /root/my_repos/e1000e-2.1.4/src/e1000e.mod.o
LD [M] /root/my_repos/e1000e-2.1.4/src/e1000e.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-29-generic'
gzip -c ../e1000e.7 > e1000e.7.gz
# remove all old versions of the driver
find /lib/modules/3.2.0-29-generic -name e1000e.ko -exec rm -f {} \; || true
find /lib/modules/3.2.0-29-generic -name e1000e.ko.gz -exec rm -f {} \; || true
install -D -m 644 e1000e.ko /lib/modules/3.2.0-29-generic/kernel/drivers/net/e1000e/e1000e.ko
/sbin/depmod -a || true
install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
man -c -P'cat > /dev/null' e1000e || true
e1000e.
↑どうやら出来たようです。
次に、このドライバを反映させます。modprobeというコマンドを使うようです。
root:~/my_repos/e1000e-2.1.4/src$ modprobe e1000e
きちんと反映されているか確認のために、再度”modinfo e1000e”をしてみます。
root:$ modinfo e1000e
filename: /lib/modules/3.2.0-29-generic/kernel/drivers/net/e1000e/e1000e.ko
version: 2.1.4-NAPI
license: GPL
description: Intel(R) PRO/1000 Network Driver
↑新しくなっていますね!
いちおうネットワークを再起動したほうが良いと思います↓。
root:$ /etc/init.d/networking restart
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces... ssh stop/waiting
ssh start/running, process 4384
以上です!
(おまけ)
なんとなく性能比較を↓。pingで比較にはならないですね。。。おんなじようなものです。iperfとかやってみてもいいのですがどうせ同じでしょうし。
# バージョン更新前↓
root:$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.014 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.013 ms
64 bytes from 127.0.0.1: icmp_req=4 ttl=64 time=0.015 ms
64 bytes from 127.0.0.1: icmp_req=5 ttl=64 time=0.015 ms
^C
--- 127.0.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3997ms
rtt min/avg/max/mdev = 0.013/0.016/0.025/0.005 ms
# バージョン更新後↓
root:$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.024 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.015 ms
64 bytes from localhost (127.0.0.1): icmp_req=3 ttl=64 time=0.013 ms
64 bytes from localhost (127.0.0.1): icmp_req=4 ttl=64 time=0.018 ms
64 bytes from localhost (127.0.0.1): icmp_req=5 ttl=64 time=0.016 ms
^C
--- localhost ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3997ms
rtt min/avg/max/mdev = 0.013/0.017/0.024/0.004 ms