今天连夜配合美国那边架设了一个site to site 的open vpn。
注:因为GFW的原因,请把open vpn改成小写半角,you tobe的链接也的用小写半角手动改一下,谢谢。
系统版本:CentOS6.5
open vpn版本: Open_VPN 2.3.2 x86_64
架构图(简化版)
172.18.0.0/16(公司1内网网段)—-172.18.248.125(vpnserver1),10.0.0.2(tun0)——–internet ———10.0.0.1(tun0),172.19.0.5(vpnserver2)—- 172.19.0.0/16(公司2内网网段)
安装
yum install -y gcc make openssl-devel.x86_64 lzo-devel.x86_64 pam-devel.x86_64 cd openvpn-2.3.2 ./configure --prefix /opt/openvpn/ make -j 4 && make install**配置** **生成并同步key**
open vpn --genkey --secret /etc/openvpn/vpn.key rsync -av /etc/open vpn/vpn.key 172.19.0.5:/etc/open vpn/vpn.key
VPNServer 1配置
[root@open vpn open vpn]# cat /etc/open vpn/server.conf
remote 115.182.x.x
float
proto udp
port 1140
tun-mtu 1400
dev tun
ifconfig 10.0.0.2 10.0.0.1
persist-tun
persist-local-ip
comp-lzo
ping 15
secret /etc/open vpn/vpn.key
route 172.19.0.0 255.255.0.0
chroot /var/empty
user nobody
group nobody
log /var/log/vpn.log
verb 3
VPN server 2 配置
[root@open vpn open vpn]# cat /etc/open vpn/server.conf
remote 211.144.xxx.xx
float
proto udp
port 1140
dev tun
ifconfig 10.0.0.1 10.0.0.2
persist-tun
persist-local-ip
comp-lzo
ping 15
secret /etc/open vpn/vpn.key
route 172.18.0.0 255.255.0.0
#route 172.18.251.0 255.255.255.0
chroot /var/empty
user nobody
group nobody
log /var/log/vpn.log
verb 1
启动
/opt/openvpn/sbin/open vpn –config /etc/openvpn/server.conf
交换机上增加路由
1、在公司1内网网段三层交换机上增加路由 去172.19.0.0/16 的走 172.18.248.125
2、在公司2内网网段三层交换机上增加路由 去172.18.0.0/16 的走 172.19.0.5
测试
测试