麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統 > CentOS > 正文

CentOS6.5/7.0 上 OpenVPN的安裝

2024-06-28 16:00:27
字體:
來源:轉載
供稿:網友

CentOS 上 OpenVPN的安裝:

一、安裝準備

?

1、安裝openssl、gcc、libpam

#yum -y install openssl-devel openssl

#yum -y install gcc gcc-c++

#yum -y install pam-devel.x86_64

如遇Segmentation Fault,在/usr/local/lib下,刪除鏈接libz.so和libz.so.1

#rm -f libz.so

#rm -f libz.so.1

安裝完之后恢復這兩個鏈接即可

#ln -s libz.so.1.2.7 libz.so.1

#ln -s libz.so.1 libz.so

二、OpenVPN服務端安裝過程

下載lzo,下載鏈接為http://www.oberhumer.com/opensource/lzo/#download,下載完之后復制到/var/tmp目錄下

1、lzo的安裝

#cd /var/tmp    //安裝目錄

#gunzip zxvf lzo-2.04.tar.gz    //解壓

#tar zxvf lzo-2.04.tar    //解壓

#cd lzo-2.04

#./configure    

#make

#make install   #編譯與安裝

2、openvpn下載與安裝

下載openvpn,下載鏈接為https://openvpn.net/index.php/open-source/downloads.html,下載完之后復制到/var/tmp目錄下

#cd /var/tmp

#gunzip xvf openvpn-2.3.10.tar.gz

#tar xvf openvpn-2.3.10.tar

#./configure

#make

#make install

“lzo enabled but missing” -> lzo configure改為 “./configure --PRefix=/usr/local/”##CentOS 7 會遇到這個問題

“libpam required but missting” ->安裝libpam“yum -y install pam-devel.x86_64”##CentOS 7 會遇到這個問題

安裝好了檢查一下openvpn版本

#openvpn --version

3、easy-sea安裝

下載openvpn,下載鏈接為https://community.openvpn.net/openvpn/wiki/GettingEasyRsa,下載完之后復制到/var/tmp目錄下

#cd /var/tmp

#gunzip xvf easy-rsa-2.2.0_master.tar.gz

#tar xvf easy-rsa-2.2.0_master.tar

#./configure

#make

#make install

安裝路徑

/usr/local/share/easy-esa/

三、制作證書

復制源文件至目標路徑

#mkdir /etc/openvpn

#cp -rf /usr/local/share/easy-rsa /etc/openvpn/

0、配置vars

#vi /etc/openvpn/easy-rsa/vars

export KEY_SIZE=2048      //DH證書的長度設為2048,缺省為1024

export KEY_COUNTRY="CN"

export KEY_PROVINCE=“SH”

export KEY_CITY=“Shanghai”

export KEY_ORG=“jhrdc”

export KEY_EMAIL=“[email protected]

export KEY_OU=“jhrdc“

export KEY_NAME=jhrdc       //特別重要,“jhrdc”根據情況自己設定

#cd /etc/openvpn/easy-rsa

#source vars  //執行腳本生成證書時,需要設置一些環境變量

#./clean-all    //制作客戶端證書時,不需要執行該腳本

1、生成根證書-CA證書,CA證書同時需要部署在服務器和客戶端上

#./build-ca

#cp keys/ca.crt /etc/openvpn/

2、生成服務器端證書

#./build-key-server jhrdc

#./build-dh

#cp keys/jhrdc.crt keys/jhrdc.key keys/dh2048.pem /etc/openvpn/

3、Client端證書

#./build-key jhrdc    //使用服務器端的CN設定

Generating a 2048 bit RSA private key

................................................................................................+++

....+++

writing new private key to jhrdc.key'

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code)[CN]:

State or Province Name (full name)[SH]:

Locality Name (eg, city)[Shanghai]:

Organization Name (eg, company)[JH]:

Organizational Unit Name (eg, section)[jhrdc]:

Common Name (eg, your name or your server's hostname)[jhrdc]:testchannel1   //給不同的客戶端創建證書和私鑰時,可以使用不同名字

Name [jhrdc]:testchannel1

Email Address [[email protected]]:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge passWord []:

如遇“TXT_DB error number 2”錯誤,重新touch一個keys/index.txt

生成的客戶端證書位于/etc/openvpn/easy-rsa/keys,分別是jhrdc.crt、jhrdc.csr、jhrdc.key。這幾個證書和前面所生成的服務器端的證書有所不同,僅可為客戶端所使用,請將這幾個證書文件和ca.crt打包,拷貝到客戶端電腦備用。

注意,同一個證書,缺省配置情況下同時只能從一個客戶端登陸

四、配置openvpn服務器

修改服務器配置文件

#cp /var/tmp/openvpn-2.3.10/sample/sample-config-files/server.conf /etc/openvpn/

#vi /etc/openvpn/server.conf

port 1194 //端口設為1194

proto tcp //協議設為tcp

ca ca.crt //ca.crt的路徑,建議和server.conf在一個目錄下

cert jhrdc.crt //jhrdc.crt的路徑,建議和server.conf在一個目錄下

key jhrdc.key //jhrdc.key的路徑,建議和server.conf在一個目錄下

server 10.8.0.0 255.255.255.0 //DHCP服務器的IP段,缺省是10.8.0.0

client-to-client //VPN客戶端之間允許互相訪問,如不需要客戶端之間互相訪問,則可注釋該配置

max-clients 10 //并發的客戶端鏈接,可設為10個

user nobody //服務啟動時使用的系統用戶,建議使用nobody

group nobody //服務啟動時使用的系統用戶組,建議使用nobody

五、啟動openvpn的服務器端

#cd /etc/openvpn

#openvpn —config /etc/openvpn/server.conf —daemon

六、配置客戶端

下載Windows客戶端,下載鏈接為https://openvpn.net/index.php/download/community-downloads.html,

安裝后,將第三步所生成的證書文件和配置文件放在一個目錄里,并修改客戶端配置文件,然后啟動該配置文件即大功告成。配置文件簡要說明

client

proto tcp

remote 111.111.111.111 1194  //VPN服務器的IP地址和端口號

ca /etc/openvpn/ca.crt //ca.crt的路徑,建議和server.conf在一個目錄下

cert /etc/openvpn/testchannel1.crt //testchannel1.crt的路徑,建議和server.conf在一個目錄下

key /etc/openvpn/testchannel1.key //testchannel1.key的路徑,建議和server.conf在一個目錄下

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:Jing7VPN

An optional company name []:JingHang

七、將openvpn添加到啟動腳本/etc/rc.d/rc.local里

CentOS 7里面需要給rc.local加上可執行權限,

需要ln -s /etc/rc.d/rc.local /etc/rc.local

=======

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

/usr/local/sbin/openvpn --config /etc/openvpn/client.conf --daemon

service iptables start

自啟動時,server.conf里,證書的路徑需要是絕對路徑


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久久福利精品 | 国产精品视频一区二区三区四区五区 | 成人国产高清 | 中文字幕在线观看视频一区 | 国产视频在线观看一区二区三区 | 国产精品高潮视频 | 一区二区三区黄色 | 午夜精品福利视频 | 久久骚| 亚洲成人久久精品 | 日韩欧美激情视频 | 国产精品一区二区三区在线播放 | 日本a∨精品中文字幕在线 被啪羞羞视频在线观看 | 在线看免费的a | 在线亚洲免费 | 欧美成人精品一级 | 久久免费视频8 | 精品国产一区二区三区蜜殿 | 亚洲精品午夜电影 | 精品久久久一二三区播放播放播放视频 | 欧美精品成人一区二区三区四区 | 欧美一级成人 | 毛片免费观看视频 | 成人国产精品一区二区毛片在线 | 日韩中字幕 | 黄色视频一级毛片 | 国产一区二区三区四区五区精品 | 麻豆19禁国产青草精品 | 视频一区二区精品 | 狠狠一区二区 | 最新亚洲国产 | 在线天堂中文在线资源网 | 久久新地址 | 欧美女同hd | 天天草天天干天天 | 在线播放av片 | www.xxx视频| 精品国产乱码一区二区三区四区 | 911色_911色sss主站色播 | 国产一区精品视频 | 美女久久久久久久久 |