openwrt使用l2tp

1、配置openwrt

cat > /etc/ipsec.conf <<EOF
# ipsec.conf - strongSwan IPsec configuration file

# basic configuration

config setup
  # strictcrlpolicy=yes
  # uniqueids = no

# Add connections here.

# Sample VPN connections

conn %default
  ikelifetime=60m
  keylife=20m
  rekeymargin=3m
  keyingtries=1
  keyexchange=ikev1
  authby=secret
  ike=aes128-sha1-modp1024,3des-sha1-modp1024!
  esp=aes128-sha1-modp1024,3des-sha1-modp1024!

conn myvpn
  keyexchange=ikev1
  left=%defaultroute
  auto=add
  authby=secret
  type=transport
  leftprotoport=17/1701
  rightprotoport=17/1701
  right=47.100.171.251
EOF


cat > /etc/ipsec.secrets <<EOF
: PSK "xindoo.me"
EOF

cat > /etc/xl2tpd/xl2tpd.conf <<EOF
[lac myvpn]
lns = 47.100.171.251
ppp debug = yes
pppoptfile = /etc/ppp/options.l2tpd.client
length bit = yes
EOF

cat > /etc/ppp/options.l2tpd.client <<EOF
ipcp-accept-local
ipcp-accept-remote
refuse-eap
require-chap
noccp
noauth
mtu 1280
mru 1280
noipdefault
defaultroute
usepeerdns
connect-delay 5000
name Test1
password test1
EOF

chmod 600 /etc/ppp/options.l2tpd.client

ipsec restart
ipsec up myvpn

2、参考

配置l2tp服务器:

https://blog.csdn.net/xindoo/article/details/52830609

配置l2tp客户端:
https://blog.csdn.net/rainforest_c/article/details/71171237
https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#linux

猜你喜欢

转载自blog.csdn.net/ypbsyy/article/details/81325906