Linux ipv6模块加载失败解决方案

同事一个SUSE Linux Enterprise Server 11 SP3环境配置ipv6地址失败,提示不支持IPv6,请求帮助,第一反应是应该ipv6相关内核模块没有加载。

主要检查内容:

ipv6地址是否存在

 ifconfig |grep inet6

没有默认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

系统是否加载IPv6相关模块

lsmod |grep ipv6
   # lsmod |grep ipv6
   ipv6_lib              341467  0

只有ipv6_lib模块,没有主模块ipv6

从上面信息得知,ipv6模块是存在的,只是加载出现了问题,由此想到可能是配置导致的。

首先检查模块的依赖关系是否正确:

# 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

没有问题

其次检查modprobe配置,是否屏蔽了ipv6模块加载:

# cat /etc/modprobe.conf |grep -i ipv6
   alias sit0 ipv6

最后检查了/etc/modprobe.d/目录下文件

发现一个50-ipv6.conf文件,内容如下:

# cat /etc/modprobe.d/50-ipv6.conf
   install ipv6 /bin/true

这句话是什么含义呢?通过modprobe.conf(5)文档,有如下内容:

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"

比较长,关键的第一句我们来解释一下: This is the most powerful primitive: it tells modprobe to run your command instead of inserting the module in the kernel as normal. 这句话的意思是它让modprobe命令执行命令行里的command命令,而不是一般情况下去加载指定的内核模块。

该怎么理解这句话呢?我们通过两个命令的执行来说明:

# 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: 打印有关程序所做事情的信息 所以上述输出表明modprobe只做了加载ipv6_lib.ko模块和install /bin/true的动作, 而没有做加载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 只列出模块依赖关系,以insmod开头; install命令也不做实际的加载操作,只列出要做的加载动作 从以上信息可以看出,也不会做ipv6.ko模块加载。

去掉/bin/true之后,重新执行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

综上,可以认为是50-ipv6.conf文件的配置导致了ipv6加载不完整。

文章来源网络,作者:管理,如若转载,请注明出处:https://shuyeidc.com/wp/214422.html<

(0)
管理的头像管理
上一篇2025-04-11 19:03
下一篇 2025-04-11 19:04

相关推荐

  • 云服务器和云虚拟主机怎么选?云服务器和虚拟主机区别

    云服务器适合业务增长快、需弹性扩展的场景,而云虚拟主机适合预算有限、技术门槛低的小型静态网站或测试环境,二者核心区别在于资源独享性与运维复杂度,核心差异解析:从底层架构到使用体验很多人容易混淆这两者,觉得它们都是“买空间建站”,它们的底层逻辑完全不同,云服务器(ECS)就像是你租了一整栋别墅,水电网络独立,你想……

    2026-06-29
    0
  • 赣州智慧旅游招聘是真的吗?赣州旅游人才招聘信息

    中级岗位(3-5年经验)月薪范围通常在6000-10000元,这类岗位需要独立负责项目模块,如独立运营一个抖音账号,或维护一个景区小程序的功能迭代,具备成功案例的候选人议价能力较强,高级岗位(5年以上经验)月薪范围通常在10000-20000元,部分核心管理岗可达更高,这类人才需要具备战略规划能力,如制定整个景……

    2026-06-29
    0
  • 赣州智能物联网车位锁如何管理?智能车位锁管理系统多少钱

    赣州智能物联网车位锁管理的核心在于通过云端平台实现远程控锁、状态实时监控及自动计费,彻底解决传统车位“被占难管”与“找位难”的痛点,在赣州这样的城市,随着机动车保有量的持续增长,老旧小区、商业综合体以及私人固定车位的资源矛盾日益凸显,传统的机械地锁或简易遥控锁,不仅操作繁琐,更无法实现数据化管理,引入智能物联网……

    2026-06-29
    0
  • 赣州智能消防栓好用吗,智能消防栓多少钱一个

    赣州智能消防栓通过物联网技术实现实时监测与远程报警,能显著降低火灾响应时间并提升城市消防安全管理水平,是目前智慧城市建设中不可或缺的基础设施,赣州智能消防栓的核心价值与应用场景传统消防栓往往存在“看不见、摸不着、用不了”的痛点,在赣州这样地形复杂、老城区与新城区并存的区域,传统设施的管理难度极大,智能消防栓的出……

    2026-06-29
    0
  • 云服务器和物理机到底有啥区别?

    云服务器本质上是虚拟化资源池中的弹性实例,而传统物理服务器是独占的硬件实体,前者胜在弹性与运维便捷,后者强在物理隔离与性能稳定,具体选择取决于业务对成本、扩展性及安全合规的权衡,很多人初次接触服务器时,容易把“云服务器”和“传统物理服务器”混为一谈,觉得它们都是用来跑网站或存数据的盒子,这两者的底层逻辑完全不同……

    2026-06-29
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注