Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 49759  / 2 Years ago, mon, december 27, 2021, 6:30:39

I'm slightly weirded out by the fact that Ubuntu won't process ipv4 DHCP unless you explicitly tell it to, but will happily take ipv6 RAs unless you tell it not to. Is there any way to change the default behaviour to be 'do nothing unless I explicitly turn it on'?



(Note to answerers: I'm not looking to globally disable ipv6, or completely turn off autoconf. I'm looking to disable autoconf by default (as in, I don't want ipv6 unless I say so in /etc/network/interfaces, in the same way that I don't just get a v4 address unless I've explicitly turned on dhcp). What's happening is that, for any interface that's up - e.g. has an ipv4 config - a v6 address tends to just turn up on the interface as well, despite the fact that I've not enabled that explicitly. The solutions to date are fine as far as they go, but if I disable v6 or autoconf globally, I can't then re-enable v6 on a per-interface basis with a simple command in /etc/network/interfaces. I'm fairly sure I'm asking for the moon on a stick, mind you.)


More From » networking

 Answers
2

Similar to, but different from, one of the other answers, I tried this with a great deal of joy:



Add a sysctl file in /etc/sysctl.d to disable ipv6 - not universally, though, just as an interface default state:



net.ipv6.conf.default.disable_ipv6=1


Then, in the interfaces file and for only the interfaces you wish to have ipv6 on, add:



iface eth0 inet dhcp # .. or whatever
up sysctl -w net.ipv6.conf.$IFACE.disable_ipv6=0


... thus, interfaces don't get IPv6 addresses when they come up (as currently) but can be persuaded to have them in specific cases. You could no doubt disable RAs before enabling ipv6 if that's what you wanted, too.



NB: I suspect you'll run into issues with VLAN named interfaces (e.g. eth0.100) and will have to spell that out in the 'up' command as 'eth0/100' rather than $IFACE, which will have the wrong format - I haven't tested, but that seems to be how sysctl views the world.


[#30442] Tuesday, December 28, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
errettas

Total Points: 160
Total Questions: 118
Total Answers: 91

Location: Laos
Member since Fri, Sep 11, 2020
4 Years ago
;