客户端不通过 CentOS7 OpenVPN 路由

客户端不通过 CentOS7 OpenVPN 路由

我最近在 digitalocean 上设置了一个服务器,我设置了 vpn 服务器密钥等,我可以连接到我的客户端,问题是,如果我连接并在 google 上搜索我的公共 ip 地址,我得不到服务器的 ip 地址,但仍然可以得到我的客户端公共 ip。我正在使用 CentOS7 和 Firewalld。我不想使用 iptables,因为它已被弃用。我的防火墙服务已设置为将服务“openvpn”添加到永久列表中。如果我运行“firewall-cmd --query-masquerade”,我会得到“是”。

我的服务器配置如下(我已启用重定向网关):

 port 1194

 proto udp

 dev tun

 ca ca.crt
 cert SectorFiveVPN.crt
 key SectorFiveVPN.key  # This file should be kept secret

 dh dh2048.pem

 server 10.8.0.0 255.255.255.0

 ifconfig-pool-persist ipp.txt

 push "redirect-gateway def1 bypass-dhcp"

 push "dhcp-option DNS 8.8.8.8"
 push "dhcp-option DNS 8.8.4.4"

 keepalive 10 120

 comp-lzo

 user nobody
 group nobody

 persist-key
 persist-tun

 status openvpn-status.log

 verb 3

 mute 20

我的 ip 地址输出:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 04:01:33:68:37:01 brd ff:ff:ff:ff:ff:ff
inet 178.62.133.212/18 brd 178.62.191.255 scope global eth0
   valid_lft forever preferred_lft forever
inet6 fe80::601:33ff:fe68:3701/64 scope link 
   valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 100
link/none 
inet 10.8.0.1 peer 10.8.0.2/32 scope global tun0
   valid_lft forever preferred_lft forever

客户端连接日志:

 Fri Dec 05 13:41:52 2014 OpenVPN 2.3.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Dec  1 2014
 Fri Dec 05 13:41:52 2014 library versions: OpenSSL 1.0.1j 15 Oct 2014, LZO 2.08
 Fri Dec 05 13:41:52 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
 Fri Dec 05 13:41:52 2014 Need hold release from management interface, waiting...
 Fri Dec 05 13:41:53 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'state on'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'log all on'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'hold off'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'hold release'
 Fri Dec 05 13:41:53 2014 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
 Fri Dec 05 13:41:53 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,RESOLVE,,,
 Fri Dec 05 13:41:53 2014 UDPv4 link local: [undef]
 Fri Dec 05 13:41:53 2014 UDPv4 link remote: [AF_INET]178.62.133.212:1194
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,WAIT,,,
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,AUTH,,,
 Fri Dec 05 13:41:53 2014 TLS: Initial packet from [AF_INET]178.62.133.212:1194, sid=a36afa9b 21e7c867
 Fri Dec 05 13:41:53 2014 VERIFY OK: depth=1, C=BE, ST=WV, L=Brugge, O=SectorFive, OU=SectorFiveVPN, CN=fraise.servegame.com, name=SectorFiveVPN, [email protected]
 Fri Dec 05 13:41:53 2014 VERIFY OK: depth=0, C=BE, ST=WV, L=Brugge, O=SectorFive, OU=SectorFiveVPN, CN=SectorFiveVPN, name=SectorFiveVPN, [email protected]
 Fri Dec 05 13:41:54 2014 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
 Fri Dec 05 13:41:54 2014 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
 Fri Dec 05 13:41:54 2014 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
 Fri Dec 05 13:41:54 2014 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
 Fri Dec 05 13:41:54 2014 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
 Fri Dec 05 13:41:54 2014 [SectorFiveVPN] Peer Connection Initiated with [AF_INET]178.62.133.212:1194
 Fri Dec 05 13:41:55 2014 MANAGEMENT: >STATE:1417783315,GET_CONFIG,,,
 Fri Dec 05 13:41:56 2014 SENT CONTROL [SectorFiveVPN]: 'PUSH_REQUEST' (status=1)
 Fri Dec 05 13:41:56 2014 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: timers and/or timeouts modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: --ifconfig/up options modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: route options modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
 Fri Dec 05 13:41:56 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
 Fri Dec 05 13:41:56 2014 MANAGEMENT: >STATE:1417783316,ASSIGN_IP,,10.8.0.6,
 Fri Dec 05 13:41:56 2014 open_tun, tt->ipv6=0
 Fri Dec 05 13:41:56 2014 TAP-WIN32 device [LAN-verbinding 2] opened: \\.\Global\{B9B2C67D-BCB9-4A41-A97B-86186DD39D11}.tap
 Fri Dec 05 13:41:56 2014 TAP-Windows Driver Version 9.9 
 Fri Dec 05 13:41:56 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {B9B2C67D-BCB9-4A41-A97B-86186DD39D11} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
 Fri Dec 05 13:41:56 2014 Successful ARP Flush on interface [41] {B9B2C67D-BCB9-4A41-A97B-86186DD39D11}
 Fri Dec 05 13:42:01 2014 TEST ROUTES: 2/2 succeeded len=1 ret=1 a=0 u/d=up
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 178.62.133.212 MASK 255.255.255.255 192.168.0.1
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=25 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 192.168.0.1 MASK 255.255.255.255 192.168.0.1 IF 4
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=25 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 0.0.0.0 MASK 128.0.0.0 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 128.0.0.0 MASK 128.0.0.0 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 MANAGEMENT: >STATE:1417783321,ADD_ROUTES,,,
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 10.8.0.1 MASK 255.255.255.255 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 Initialization Sequence Completed
 Fri Dec 05 13:42:01 2014 MANAGEMENT: >STATE:1417783321,CONNECTED,SUCCESS,10.8.0.6,178.62.133.212

有谁可以帮忙吗?

答案1

好的,我找到了答案,显然一切都是正确的,我犯的唯一愚蠢的错误是没有以管理员身份运行 OpenVPN GUI => 我真愚蠢

相关内容