Gentoo Archives: gentoo-user

From: Zesen Qian <gentoo-user@×××××.com>
To: covici@××××××××××.com
Cc: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Disable IPv6 on specific interface
Date: Tue, 30 Dec 2014 10:49:27
Message-Id: 87y4ppmmzj.fsf@Riaqn-ThinkPad.dorm.riaqn.com
In Reply to: Re: [gentoo-user] Disable IPv6 on specific interface by covici@ccs.covici.com
1 covici@××××××××××.com writes:
2
3 > Mick <michaelkintzios@×××××.com> wrote:
4 >
5 >> On Tuesday 30 Dec 2014 03:27:34 Zesen Qian wrote:
6 >> > Hello list,
7 >> > Sorry for hijacking Rich's thread, resend here.
8 >> > I want to disable IPv6 on an certain interface, a simple google
9 >> > tell me to add one line to /etc/sysctl.d/local.conf
10 >> > net.ipv6.conf.enp4s0.disable_ipv6=1
11 >> > Simple enough, but the problem I have is that both ipv6 and the
12 >> > dirver of the network card(tg3) is loaded by modules. They 're not
13 >> > loaded when the service sysctl is started, so there's no entry
14 >> > named "net.ipv6.conf.enp4s0", which make sysctl not working.
15 >> > So my question is that, is there any way to disable IPv6 on
16 >> > specific interface, as early as I can? I want to make it early
17 >> > because I don't want to receive any RA to mess up my route table.
18 >> > I guess just adding sysctl to preup() in /etc/conf.d/net should do
19 >> > the trick, but may I make it earlier?
20 >> > Any comment is appreciated.
21 >>
22 >>
23 >> Unless the kernel knows of the enp4s0 interface and therefore lists it under
24 >> sysctl, I can't see how it can be disabled. You could try disabling IPv6
25 >> altogether in the kernel, but this may not be what you want to achieve.
26 >>
27 >> Alternatively, have a look with modinfo in the module options in the unlikely
28 >> chance that the module has some option which disables IPv6 functionality.
29 >
30 > You may be able to use the feature of modprobe that executes a command
31 > when the module loads and that way disable the ipv6 interface. I have
32 > not tried this myself.
33
34 Hello Covici,
35 Yes, there's a rule named "install <modulename> [command..]" in
36 modprobe, but aren't they only applied to modprobe itself? I mean, in my
37 case the ipv6 and tg3 is loaded automatically(maybe by udev?), not by
38 running "modprobe ipv6". is this kind of module loading also affected by
39 modprobe rule(in /etc/modprobe.d/*.conf)?
40
41 --
42 Zesen Qian (钱泽森)

Replies

Subject Author
Re: [gentoo-user] Disable IPv6 on specific interface covici@××××××××××.com