L2TP Remote Access Server on UBNT EdgeRouter

EdgeRouter Lite with Firmware 1.9.0

L2TP PSK Mode.

WAN interface: eth1
LAN IP: 192.168.3.1
VPN Subnets: 192.168.47.1-192.168.47.99

Run commands below in ‘configure mode’.

1 Configure IPSec

2 Configure L2TP

3 Configure DNS
Make sure you have following lines, otherwise you can get DNS resolved.

L2TP Remote Access Server on UBNT EdgeRouter by @sskaje: https://sskaje.me/2016/10/l2tp-remote-access-server-ubnt-edgerouter/

Incoming search terms:

EdgeRouter Lite: Source Based Routing

I have 192.168.1.1/24 on my eth0 as LAN, VPN set up.
For some cases, I want to visit some web site via VPN, I set up a socks 5 proxy.
But socks 5 is not an option for iPhone & Android by default.

So I added 192.168.10.1/24 to eth0 at the same time, traffic from 192.168.10.0/24 are all forwarded to VPN interface.

If I want my iPhone traffic fully routed to VPN, I just need to change my iPhone WiFi addresses.

EdgeRouter Lite: Source Based Routing by @sskaje: https://sskaje.me/2016/03/edgerouter-lite-source-based-routing/

EdgeRouter PPtP Server访问本地DNS服务

UBNT EdgeRouter 自带了PPTP Server,典型的配置方法是

官方参考guide: https://help.ubnt.com/hc/en-us/articles/205220840-EdgeMAX-PPTP-VPN-with-local-users-RADIUS

这个案例里,我的路由eth0是LAN口,eth0的IP是 192.168.100.1,这个配置下我的pptp客户端能正常访问到我的内网的机器。
但是如果我需要把DNS设成 192.168.100.1,DNS请求就会一直没响应。
路由端抓 UDP 53 的包,可以看到pptp客户端发出的dns请求,但是没有回包。
看了眼/etc/dnsmasq.conf:

man dnsmasq

-i, –interface=
Listen only on the specified interface(s). Dnsmasq automatically adds the loopback (local) interface to the list of interfaces to use when the –interface option is used. If no –interface or –listen-address options
are given dnsmasq listens on all available interfaces except any given in –except-interface options. IP alias interfaces (eg “eth1:0”) cannot be used with –interface or –except-interface options, use –listen-
address instead. A simple wildcard, consisting of a trailing ‘*’, can be used in –interface and –except-interface options.

尝试了加一个 interface=pptp*,无效。
顺手先把dnsmasq的请求隔离到一个新的网段 192.168.101.0/24,服务端的local-ip设成 192.168.101.1,推送dns 192.168.101.1,再设置options ‘listen-address=192.168.101.1’,解决。
全部命令如下

EdgeRouter PPtP Server访问本地DNS服务 by @sskaje: https://sskaje.me/2016/02/edgerouter-pptp-server-dns-service/

Incoming search terms:

Set up OpenVPN Site-to-Site on UBNT EdgeRouter Lite

参考:https://help.ubnt.com/hc/en-us/articles/204949694-EdgeMAX-OpenVPN-Site-to-Site
不同的是,我一端是Ubuntu Linux,另一端是EdgeRouter Lite。

实现的目的也是让EdgeRouter连上远程vpn实现XXXX。
PPTP的方案参考:EdgeOS PPTP VPN客户端配置

环境

Ubuntu Linux, 10.99.99.2
EdgeRouter Lite, 10.99.99.1

配置EdgeRouter Lite

SSH到Ubnt EdgeRouter Lite
生成共享密钥文件

执行命令创建VPN

执行命令启用NAT

如果需要重启tunnel

配置Linux

安装openvpn

把EdgeRouter的 /config/auth/secret 复制到 /etc/openvpn/er-site2site-static.key

编辑 /etc/openvpn/server.conf

启动openvpn

测试

在EdgeRouter ping Linux

在Linux ping EdgeRouter

如果还有问题,可以看日志

配置路由

参考下一篇文章 UBNT EdgeOS 配置设备路由(interface-route)的方法

Set up OpenVPN Site-to-Site on UBNT EdgeRouter Lite by @sskaje: https://sskaje.me/2016/02/set-openvpn-site-to-site-ubnt-edgerouter-lite/

Incoming search terms:

Easy-RSA 3 HowTo

OpenVPN 自带了一套CA相关的脚本,乱七八糟的,用起来并没觉得有多easy,不过新版把文件整合了,github: https://github.com/OpenVPN/easy-rsa
Easy-RSA 3.0 今天刚Release。

配置

配置起来比较简单,把下列文件放在同一个目录里即可,或者下载官方的release,直接改名 vars.example 为 vars。

  • easyrsa
  • openssl-1.0.cnf
  • vars
  • x509-types

以前的版本,需要修改vars文件,然后 source 加载一下,新版本可以用 –vars=/path/to/vars 或者完全靠命令行参数传参。
vars文件需要配置,可以看文件注释,给一个参考的版本。

Continue reading “Easy-RSA 3 HowTo” »

Easy-RSA 3 HowTo by @sskaje: https://sskaje.me/2015/09/easy-rsa-3-howto/

Incoming search terms: