红联Linux门户
Linux帮助

在Ubuntu 16.04和ARM 9上面跑OpenVPN功能

发布时间:2016-09-28 14:53:25来源:linux网站作者:笨蛋小猪
关于openvpn的ARM9的移值,我们采用的是NXP的IMX6的CPU,所以有一个yocto BSP发版本
 
首先是在ubunutu 16.04 x86上可以跑起来再移值到ARM上面
 
1.sudo apt-get install -y openvpn 安装openvpn客户端工具
 
2.在/etc/openvpn/一定有这样一个目录
 
3.就需要把openvpn Server 上面的配置文件导出来放到/etc/openvpn下,有ca.crt  openvpn.ovpn update-resolv-conf如下些文件
 
4.修改openvpn.ovpn这个文件里面的这一项的IP地址 remote 192.168.15.225 1194改成自己的IP地址就可以连接了
如下openvpn.ovpn:
harry@mh:/etc/openvpn$ cat openvpn.ovpn
dev tun
tls-client
remote 192.168.15.225 1194    这里修修IP地址为openvpn server的IP地址
# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)
#float
# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
#redirect-gateway def1
# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.
#dhcp-option DNS DNS_IP_ADDRESS
pull
# If you want to connect by Server's IPv6 address, you should use
# "proto udp6" in UDP mode or "proto tcp6-client" in TCP mode
proto tcp-client
script-security 2
ca /etc/openvpn/ca.crt  这个ca.crt就是服务器上面导出来的
comp-lzo
reneg-sec 0
auth-user-pass  /etc/openvpn/usrpwd.key   这个usrpwd.key里面是用户名和密码:如何test是用户密,test123是密码,这个是自己新建的文件,用户名和密码必须是两行,不能放在同一行
openvpn /etc/openvpn/openvpn.ovpn  > /dev/null &连接命令
 
ARM移值开始
可以通过bitbake -c compile <lzo openssl openvpn >这三个包单独build就可以了,会自动生成openvpn这个应用程序
然后就是copy 编绎好的的openvpn到我们的ARM的rootfs 文件系统 下面去,对应的openvpn 放在/usr/sbin/下就行了
 
接下来还要copy lzo 的 liblzo2.so  liblzo2.so.2  liblzo2.so.2.0.0 三个库文件 放在/usr/lib/下就可以了
在ARM9上面kernel必须要把CONFIG_TUN这个flag打开,在arm的roofs下面才有/dev/net/tun这个设备通道
把x86 ubuntu 16.04 配置文件copy到ARM9就到就可以用了,就这样完成了移值。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/24562.html