新聞中心
同事一個(gè)SUSE Linux Enterprise Server 11 SP3環(huán)境配置ipv6地址失敗,提示不支持IPv6,請(qǐng)求幫助,第一反應(yīng)是應(yīng)該ipv6相關(guān)內(nèi)核模塊沒(méi)有加載。

主要檢查內(nèi)容:
ipv6地址是否存在
ifconfig |grep inet6
沒(méi)有默認(rèn)inet6地址
ipv6模塊是否存在
# modinfo -n ipv6
/lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6.ko
# modinfo -n ipv6_lib
/lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6_lib.ko
系統(tǒng)是否加載IPv6相關(guān)模塊
lsmod |grep ipv6
# lsmod |grep ipv6
ipv6_lib 341467 0
只有ipv6_lib模塊,沒(méi)有主模塊ipv6
從上面信息得知,ipv6模塊是存在的,只是加載出現(xiàn)了問(wèn)題,由此想到可能是配置導(dǎo)致的。
首先檢查模塊的依賴關(guān)系是否正確:
# cat /lib/modules/`uname -r`/modules.dep |grep -w ipv6.ko:
/lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6.ko: /lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6_lib.ko
沒(méi)有問(wèn)題
其次檢查modprobe配置,是否屏蔽了ipv6模塊加載:
# cat /etc/modprobe.conf |grep -i ipv6
alias sit0 ipv6
最后檢查了/etc/modprobe.d/目錄下文件
發(fā)現(xiàn)一個(gè)50-ipv6.conf文件,內(nèi)容如下:
# cat /etc/modprobe.d/50-ipv6.conf
install ipv6 /bin/true
這句話是什么含義呢?通過(guò)modprobe.conf(5)文檔,有如下內(nèi)容:
install modulename command...
This is the most powerful primitive: it tells modprobe to run your command instead of inserting the module in the kernel as normal.
The command can be any shell command: this allows you to do any kind of complex processing you might wish.
For example, if the module "fred" works better with the module "barney" already installed (but it doesn't depend on it, so modprobe won't automatically load it), you could say "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred", which would do what you wanted.
Note the --ignore-install, which stops the second modprobe from running the same install command again. See also remove below.
You can also use install to make up modules which don't otherwise exist. For example: "install probe-ethernet /sbin/modprobe e100 || /sbin/modprobe eepro100", which will first try to load the e100 driver, and if it fails, then the eepro100 driver when you do "modprobe probe-ethernet". If you use the string "$CMDLINE_OPTS" in the command, it will be replaced by any options specified on the modprobe command line. This can be useful because users expect "modprobe fred opt=1" to pass the "opt=1" arg to the module, even if there's an install command in the configuration file. So our above example becomes "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred $CMDLINE_OPTS"
比較長(zhǎng),關(guān)鍵的第一句我們來(lái)解釋一下: This is the most powerful primitive: it tells modprobe to run your command instead of inserting the module in the kernel as normal. 這句話的意思是它讓modprobe命令執(zhí)行命令行里的command命令,而不是一般情況下去加載指定的內(nèi)核模塊。
該怎么理解這句話呢?我們通過(guò)兩個(gè)命令的執(zhí)行來(lái)說(shuō)明:
# modprobe -v -n ipv6
insmod /lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6_lib.ko
install /bin/true
-n –dry-run –show 表明不做真正的插入模塊的操作 -v: 打印有關(guān)程序所做事情的信息 所以上述輸出表明modprobe只做了加載ipv6_lib.ko模塊和install /bin/true的動(dòng)作, 而沒(méi)有做加載ipv6.ko模塊
# modprobe --show-depends ipv6
insmod /lib/modules/3.0.101-0.47.90-default/kernel/net/ipv6/ipv6_lib.ko
install /bin/true
–show-depends 只列出模塊依賴關(guān)系,以insmod開(kāi)頭; install命令也不做實(shí)際的加載操作,只列出要做的加載動(dòng)作 從以上信息可以看出,也不會(huì)做ipv6.ko模塊加載。
去掉/bin/true之后,重新執(zhí)行modprobe ipv6命令后檢查模塊加載情況:
# modprobe -v ipv6
# lsmod |grep ipv6
ipv6 12758 1
ipv6_lib 341467 71 ipv6
# ifconfig |grep inet6
inet6 addr: fe80::9af5:37ff:fe00:9527/64 Scope:Link
inet6 addr: fe80::9af5:37ff:fee3:3ac4/64 Scope:Link
inet6 addr: ::1/128 Scope:Host
綜上,可以認(rèn)為是50-ipv6.conf文件的配置導(dǎo)致了ipv6加載不完整。
網(wǎng)站名稱:Linux下解決IPV6模塊加載失敗方法
文章位置:http://www.dlmjj.cn/article/djochss.html


咨詢
建站咨詢
