我有一台运行openvpn服务器的ubuntu机器.当我尝试连接到ubuntu机器时,从另一个网络上的
Windows机器它说连接.我甚至可以ping ubuntu机器的本地ip.但我没有得到公共IP地址.这是计算机的公共IP地址(窗口)保持不变并且不会更改(在cmyip上检查).为什么会发生这种情况,我该如何解决这个问题?
客户端配置:
client proto udp dev tun ca ca.crt dh dh2048.pem cert client3.crt key client3.key remote publicip 1194 cipher DES-CBC verb 2 mute 20 keepalive 10 120 comp-lzo persist-key persist-tun float resolv-retry infinite nobind
服务器配置:
port 1194 proto udp dev tun0 ca keys/test/ca.crt cert keys/test/check.crt key keys/test/check.key dh keys/test/dh2048.pem server 10.180.240.0 255.255.240.0 crl-verify keys/test/crl.pem cipher DES-CBC user nobody group nogroup status servers/VPn1/logs/openvpn-status.log log-append servers/VPn1/logs/openvpn.log verb 2 mute 20 max-clients 100 local 192.168.1.101 keepalive 10 120 client-config-dir /etc/openvpn/servers/VPn1/ccd client-to-client duplicate-cn comp-lzo persist-key persist-tun ccd-exclusive route 10.22.1.0 255.255.255.0 route 10.22.2.0 255.255.255.0 route 10.22.3.0 255.255.255.0 push "route 10.180.0.0 255.255.252.0" push "route 10.22.1.0 255.255.255.0" push "route 10.22.2.0 255.255.255.0" push "route 10.22.3.0 255.255.255.0" push "dhcp-option DNS 10.180.3.12"
ipconfig / all
Tunnel adapter 6TO4 Adapter: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft 6to4 Adapter Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap.{}: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap. Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap. Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap. Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap.: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter #5 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes
如果要将OpenVPN服务器用作网关,则需要将默认路由推送到客户端.
服务器配置:
push "redirect-gateway def1"
http://openvpn.net/index.php/open-source/documentation/howto.html#redirect