首页
关于本博客
友情链接
推荐
linux/shell
Search
1
LEDE官方固件安装中文语言包的方法
11,094 阅读
2
LEDE固件踢出弱信号客户端,实现WiFi无缝漫游脚本
9,221 阅读
3
基于CloudFlare API的纯Shell动态DNS(DDNS)脚本
8,201 阅读
4
一次OpenVPN交叉编译笔记
6,733 阅读
5
利用iptables的string模块来屏蔽域名(关键词匹配)
6,176 阅读
study
OpenWrt/LEDE
网络技术
数通
HCNP/CCNP
linux
shell
CentOS
Ubuntu/Debian
php
Linux应用
VPS推荐
洛杉矶VPS
欧洲VPS
搬瓦工
C/C++
虚拟化
IDC
杂项
MySQL
运维笔记
zabbix
seafile
openvpn
QEMU/KVM
windows
html
nginx
互联网应用
IP地址段汇总
登录
Search
标签搜索
nginx
OpenWrt
openvpn
SSH
cloudflare
seafile
iptables
VPS
linux
openssl
ddns
CentOS
Linux启动脚本
seafile网盘
vsftpd
openvpn配置模板
ftp
反向代理
seafile服务器
letsencrypt
自渡
累计撰写
78
篇文章
累计收到
2
条评论
首页
栏目
study
OpenWrt/LEDE
网络技术
数通
HCNP/CCNP
linux
shell
CentOS
Ubuntu/Debian
php
Linux应用
VPS推荐
洛杉矶VPS
欧洲VPS
搬瓦工
C/C++
虚拟化
IDC
杂项
MySQL
运维笔记
zabbix
seafile
openvpn
QEMU/KVM
windows
html
nginx
互联网应用
IP地址段汇总
页面
关于本博客
友情链接
推荐
linux/shell
搜索到
1
篇与
交叉编译
的结果
2018-06-11
一次OpenVPN交叉编译笔记
说明为了让家宽打VPN隧道到IDC机房提高QOS级别,决定将OpenVPN移植到mips架构的OpenWrt出口路由器上,而路由器本身不带编译器,所以必须通过交叉编译的方式将OpenVPN源码编译成路由器(mips)平台可执行的二进制文件。编译环境及说明在编译OpenVPN之前必须先编译OpenSSL和LZO,全程应以root身份运行编译程序的主机系统:CentOS6.9 X86_64(VMware)执行程序的主机系统:OpenWrt,Barrier Breaker14.07,mips架构(QCA9533)下载相关工具链及确定安装目录mkdir -p /usr/local/openwrt/opensslmkdir -p /usr/local/openwrt/lzomkdir -p /usr/local/openwrt/openvpncd /usr/local/openwrt && wget http://archive.openwrt.org/barrier_breaker/14.07/atheros/generic/OpenWrt-Toolchain-atheros-for-mips_mips32-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 tar -xvf OpenWrt-Toolchain-atheros-for-mips_mips32-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2mv OpenWrt-Toolchain-atheros-for-mips_mips32-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mips_mips32_gcc-4.8-linaro_uClibc-0.9.33.2 ./toolchain编译OpenSSLcd /usr/local/openwrt && wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz tar -zxvf openssl-1.0.2o.tar.gzcd openssl-1.0.2o && ./config --prefix=/usr/local/openwrt/openssl no-asm shared确保Makefile文件中有以下行,并且删除所有-m64选项CC=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-gccAR=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-arRANLIB=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-ranlibsed命令快速更改:sed -i 's/CC= gcc/CC=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-gcc/' Makefilesed -i 's/AR= ar/AR=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-ar/' Makefilesed -i 's/RANLIB=/usr/bin/ranlib/RANLIB= /usr/local/openwrt/toolchain/bin/mips-openwrt-linux-ranlib/' Makefilesed -i 's/-m64//g' Makefilemake -j4 && make install此时安装完毕,安装目录在/usr/local/openwrt/openssl目录下编译LZOcd /usr/local/openwrt && wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gztar -zxvf lzo-2.10.tar.gz && cd lzo-2.10./configure CC=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-gcc --host=mips-linux --prefix=/usr/local/openwrt/lzomake && make install编译OpenVPNcd /usr/local/openwrt && wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.1.tar.gztar -zxvf openvpn-2.3.1.tar.gz && cd openvpn-2.3.1./configure \CC=/usr/local/openwrt/toolchain/bin/mips-openwrt-linux-gcc \--host=mips-linux \--prefix=/usr/local/openwrt/openvpn/ \LZO_CFLAGS="-I/usr/local/openwrt/lzo/include" \LZO_LIBS="-L/usr/local/openwrt/lzo/lib -llzo2" \OPENSSL_CRYPTO_CFLAGS="-I/usr/local/openwrt/openssl/include" \OPENSSL_SSL_CFLAGS="-I/usr/local/openwrt/openssl/include" \OPENSSL_SSL_LIBS="-L/usr/local/openwrt/openssl/lib -lssl" \OPENSSL_CRYPTO_LIBS="-L/usr/local/openwrt/openssl/lib -lcrypto" \--disable-plugin-auth-pam \--with-ssl-lib=/usr/local/openwrt/openssl/lib \export C_INCLUDE_PATH=/usr/local/openwrt/openssl/includemake -j4 && make install将程序上传到OpenWrt路由器此时编译已全部完成,目录分别为/usr/local/openwrt/lzo/usr/local/openwrt/openssl/usr/local/openwrt/openvpn通过SCP将/usr/local/openwrt/openvpn/sbin/openvpn和/usr/local/openwrt/openssl/lib/libcrypto.so.1.0.0上传到路由器的/sbin和/lib目录下并赋予/sbin/openvpn执行权限即可chmod +x /sbin/openvpn
2018年06月11日
6,733 阅读
0 评论
0 点赞