经验技巧:Linux VPN服务器之OpenVPN

中国IT实验室 发表于:11年12月21日 15:36 [转载] 中国IT实验室

  • 分享:
[导读]本文主要介绍利用openvpn+linux快速建立企业VPN,希望对大家有所帮助。

我将openvpn-2.0.beta7.tar.gz和lzo-1.08.tar.gz下载到/home

#cd /home

#tar zxvf lzo-1.08.tar.gz

#cd lzo-1.08.

#./comfigure

#make

#make install

#tar zxvf openvpn-2.0_beta7.tar.gz

#cd openvpn-2.0_beta7

#./configure --with-lzo-headers=/usr/local/include --with-lzo-lib=/usr/local/lib

#make

#make install

#mkdir /etc/openvpn

#cd /etc/openvpn

#openvpn --genkey --secret static.key

将static.key从office主机复制到home主机的/etc/openvpn目录中

office#scp static.key root@218.85.158.244:/etc/openvpn

office#cd /home/openvpn-2.0_beta7/sample-config-files

office#cp static-office.conf /etc/openvpn

office#cp firewall.sh /etc/openvpn

office#cp openvpn-startup.sh /etc/openvpn

office#cp office.up /etc/openvpn

修改static-office.conf ,firewall.sh ,openvpn-startup.sh,office.up

我们先来看office主机的这几个配置文件

static-office.conf配置如下:

dev tun0

remote 218.85.158.244 #为对端的公网ip

ifconfig 10.1.0.1 10.1.0.2 #为本端和对端的vpn ip地址

secret /etc/openvpn/static.key #密钥

port 5000

comp-lzo

ping 15

ping 15

ping-restart 45

ping-timer-rem

persist-tun

persist-key

verb 3

office主机的firewall.sh脚本如下:

#!/bin/bash

PRIVATE=192.168.1.0/24

LOOP=127.0.0.1

iptables -P OUTPUT DROP

iptables -P INPUT DROP

iptables -P FORWARD DROP

iptables -F

iptables -P OUTPUT ACCEPT

iptables -P INPUT DROP

iptables -P FORWARD DROP

iptables -A INPUT -i eth1 -s $LOOP -j DROP

iptables -A FORWARD -i eth1 -s $LOOP -j DROP

iptables -A INPUT -i eth1 -d $LOOP -j DROP

iptables -A FORWARD -i eth1 -d $LOOP -j DROP

[责任编辑:王瑶]
Aria
北京时间11月9日消息,受惠于平板电脑市场对移动芯片的大量需求,英伟达今天公布的第三财季财报数据好于华尔街平均预期。
官方微信
weixin
精彩专题更多
存储风云榜”是由DOIT传媒主办的年度大型活动。回顾2014年,存储作为IT系统架构中最基础的元素,已经成为了推动信息产业发展的核心动力,存储产业的发展迈向成熟,数据经济的概念顺势而为的提出。
华为OceanStor V3系列存储系统是面向企业级应用的新一代统一存储产品。在功能、性能、效率、可靠性和易用性上都达到业界领先水平,很好的满足了大型数据库OLTP/OLAP、文件共享、云计算等各种应用下的数据存储需求。
联想携ThinkServer+System+七大行业解决方案惊艳第十六届高交会
 

公司简介 | 媒体优势 | 广告服务 | 客户寄语 | DOIT历程 | 诚聘英才 | 联系我们 | 会员注册 | 订阅中心

Copyright © 2013 DOIT Media, All rights Reserved. 北京楚科信息技术有限公司 版权所有.