暫時禁用 IPv6

暫時禁用 IPv6

我用了這些方向為我的 Raspberry Pi 4 設定專用網路存取 (PIA) VPN。我想要一個 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

取自本指南

相關內容