Centos系统下载大全 | Redhat系统下载大全 | Windows2012系统下载大全 | Windows2008系统下载大全| CMS教程 | 网站地图 51运维网-专注Linux/Unix系统安全运维!
当前位置:51运维网 > 入门 > Linux入门 > 正文

CentOS下搭建一台VPN服务器实现外部网络连接内部网络

时间:2016-08-16 18:42 来源:网络整理 作者:linux系统 阅读:

# 创建一份客户端文件(命名为client.ovpn),内容如下(读者要注意修改下面的服务端公网IP)

client

dev tun

proto udp

remote 服务端公网IP 1194

resolv-retry infinite

nobind

persist-key

persist-tun

ns-cert-type server

comp-lzo

verb 3

tls-auth [inline] 1

<ca>

将/usr/share/easy-rsa/2.0/keys/ca.crt的全部内容复制粘贴于此

</ca>

<cert>

将/usr/share/easy-rsa/2.0/keys/client.crt的全部内容复制粘贴于此

</cert>

<key>

将/usr/share/easy-rsa/2.0/keys/client.key的全部内容复制粘贴于此

</key>

<tls-auth>

将/usr/share/easy-rsa/2.0/keys/ta.key的全部内容复制粘贴于此

</tls-auth>

 

# 从服务端下载client.ovpn,并将其复制到openvpn的安装目录的config目录下,最后,启动openvpn程序,连接服务端,如果能获取到IP,且能ping内网的其他机器就表示配置成功了。

 

# 最后给出我的client.ovpn的范例文本供读者参考。

client

dev tun

proto udp

remote 192.168.1.88 1194

resolv-retry infinite

nobind

persist-key

persist-tun

ns-cert-type server

comp-lzo

verb 3

tls-auth [inline] 1

<ca>

-----BEGIN CERTIFICATE-----

MIIFEjCCA/qgAwIBAgIJALomSu6uks0gMA0GCSqGSIb3DQEBCwUAMIG2MQswCQYD

VQQGEwJVUzELMAkGA1UECBMCQ0ExFTATBgNVBAcTDFNhbkZyYW5jaXNjbzEVMBMG

A1UEChMMRm9ydC1GdW5zdG9uMR0wGwYDVQQLExRNeU9yZ2FuaXphdGlvbmFsVW5p

dDEYMBYGA1UEAxMPRm9ydC1GdW5zdG9uIENBMRAwDgYDVQQpEwdFYXN5UlNBMSEw

HwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wHhcNMTQx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BImdxxx8LDpmceW6TEYreiVmjI8ddoNWKaFmqIz4G

1K1rXbCplqoMKFUUHl9PbU5hiQKBgQDUSV4mIBdHMwEGpwUgYr/Yqc0LNdt3HvsO

ZzrxKqFCiB1XE7rc05/2Tt0ll8FSNdlPIwfu3YPUzoU1SCMjb1Q9GrvR9H5DNv24

8wd74ThzOF0xiZUOZwj6X6ZxFvfdUe6hI5h/b0dG7pUw+JSkmnpD7BO+YE1MjjN3

nzqQTnecoQKBgQCyJFiyF0NE7PDxxbJC6OzPGFWbGyPPfInDSgzbgXxbAMvNQZIt

5I0Detvk6HHOO8yPs6oxWQfGVXrB7K+GfAGZiLV2ChBZVs0PSJ8AIVCXlwEzcbIg

MerjHESW/ivznea6ywrHCdk69PM7KyHyzXq2E+LRMJUR41k+xOP/fqwYcQKBgQDI

OU7wnLH3+JZOJPgD3L/f5f+8RBb0WqcmpZ0FXFTvAJzTxYsovv2P/kA9Nc4j8SA+

sObJl+rAq+0eHSTvRhDo9S8TTwxL7zEN4UM8x2dL3WygzYhmJi5koBTHc4djGuT8

3Sr3fwh2UY8rujnQqtcI+0B//irKOxE2EVvWQfw1IQKBgQCJgU0Ef+CDR6R2iImL

69xkwp2umQVDPFCJtlJ5Oqg7CRI4HHo2+ujfDq8hl4ihg0Zq6e+iIrBCBOOFlpLn

xrvhxAv79sB/w5Y3zSwTtqwnpUR65ZKi2X4exza0//yY77LAuGNcG5oKTUhTBDMz

FPnZX9Q0zJevs0+UfAeXvThc9g==

-----END PRIVATE KEY-----

</key>

<tls-auth>

-----BEGIN OpenVPN Static key V1-----

a692b93eeb708a615914f791ef42a2fb

4d14e99055aa297e564366ed272c25d7

116cd7a43d5f9d02c84d566406a3a657

84f1e69c23c3d954b1a19dc4d373b8a3

7c717d397c51e947183a628c4f4a7e98

173a65e0ce9806b2b04f1ce0e45ffacb

67bbca2db49cb3b78c573b85fb3d79c4

bbbf61d9147513957ac4668e541db859

c449eaf04b0d0585dc4c102ca010d91a

5ad275b7fb13e95f0a971a88a7550cb4

3485825fb6304b8537ac9cd6af5fda68

4a0d94d47f3a0478e722f20e0043de1c

c18684f5b68e6f19ad5b302cb9ddc1ca

b326c80c4b6bb235dda607a5fa79fbc8

5da586741a428e2ab390827c5145893a

d78f0bef7c86710ec7752d60cb94cada

-----END OpenVPN Static key V1-----

</tls-auth>

感谢您对【51运维网 http://www.51ou.com/】的支持,我们为您免费提供《CentOS下搭建一台VPN服务器实现外部网络连接内部网络》技术文章,《CentOS下搭建一台VPN服务器实现外部网络连接内部网络》详细使用和说明,有时《CentOS下搭建一台VPN服务器实现外部网络连接内部网络》可能不完善、敬请谅解!如果《CentOS下搭建一台VPN服务器实现外部网络连接内部网络》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
验证码:点击我更换图片