Rerouting openvpn traffic via v2ray dokodemo-door protocol
by kikilinux from LinuxQuestions.org on (#6P60E)
Hi,
I have a ubuntu server with openvpn server and v2ray/xray installed.
Clients/Users connect to the openvpn server using openvpn client app.
The v2ray package is connected to a foreign v2ray server.
I want to redirect client openvpn traffics via v2ray, actually I want for example to redirect output traffics from tun0 to local port that is docodemo-door protocol listen after that v2ray handle traffic to foreign v2ray server.
I found this iptables rules
PHP Code:iptables-tnat-F
iptables-tmangle-F
#Createnewchains
iptables-tnat-NV2RAY
iptables-tmangle-NV2RAY
iptables-tmangle-NV2RAY_MARK
#IgnoreyourV2Rayserver'saddresses
iptables-tnat-AV2RAY-dMYSERVERIP-jRETURN
#IgnoreLANsandanyotheraddressesyou'dliketobypasstheproxy
iptables-tnat-AV2RAY-d0.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d10.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d127.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d169.254.0.0/16-jRETURN
iptables-tnat-AV2RAY-d172.16.0.0/12-jRETURN
iptables-tnat-AV2RAY-d192.168.0.0/16-jRETURN
iptables-tnat-AV2RAY-d224.0.0.0/4-jRETURN
iptables-tnat-AV2RAY-d240.0.0.0/4-jRETURN
#RedirectTCPtraffictoDokodemo-door
iptables-tnat-AV2RAY-ptcp-jREDIRECT--to-ports1010
#HandleUDPtrafficwithTPROXY
iptables-tmangle-AV2RAY-pudp!--dport53-jTPROXY--on-port1010--tproxy-mark0x01/0x01
#Setuppolicyroutingformarkedpackets
iprouteaddlocaldefaultdevlotable100
ipruleaddfwmark1lookup100
#MarkUDPDNSpackets
iptables-tmangle-AV2RAY_MARK-pudp--dport53-jMARK--set-mark1
#ApplytherulestoOpenVPNinterface
iptables-tnat-APREROUTING-itun0-jV2RAY
iptables-tmangle-APREROUTING-itun0-jV2RAY
iptables-tmangle-AOUTPUT-otun0-jV2RAY_MARK
but for some scenarios like youtube videos It load some portion of the video but then it cannot load the reminding
I have a ubuntu server with openvpn server and v2ray/xray installed.
Clients/Users connect to the openvpn server using openvpn client app.
The v2ray package is connected to a foreign v2ray server.
I want to redirect client openvpn traffics via v2ray, actually I want for example to redirect output traffics from tun0 to local port that is docodemo-door protocol listen after that v2ray handle traffic to foreign v2ray server.
I found this iptables rules
PHP Code:iptables-tnat-F
iptables-tmangle-F
#Createnewchains
iptables-tnat-NV2RAY
iptables-tmangle-NV2RAY
iptables-tmangle-NV2RAY_MARK
#IgnoreyourV2Rayserver'saddresses
iptables-tnat-AV2RAY-dMYSERVERIP-jRETURN
#IgnoreLANsandanyotheraddressesyou'dliketobypasstheproxy
iptables-tnat-AV2RAY-d0.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d10.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d127.0.0.0/8-jRETURN
iptables-tnat-AV2RAY-d169.254.0.0/16-jRETURN
iptables-tnat-AV2RAY-d172.16.0.0/12-jRETURN
iptables-tnat-AV2RAY-d192.168.0.0/16-jRETURN
iptables-tnat-AV2RAY-d224.0.0.0/4-jRETURN
iptables-tnat-AV2RAY-d240.0.0.0/4-jRETURN
#RedirectTCPtraffictoDokodemo-door
iptables-tnat-AV2RAY-ptcp-jREDIRECT--to-ports1010
#HandleUDPtrafficwithTPROXY
iptables-tmangle-AV2RAY-pudp!--dport53-jTPROXY--on-port1010--tproxy-mark0x01/0x01
#Setuppolicyroutingformarkedpackets
iprouteaddlocaldefaultdevlotable100
ipruleaddfwmark1lookup100
#MarkUDPDNSpackets
iptables-tmangle-AV2RAY_MARK-pudp--dport53-jMARK--set-mark1
#ApplytherulestoOpenVPNinterface
iptables-tnat-APREROUTING-itun0-jV2RAY
iptables-tmangle-APREROUTING-itun0-jV2RAY
iptables-tmangle-AOUTPUT-otun0-jV2RAY_MARK
but for some scenarios like youtube videos It load some portion of the video but then it cannot load the reminding