日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

转发pptp和l2tp

發布時間:2023/12/15 综合教程 38 生活家
生活随笔 收集整理的這篇文章主要介紹了 转发pptp和l2tp 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

已知條件: #公司VPN SERVER(106.38.xx.xx)支持windows客戶端使用PPTP,MAC電腦、iphone手機使用l2tp撥入。

問題: 用戶在家或者出差的時候,撥通106.38.xx.xx失敗。

解決方案:使用阿里VPN代理(CentOS 7),用戶將106.38.xx.xx替換成123.57.xx.xx,用戶名和密碼不變。 #阿里VPN代理(123.57.xx.xx),支持windows客戶端使用PPTP,MAC電腦、iphone手機使用l2tp撥入。

#原理:阿里VPN代理TCP、UDP以及GRE流量轉發給后端的公司VPN SERVER,對于客戶端來說只是換個ip。對于server來說流量和速度不變。

l2tp轉發使用socat

pptp轉發使用iptables

 1 [root@localhost ~]# cat /etc/rc.d/init.d/forward-pptp-l2tp.sh 
 2 #/bin/bash
 3 #chkconfig: 35 99 1
 4 #forward to og pptp server
 5 #author qinliang
 6 #date 11/27/2020
 7 
 8 echo 1 > /proc/sys/net/ipv4/ip_forward
 9 modprobe ip_nat_pptp
10 
11 local_ip=192.168.1.176
12 remote_ip=106.38.xx.xx
13 
14 iptables -P FORWARD DROP
15 iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
16 
17 # zabbix access
18 iptables -A INPUT -s 35.xx.xx.xx/32 -j ACCEPT #zabbix-sg.oasgames.com
19 iptables -A INPUT -s 34.xx.xx.xx/32 -j ACCEPT   #zabbix-jp.oasgames.com
20 
21 # forward PPTP
22 iptables -t nat -A PREROUTING -d $local_ip -p tcp --dport 1723 -j DNAT --to $remote_ip
23 iptables -A FORWARD -d $remote_ip -p tcp --dport 1723 -j ACCEPT
24 iptables -t nat -A POSTROUTING -d $remote_ip -p tcp --dport 1723 -j SNAT --to $local_ip
25 iptables -t nat -A PREROUTING -d $local_ip -p gre -j DNAT --to $remote_ip
26 iptables -A FORWARD -d $remote_ip -p gre -j ACCEPT
27 iptables -t nat -A POSTROUTING -d $remote_ip -p gre -j SNAT --to $local_ip
28 
29 # forward L2TP
30 socat -d -d -lf /var/log/socat.log UDP4-LISTEN:1701,bind=0.0.0.0,reuseaddr,fork UDP4:106.38.xx.xx:1701 &
31 socat -d -d -lf /var/log/socat.log UDP4-LISTEN:4500,bind=0.0.0.0,reuseaddr,fork UDP4:106.38.xx.xx:4500 &
32 socat -d -d -lf /var/log/socat.log UDP4-LISTEN:500,bind=0.0.0.0,reuseaddr,fork UDP4:106.38.xx.xx:500 &

總結

以上是生活随笔為你收集整理的转发pptp和l2tp的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。