CentOS6.7上安装配置Open×××
安装配置open***服务端
1、安装依赖
ntpdate pool.ntp.org
yum -y install lzo lzo-devel gcc pam-devel gcc-c++
2、安装open***
mkdir tools
cd tools
wget http://swupdate.open***.org/community/releases/open***-2.3.2.tar.gz
tar xf open***-2.3.2.tar.gz
cd open***-2.3.2
./configure --prefix=/usr/local/open***
make && make install && cd ..
3、使用easy-rsa生成服务端证书:
wget https://cloud.github.com/downloads/Open×××/easy-rsa/easy-rsa-2.2.0_master.tar.gz
tar xf easy-rsa-2.2.0_master.tar.gz
mkdir /etc/open*** #建立open***的配置文件存放目录
cd easy-rsa-2.2.0_master/easy-rsa/
cp -r * /etc/open***/
cd /etc/open***/2.0
cp vars vars_bak
egrep -v "^#|^$" vars
export EASY_RSA="`pwd`"
export OPENSSL="openssl"
export PKCS11TOOL="pkcs11-tool"
export GREP="grep"
export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
export KEY_DIR="$EASY_RSA/keys"
echoNOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
export PKCS11_MODULE_PATH="dummy"
export PKCS11_PIN="dummy"
export KEY_SIZE=1024
export CA_EXPIRE=3650
export KEY_EXPIRE=3650
export KEY_COUNTRY="US"
export KEY_PROVINCE="CA"
export KEY_CITY="SanFrancisco"
export KEY_ORG="Fort-Funston"
export KEY_EMAIL="[email protected]"
expor [email protected]
export KEY_CN=changeme
export KEY_NAME=changeme
export KEY_OU=changeme
export PKCS11_MODULE_PATH=changeme
export PKCS11_PIN=1234
sed -i 's/export KEY_COUNTRY="US"/export KEY_COUNTRY="CN"/g'vars
sed -i 's/export KEY_PROVINCE="CA"/export KEY_PROVINCE=" GanSu "/g' vars
sed -i 's/export KEY_CITY="SanFrancisco"/export KEY_CITY="LanZhou"/g' vars
sed -i 's/export KEY_ORG="Fort-Funston"/export KEY_ORG="China Mobile"/g' vars
sed -i 's/export [email protected]/export [email protected]/g' vars
sed -i 's/export KEY_CN=changeme/export KEY_CN=***server/g' vars
sed -i 's/export KEY_NAME=changeme/export KEY_NAME=server/g' vars
sed -i 's/export KEY_OU=changeme/export KEY_OU=Network Center/g' vars
source ./vars #初始化参数
./clean-all #清空现有的所有证书与蜜钥
./build-ca #生成CA证书
./build-key-server ***server #建立server key (一路回车)
./build-dh #生成diffiehellman参数
cp keys/{ca.crt,***server.crt,***server.key,dh1024.pem} /etc/open***/
4、创建并编辑服务器端配置文件server.conf
cp /root/tools/open***-2.3.2/sample/sample-config-files/server.conf /etc/open***/
cp /etc/open***/server.conf /etc/open***/server.conf_back
cat > /etc/open***/server.conf < ;local $local***ip port 52115 proto tcp dev tun #说明连接方式是点对点的连接,如要以以太网的方式则可以将tun修改为tap ca /etc/open***/ca.crt cert /etc/open***/***server.crt key /etc/open***/***server.key dh /etc/open***/dh1024.pem server 10.100.80.0 255.255.255.0 ifconfig-pool-persist ipp.txt push "route 10.0.0.254 255.255.255.0" #路由转发到内网网段 push "dhcp-option DNS 202.100.64.68" client-to-client #如果不加,则各个客户端之间将无法连接 duplicate-cn keepalive 10 120 comp-lzo persist-key persist-tun status open***-status.log log /var/log/open***.log verb 3 EOF /usr/local/open***/sbin/open*** --config /etc/open***/server.conf --daemon netstat -tunlp|grep open*** tcp 0 0 0.0.0.0:52115 0.0.0.0:* LISTEN 14056/open*** 5、转发相关的配置 sed -i '/ip_forward/s/0/1/g' /etc/sysctl.conf sysctl –p iptables -I INPUT -p tcp --dport 52115 -j ACCEPT iptables -t nat -I POSTROUTING -s 10.0.0.0/24 -j SNAT --to-source 192.168.0.200 service iptables save 6、加入开机启动 echo "#startup open***service by $dybm" >> /etc/rc.local echo "/usr/local/open***/sbin/open*** --config /etc/open***/server.conf --daemon " >> /etc/rc.local 安装配置open***客户端 http://swupdate.open***.org/community/releases/open***-install-2.3.2-I001-i686.exe http://swupdate.open***.org/community/releases/open***-install-2.3.2-I001-x86_64.exe 注意:安装客户端时最好将所有的组件全部安装 1、生成客户端证书和密钥:(client为客户端名字可以自定义,注意这里的客户端名字不能与上面的服务端名字相同) cd /etc/open***/2.0 #服务器端open***配置文件目录 期间也会提示输入一些信息,直接回车默认,选择[Y/n]的都选Y。若要生成多个客户端的证书和密钥,将client改成另外的名字重复操作即可。所有生成的证书和密钥都存放在/etc/open***/2.0/keys下面。 ./build-key client #在服务器端生成客户端证书和密钥 2、下载之前在服务端上生成的客户端证书及密钥 证书和密钥都存放在/etc/open***/2.0/keys里,可以使用winscp链接到服务端上下载,将ca.crt、client.crt、client.key这三个文件下载到Open×××客户端程序的config文件夹里,默认为:C:\ProgramFiles\Open×××\config sz ca.crt client.crt client.key #我这里使用sz小工具下载 3、创建客户端配置文件 C:\Program Files\Open×××\sample-config\client.o*** #客户端配置模版文件 使用记事本修改该文件,内容如下: client #使Open×××作为客户端软件使用,这个client不是自定义名称不能更改 dev tun #说明连接方式是点对点的连接,如要以以太网的方式则可以将tun修改为tap,要与前面server.conf中的配置一致。 ;dev tap proto tcp #要与前面server.conf中的配置一致。 dev-node ***client #设备节点名称,windows需要修改 remote 192.168.0.200 52115 #指定×××服务器的外网IP地址与端口号,端口与前面的server.conf中配置一致。 ;proto udp ;remote-random resolv-retry infinite nobind persist-key persist-tun ca ca.crt #指定服务器CA证书文件 cert client.crt #指定客户端证书文件 key client.key #指定客户端私钥文件 ns-cert-type server redirect-gateway keepalive 20 60 comp-lzo verb 3 mute 20 route-method exe route-delay 2 注意:配置文件中的设备节点名称在windows平台下是需要修改的,并且在安装完成Open×××软件后,客户端计算机中会多出一块虚拟网卡,我们还需要将该网卡的名称修改为dev-node定义的设备名称。设置方法是在Windows控制面板中找到网络连接,在网络连接中,将该虚拟网卡重名为***client即可。 运行Open×××客户端 运行Open××× GUI后,屏幕右下角的系统托盘区,会显示一个由两个红屏电脑组成的图标,右击它,选中菜单中的Connect,点击Connect,过一会儿,Open×××图标变成绿色时就表示链接成功了。 现在×××连接成功了,让我们一起看一下服务端的日志,如下: Sun Apr24 02:39:01 2016 TCP connection established with [AF_INET]192.168.0.101:49569 Sun Apr24 02:39:01 2016 192.168.0.101:49569 TLS: Initial packet from[AF_INET]192.168.0.101:49569, sid=c9704a4a bdf1d307 Sun Apr24 02:39:02 2016 192.168.0.101:49569 VERIFY OK: depth=1, C=CN, ST=GanSu,L=LanZhou, O=China Mobile, OU=Network, CN=***server, name=server,[email protected] Sun Apr24 02:39:02 2016 192.168.0.101:49569 VERIFY OK: depth=0, C=CN, ST=GanSu,L=LanZhou, O=China Mobile, OU=Network, CN=client, name=server,[email protected] Sun Apr24 02:39:02 2016 192.168.0.101:49569 Data Channel Encrypt: Cipher 'BF-CBC'initialized with 128 bit key Sun Apr24 02:39:02 2016 192.168.0.101:49569 Data Channel Encrypt: Using 160 bitmessage hash 'SHA1' for HMAC authentication Sun Apr24 02:39:02 2016 192.168.0.101:49569 Data Channel Decrypt: Cipher 'BF-CBC'initialized with 128 bit key Sun Apr24 02:39:02 2016 192.168.0.101:49569 Data Channel Decrypt: Using 160 bitmessage hash 'SHA1' for HMAC authentication Sun Apr24 02:39:02 2016 192.168.0.101:49569 Control Channel: TLSv1, cipher TLSv1/SSLv3DHE-RSA-AES256-SHA, 1024 bit RSA Sun Apr24 02:39:02 2016 192.168.0.101:49569 [client] Peer Connection Initiated with[AF_INET]192.168.0.101:49569 Sun Apr24 02:39:02 2016 client/192.168.0.101:49569 MULTI_sva: pool returnedIPv4=10.100.80.10, IPv6=(Not enabled) Sun Apr24 02:39:02 2016 client/192.168.0.101:49569 MULTI: Learn: 10.100.80.10 ->client/192.168.0.101:49569 Sun Apr24 02:39:02 2016 client/192.168.0.101:49569 MULTI: primary virtual IP forclient/192.168.0.101:49569: 10.100.80.10 Sun Apr24 02:39:04 2016 client/192.168.0.101:49569 PUSH: Received control message:'PUSH_REQUEST' Sun Apr24 02:39:04 2016 client/192.168.0.101:49569 send_push_reply(): safe_cap=940 Sun Apr 24 02:39:04 2016 client/192.168.0.101:49569 SENTCONTROL [client]: 'PUSH_REPLY,route 10.0.0.254 255.255.255.0,dhcp-option DNS202.100.64.68,route 10.100.80.0 255.255.255.0,topology net30,ping10,ping-restart 120,ifconfig 10.100.80.10 10.100.80.9' (status=1) 哈哈,相信看了日志,大家就会明白的!