Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: Zesen Qian <gentoo-user@×××××.com>
Cc: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Disable IPv6 on specific interface
Date: Tue, 30 Dec 2014 10:31:58
Message-Id: 201412301031.42590.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] Disable IPv6 on specific interface by Zesen Qian
1 On Tuesday 30 Dec 2014 10:10:04 Zesen Qian wrote:
2 > Mick <michaelkintzios@×××××.com> writes:
3 > > On Tuesday 30 Dec 2014 03:27:34 Zesen Qian wrote:
4 > >> Hello list,
5 > >> Sorry for hijacking Rich's thread, resend here.
6 > >> I want to disable IPv6 on an certain interface, a simple google
7 > >> tell me to add one line to /etc/sysctl.d/local.conf
8 > >> net.ipv6.conf.enp4s0.disable_ipv6=1
9 > >> Simple enough, but the problem I have is that both ipv6 and the
10 > >> dirver of the network card(tg3) is loaded by modules. They 're not
11 > >> loaded when the service sysctl is started, so there's no entry
12 > >> named "net.ipv6.conf.enp4s0", which make sysctl not working.
13 > >> So my question is that, is there any way to disable IPv6 on
14 > >> specific interface, as early as I can? I want to make it early
15 > >> because I don't want to receive any RA to mess up my route table.
16 > >> I guess just adding sysctl to preup() in /etc/conf.d/net should do
17 > >> the trick, but may I make it earlier?
18 > >> Any comment is appreciated.
19 > >
20 > > Unless the kernel knows of the enp4s0 interface and therefore lists it
21 > > under sysctl, I can't see how it can be disabled. You could try
22 > > disabling IPv6 altogether in the kernel, but this may not be what you
23 > > want to achieve.
24 > >
25 > > Alternatively, have a look with modinfo in the module options in the
26 > > unlikely chance that the module has some option which disables IPv6
27 > > functionality.
28 >
29 > Hello Mick,
30 > The module ipv6 has only three parameters, each of which is "disable
31 > ipv6", "disable ipv6 on all interfaces", "disable autoconf on all
32 > interfaces", none of these is what I want to achieve.
33
34 Right, I didn't think that you would want to disable IPv6 completely, but
35 mentioned it for completeness.
36
37
38 > Module tg3 has
39 > only on parameters which control the debug level.
40
41 Yes, I thought it unlikely that a hardware driver would be used to configure
42 IPv6, but it was worth checking.
43
44
45 > Currently I just call "sysctl net.ipv6.conf.enp4s0.disable_ipv6=1" in
46 > preup(), which works just fine. I 'm just wondering if there 's some
47 > more "proper" way to do it. Since in my opinion, this should be done at
48 > the first moment when the interface is present, not when the interface
49 > is up.
50
51 I'm afraid I don't know of any other way to do it.
52
53 --
54 Regards,
55 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature