暂时禁用 IPv6

暂时禁用 IPv6

我用了这些方向为我的 Raspberry Pi 4 设置专用互联网访问 (PIA) VPN。我正在运行 Raspbian,并将 Pi 作为连接到电视的迷你台式计算机使用。我想要一个 VPN 连接以避免共享我的 IP。不幸的是,我的 IPv6 仍在广播。所以我用了这些说明禁用 IPv6。

不幸的是,运行时sudo openvpn ca_vancouver.ovpn,我仍然收到以下错误:

Tue Jun  1 07:49:22 2021 WARNING: file 'auth.txt' is group or others accessible
Tue Jun  1 07:49:22 2021 OpenVPN 2.4.7 arm-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019
Tue Jun  1 07:49:22 2021 library versions: OpenSSL 1.1.1d  10 Sep 2019, LZO 2.10
Tue Jun  1 07:49:22 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]208.78.42.222:1198
Tue Jun  1 07:49:22 2021 UDP link local: (not bound)
Tue Jun  1 07:49:22 2021 UDP link remote: [AF_INET]208.78.42.222:1198
Tue Jun  1 07:49:22 2021 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Tue Jun  1 07:49:22 2021 [vancouver412] Peer Connection Initiated with [AF_INET]208.78.42.222:1198
Tue Jun  1 07:49:23 2021 OpenVPN ROUTE6: OpenVPN needs a gateway parameter for a --route-ipv6 option and no default was specified by either --route-ipv6-gateway or --ifconfig-ipv6 options
Tue Jun  1 07:49:23 2021 OpenVPN ROUTE: failed to parse/resolve route for host/network: 2000::/3
Tue Jun  1 07:49:23 2021 TUN/TAP device tun0 opened
Tue Jun  1 07:49:23 2021 /sbin/ip link set dev tun0 up mtu 1500
Tue Jun  1 07:49:23 2021 /sbin/ip addr add dev tun0 10.32.112.52/24 broadcast 10.32.112.255
Tue Jun  1 07:49:23 2021 WARNING: OpenVPN was configured to add an IPv6 route over tun0. However, no IPv6 has been configured for this interface, therefore the route installation may fail or may not work as expected.
Tue Jun  1 07:49:23 2021 Initialization Sequence Completed

更重要的是,当尝试浏览 Chromium 中的任何网站时,我收到以下错误(在本例中我正在尝试www.privateinternetaccess.com):

This site cant be reached www.privateinternetaccess.com. Server IP address could not be found.
Error: DNS_PROBE_FINISHED_BAD_CONFIG

有什么建议或支持可以帮助解决此问题,同时阻止我的 IPv6?

答案1

如果您的 Ipv6 实际上并未被禁用,请尝试以下步骤:

暂时禁用 IPv6

查看带有 PIA 的 OpenVPN 是否按预期连接:

sysctl -w net.ipv6.conf.all.disable_ipv6=1

然后连接到 PIA。
如果有效的话:


永久禁用 IPv6。

步骤1:

将其添加到您的内核行中/boot/cmdline.txt完全禁用 IPv6:

ipv6.disable=1

注意:*这需要重新启动


第2步:

要禁用 ipv6,您必须使用任何文本编辑器打开 /etc/sysctl.conf 并在末尾插入以下行:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

并重新启动。如果 IPv6 仍未禁用,则问题在于 sysctl.conf 仍未激活。要解决此问题,请键入命令:

sudo sysctl -p

您将在终端中看到:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

之后,如果您运行:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

取自本指南

相关内容