Ubuntu 20.10 无法通过 sysctl 禁用 IPv6

Ubuntu 20.10 无法通过 sysctl 禁用 IPv6

标题说明了一切。我已经反复思考了几个小时,但毫无结果。

root@blueberry:~# cat /etc/sysctl.d/no-ipv6-please.conf
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.wlan0.disable_ipv6 = 1
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.lo.autoconf = 0
net.ipv6.conf.wlan0.autoconf = 0
root@blueberry:~# for z in `awk  '{ print $1 }' /etc/sysctl.d/no-ipv6-please.conf`; do sysctl $z; done
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.wlan0.disable_ipv6 = 0
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.lo.autoconf = 0
net.ipv6.conf.wlan0.autoconf = 0
root@blueberry:~#

Ubuntu 版本:

root@blueberry:~# uname -a
Linux blueberry 5.8.0-1006-raspi #9-Ubuntu SMP PREEMPT Fri Oct 16 12:55:30 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
root@blueberry:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.10 (Groovy Gorilla)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.10"
VERSION_ID="20.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy
root@blueberry:~#

无线上网:

root@blueberry:~# ip addr sh wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether <mac address> brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.67/24 brd 192.168.178.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 <address>/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 6969sec preferred_lft 3369sec
    inet6 <address>/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 5702sec preferred_lft 2102sec
    inet6 <address>/64 scope link
       valid_lft forever preferred_lft forever
root@blueberry:~#

如果有帮助的话,该机器是 Raspberry Pi。

现在,在有人评论禁用 IPv6 是“一个糟糕的主意”之前,我需要删除所有未使用的内容并进行一些强化。禁用 IPv6 曾经是一项微不足道的任务,sysctl 是否不再具有控制权?

提前谢谢了。

答案1

link-local: [ipv4]我遇到了同样的问题,并通过在文件中正确的接口块内放置以下行解决了该问题/etc/netplan/50-cloud-init.yaml。然后:“netplan reload”或完全重启。我不知道这是否是在 Ubuntu 20.10 中操作网络设置的正确、受支持和“神圣”的方式,但这似乎是正确的方式。

相关内容