cov...@ccs.covici.com writes: > Mick <michaelkintz...@gmail.com> wrote: > >> On Tuesday 30 Dec 2014 03:27:34 Zesen Qian wrote: >> > Hello list, >> > Sorry for hijacking Rich's thread, resend here. >> > I want to disable IPv6 on an certain interface, a simple google >> > tell me to add one line to /etc/sysctl.d/local.conf >> > net.ipv6.conf.enp4s0.disable_ipv6=1 >> > Simple enough, but the problem I have is that both ipv6 and the >> > dirver of the network card(tg3) is loaded by modules. They 're not >> > loaded when the service sysctl is started, so there's no entry >> > named "net.ipv6.conf.enp4s0", which make sysctl not working. >> > So my question is that, is there any way to disable IPv6 on >> > specific interface, as early as I can? I want to make it early >> > because I don't want to receive any RA to mess up my route table. >> > I guess just adding sysctl to preup() in /etc/conf.d/net should do >> > the trick, but may I make it earlier? >> > Any comment is appreciated. >> >> >> Unless the kernel knows of the enp4s0 interface and therefore lists it under >> sysctl, I can't see how it can be disabled. You could try disabling IPv6 >> altogether in the kernel, but this may not be what you want to achieve. >> >> Alternatively, have a look with modinfo in the module options in the >> unlikely >> chance that the module has some option which disables IPv6 functionality. > > You may be able to use the feature of modprobe that executes a command > when the module loads and that way disable the ipv6 interface. I have > not tried this myself.
Hello Covici, Yes, there's a rule named "install <modulename> [command..]" in modprobe, but aren't they only applied to modprobe itself? I mean, in my case the ipv6 and tg3 is loaded automatically(maybe by udev?), not by running "modprobe ipv6". is this kind of module loading also affected by modprobe rule(in /etc/modprobe.d/*.conf)? -- Zesen Qian (钱泽森)