不禁用 Internet 调试的 OpenVPN 连接

不禁用 Internet 调试的 OpenVPN 连接

我最近在我的服务器(CentOS 7)上配置了 OpenVPN,并且已经配置了几个小时,一切似乎都工作正常,除了当我使用客户端计算机连接时我无法访问互联网。

我知道这个网站上有解决方案,我已经阅读了其中的许多解决方案,但没有成功,尽管我已经尝试了他们建议的答案,主要是以下 server.conf 设置。

push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
user nobody
group nobody

我还添加了以下 iptables 规则(我使用 iptables 而不是 firewalld)

# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
# iptables -A INPUT -I eth0 -m state --state NEW -p udp --dport 1195 -j

以及编辑 sysctl.conf 以具有

# net.ipv4.ip_forward = 1

当我在 CentOS 5 上设置 OpenVPN 时,它工作得很好,我没有遇到这个问题,尽管在 CentOS 7 中这似乎让我担心

笔记

我忘了提到这个 OpenVPN 的安装是在端口 1195 上运行的,启用端口 1195 不是一个拼写错误

# iptables -L | grep policy

Chain INPUT (policy ACCEPT)
Chain FORWARD (policy ACCEPT)
Chain OUTPUT (policy ACCEPT)

Windows 客户端 ifconfig

Ethernet adapter Ethernet 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 5:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : Home
   Link-local IPv6 Address . . . . . : fe80::9175:325f:2c9f:3c45%8
   IPv4 Address. . . . . . . . . . . : 192.168.20.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.20.1

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::ecfb:cd4d:f388:1765%3
   IPv4 Address. . . . . . . . . . . : 10.8.0.6
   Subnet Mask . . . . . . . . . . . : 255.255.255.252
   Default Gateway . . . . . . . . . :

Tunnel adapter isatap.Home:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : Home

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Tunnel adapter isatap.{6A60203F-046E-42E7-A865-37847D3036CA}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

相关内容