配置Open***服務器端
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm
yum install open***
cp -R /usr/share/open***/easy-rsa /etc/open***/
cd /etc/open***/easy-rsa/2.0vim vars
根據自己實際情況修改下面的信息:
export KEY_COUNTRY=”CN” 定義所在國家
export KEY_PROVINCE=”TJ” 定義所在省份
export KEY_CITY=”TJ” 定義所在城市
export KEY_ORG=”liukangxu.info” 定義所在組織
export KEY_EMAIL=”[email protected]” 定義郵件地址
source ./vars
./clean-all #全部回車
./build-ca server #前面全回車,最後兩步y
./build-key-server server #前面全回車,最後兩步y
./build-key ***1 #***1是客戶端名稱
./build-dh #生成Diffie Hellman參數
編輯/etc/open***/server.conf放入下面的內容:
port 443
proto tcp
dev tun
ca /etc/open***/easy-rsa/2.0/keys/ca.crt
cert /etc/open***/easy-rsa/2.0/keys/server.crt
key /etc/open***/easy-rsa/2.0/keys/server
.keydh /etc/open***/easy-rsa/2.0/keys/dh1024.pem
server 192.168.20.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway"
push "dhcp-option DNS 8.8.8.8"
keepalive 10 120
comp-lzo
persist-key
persist-tun
啓用ip包轉發
sed -i "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g"
/etc/sysctl.conf
sysctl -p
然後配置iptables規則,很重要,不然會導致連接後無法訪問外網
1.iptables -t nat -F
2.iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -o eth0 -j MASQUERADE
3.iptables -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
4.iptables -A INPUT -i lo -j ACCEPT
5.iptables -A INPUT -p tcp --dport 22 -j ACCEPT
6.iptables -A INPUT -p tcp -m state --state INVALID,NEW -j DROP
###iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -j SNAT –to-source 你的服務器IP地址
/etc/init.d/iptables save
/etc/init.d/iptables restart
最後啓動open***以及加入開機啓動
service open*** start
chkconfig open*** on
配置Open***客戶端
下載Open***的windows客戶端:http://swupdate.open***.org/community/releases/open***-2.2.1-install.exe
下載安裝完成以後,把Open***服務器/etc/open***/easy-rsa/2.0/keys目錄下
的***1.crt、***1.csr、***1.key、ca.crt、ca.key五個文件複製到Open***客戶端安裝目錄下的config目錄下
然後再config目錄下新建***1.o***文件,編輯內容如下:
client
dev tun
proto tcp
remote Open***服務器ip 443
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert ***1.crt
key ***1.key
ns-cert-type server
comp-lzo
verb 3
至此全部操作完成,打開Open***客戶端連接試試看吧!
以上內容主要參考以下文章:
OpenVZ VPS 下 CentOS 安裝 Open*** 詳細教程
CentOS 安裝和配置Open***
感謝以上所有文章的原作者!
結合freeradius驗證
上面全部操作沒有問題以後,請再繼續下面的步驟:
上面是使用個人證書驗證,由於要結合freeradius,所以要修改使用用戶名、密碼驗證,請保證/etc/open***/server.conf配置文件如下:
port 443
proto tcp
dev tun
ca /etc/open***/easy-rsa/2.0/keys/ca.crt
cert /etc/open***/easy-rsa/2.0/keys/server.crt
key /etc/open***/easy-rsa/2.0/keys/server.keydh /etc/open***/easy-rsa/2.0/keys/dh1024.pem
server 192.168.20.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway"push "dhcp-option DNS 8.8.8.8"keepalive 10 120
comp-lzo
persist-key
persist-tun
status 1194.log
verb 3
client-cert-not-required
username-as-common-name
安裝必要的包
yum install libgcrypt libgcrypt-devel gcc-c++
安裝radius的插件
wget http://www.nongnu.org/radiusplugin/radiusplugin_v2.1a_beta1.tar.gz
tar xvfz radiusplugin_v2.1a_beta1.tar.gz
cd radiusplugin_v2.1a_beta1/
make
cp radiusplugin.so /etc/open***/
cp radiusplugin.cnf /etc/open***/
編輯/etc/open***/radiusplugin.cnf,保證server部分信息如下,其他部分不動:
erver{
# The UDP port for radius accounting.
acctport=1813 # The UDP port for radius authentication.
authport=1812 # The name or ip address of the radius server.
name=YOUR RADIUS SERVER IP # How many times should the plugin send the if there is no response?
retry=1 # How long should the plugin wait for a response?
wait=1 # The shared secret.
sharedsecret=YOUR RADIUS SERVER SECRET}
編輯/etc/open***/server.conf在最下面加入:
plugin /etc/open***/radiusplugin.so /etc/open***/radiusplugin.cnf
service open*** restart
至此,open***服務器端配置完成,下面是客戶端,配置文件如下即可:
client
dev tun
proto tcp
remote Open***-Server-IP PORT
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
原文:http://www.xj123.info/3191.html