Gentoo Archives: gentoo-user

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