L2TP + IPSec을

화웨이 클라우드 ECS 베타

libreswan 설치 -y

냠 설치 xl2tpd -1.3.8-2 .el7 .x86_64 .rpm을

1 정력 /etc/ipsec.conf

CONN의 L2TP-PSK
rightsubnet = 가상 호스트 : %의 PRIV
도 = L2TP-PSK-nonat
CONN L2TP-PSK-nonat
authby = 비밀
PFS = 아니오
자동차 = 추가
keyingtries = 3
리키 = 더
ikelifetime = 8 시간
keylife = 1 시간
유형 = 수송
= 192.168 남아 있지 .2.20服务器IP
leftprotoport = / 17 1,701
오른쪽 = % 어떤
rightprotoport = 17 / % 어떤
dpddelay = 40
dpdtimeout = 130
dpdaction = 맑은
SHA2-truncbug = YES

2 정력 /etc/ipsec.secrets

192.168.2.20 %의 어떤 : PSK "jiangxin"사전 설정 키

3 정력 /etc/xl2tpd/xl2tpd.conf   

청취 요지 = 192.168.2.20  

IP 범위 = 192.168.3.1-50
로컬 IP = 192.168.2.20

4 정력 /etc/ppp/options.xl2tpd

MS-의 DNS 8.8.8.8
필요-MSCHAP-V2

#crtscts

#자물쇠

5 정력 / / PPP / CHAP의 -secrets

테스트 * 테스트 * # 암호 구성

6 VIM /etc/sysctl.conf의

net.ipv4.ip_forward의 = 1
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf .eth0.accept_source_route = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.eth0.send_redirects = 0
net.ipv4.conf.eth0.rp_filter = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.lo.send_redirects = 0
net.ipv4.conf.lo.rp_filter = 0

net.ipv4.conf.ip_vti0 / rp_filter = 0

sysctl을 -p 유효한 구성

구성 IPSec을 모두 확인을 확인보기

의 iptables -A POSTROUTING -t NAT -s 192.168.3.0/24 -j SNAT --to 192.168.2.20 

의 iptables -A FORWARD는 192.168.3.0/24 -p TCP의 -m의 TCP의 --tcp-플래그, RST SYN -j TCPMSS --set-MSS 1200 SYN을 -s 

서비스에서 IPSec을 다시 시작 systemctl

서비스에서 xl2tpd를 다시 시작 systemctl

 

SS -nutlp | 그렙 명왕성

SS -nutlp | 그렙 xl2tpd 

 

추천

출처www.cnblogs.com/jianxgin/p/11387677.html