长期潜水,第一次发帖。我几乎读完了这个网站上关于 open-vpn 的每篇帖子,但我无法修复这个问题。
我可以毫无问题地连接到 openvpn 服务器,并且可以 ping 内部地址和 8.8.8.8,但我无法访问互联网。我修改了服务器和客户端的配置文件、iptables,并确保我的网络配置正确。服务器是通过 road warrior 安装设置的。有谁知道为什么这不起作用吗?我提前感谢你的帮助。
服务器配置文件
port 51820
proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 192.168.1.1"
push "dhcp-option DNS 8.8.8.8"
keepalive 10 120
cipher AES-128-CBC
comp-lzo
客户端.ovpn
client
dev tun
proto udp
sndbuf 0
rcvbuf 0
remote [my_public_ip] 51820
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-128-CBC
comp-lzo
setenv opt block-outside-dns
key-direction 1
verb 3
<ca>
-----BEGIN CERTIFICATE-----
IP 表
sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i eno1 -p udp -m state --state NEW -m udp --dport 51820 -j ACCEPT
-A INPUT -i tun+ -j ACCEPT
-A FORWARD -i tun+ -j ACCEPT
-A FORWARD -i tun+ -o eno1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eno1 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o tun+ -j ACCEPT
接口:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eno1
iface eno1 inet static
address 192.168.1.213
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
系统配置参数
net.ipv4.ip_forward=1