I need help for some cascade like connection[Solved]
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
I need help for some cascade like connection[Solved]
Hello
sorry for my poor English.
I have a situation that can't solve it by my self. I appreciate you in advanced If you can help me for this situation.
here in our country every things are blocked.
I used Softether with cascading connection between a vps in my country and Hetzner for access to free internet and it work pretty well.
the problem is when I use sofether client or openvpn client, national censorship firewall knowing it by some how and lowering the connection speed as much as it is not useable any more.
I had and Idea to find what is problem. instead of making cascading connection I make a vpn server inside blocked area and test it if the problem is cascading connection to hetzner or not. and it is not. the connection reduced again up to 100KBs.
I test another vpn server and finally find out that ocserv will connect and connection speed won't reduced any more. I don't know why but it worked.
Now here is the challenge. how can I connect my VPS to hetzner server in order to provide free internet access for OCSERV?
I appreciate any help in advanced
Thank you
sorry for my poor English.
I have a situation that can't solve it by my self. I appreciate you in advanced If you can help me for this situation.
here in our country every things are blocked.
I used Softether with cascading connection between a vps in my country and Hetzner for access to free internet and it work pretty well.
the problem is when I use sofether client or openvpn client, national censorship firewall knowing it by some how and lowering the connection speed as much as it is not useable any more.
I had and Idea to find what is problem. instead of making cascading connection I make a vpn server inside blocked area and test it if the problem is cascading connection to hetzner or not. and it is not. the connection reduced again up to 100KBs.
I test another vpn server and finally find out that ocserv will connect and connection speed won't reduced any more. I don't know why but it worked.
Now here is the challenge. how can I connect my VPS to hetzner server in order to provide free internet access for OCSERV?
I appreciate any help in advanced
Thank you
Last edited by Wubian on Fri Mar 10, 2023 9:03 am, edited 1 time in total.
-
- Posts: 1637
- Joined: Sun Feb 14, 2021 10:31 am
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
-
- Posts: 1637
- Joined: Sun Feb 14, 2021 10:31 am
Re: I need help for some cascade like connection
I am happy to resolve clearly defined VPN issues but writing tutorials is not my thing.
Let's hope that @shakibamoshiri can step in :-)
Let's hope that @shakibamoshiri can step in :-)
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
here is an exact solution for my situation already solved in this forum. can somebody make it simple to understand for me?
https://www.vpnusers.com/viewtopic.php?t=67958
https://www.vpnusers.com/viewtopic.php?t=67958
Code: Select all
old workflow
# open connect
client =======> server X (OC)
# SE
client =======> server A (SE) =======> server B (SE)
new workflow
client (open connect) =======> server A (SE + OC) =======> server B
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
-
- Posts: 289
- Joined: Wed Dec 28, 2022 9:10 pm
Re: I need help for some cascade like connection
Please tell me know how do connect your domestic VPS (=hop-1) to Hetzner VPS (=hop-2) ?
In case of setting up a double VPN using Linux (e.g Debian 11) you have these options
1.. iptables PREROUTING = port forwarding
- simple to setup but does not work in all networks and data-centers
2. running a VPN client on hop-1 to tunnel traffic to hop-2
- not easy to setup but works in any networks (if the tunnel protocol to hop-2 has been blocked)
- you have two options here
2.1 full tunnel from hop-1 to hop-2
- not recommended since all traffic is tunneled so you will be forced to add "ip route" for you SSH, Remote Server, OutBound traffic,etc
2.2. split tunnel from hop-1 to hop-2
- recommended
Q1. which one of above layouts is your condition ?
Q2 what will be used to tunnel from hop-1 to hop-2 ?
- Open Connect
- SoftEther
- or something else ?
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Hello dear Shakiba Moshiri
I really appreciate you for your help in advanced.
Q2: my Hetzner server already configured to work with Softether. I already test cascading connection between hop 1 and hop 2 with Softether and it is fully worked. the problem is censorship firewall reduced my connection from 30Mbps to about 0.7 Mbps when I use Softether.
I tested OCSERC on my domestic VPS and it seems it works better than softether because the connection speed didn't reduced at all. but how should I connect my domestic VPS (with OCSERV) to my Hetzner VPS? I have no Idea.
so the answer for Q2 is: every thing which do the job is great. But I think If I can config ocserv to use the internet provided by Cascading softether servers, it will do the job. something like this:
I can test every setting you may provide on these servers and rebuild them if needed as I don't have any critical information on them.
Thank you in advanced
I really appreciate you for your help in advanced.
Q1: split tunnel from hop-1 to hop-2 as you recommended.shakibamoshiri wrote: ↑Sat Feb 25, 2023 2:54 pmPlease tell me know how do connect your domestic VPS (=hop-1) to Hetzner VPS (=hop-2) ?
Q2: my Hetzner server already configured to work with Softether. I already test cascading connection between hop 1 and hop 2 with Softether and it is fully worked. the problem is censorship firewall reduced my connection from 30Mbps to about 0.7 Mbps when I use Softether.
I tested OCSERC on my domestic VPS and it seems it works better than softether because the connection speed didn't reduced at all. but how should I connect my domestic VPS (with OCSERV) to my Hetzner VPS? I have no Idea.
so the answer for Q2 is: every thing which do the job is great. But I think If I can config ocserv to use the internet provided by Cascading softether servers, it will do the job. something like this:
Code: Select all
client (open connect) =======> server A (OCSERV) =======> Server A (cascading softether server) =======> server B (Softether server)
Thank you in advanced
-
- Posts: 289
- Joined: Wed Dec 28, 2022 9:10 pm
Re: I need help for some cascade like connection
In DataCenters we have
- symmetrical traffic (1 to 1) => send and receive are equal
- asymmetrical traffic (10 to 1) -- country to country it can be different -- send is 10x than receive
by the way
- "send" means your download from the VPS
- "receive" means your upload to the VPS
When you use a double VPN
- your client traffic is asymmetrical (10 to 1)
- your hop-1 traffic is symmetrical (1 to 1) -- hop-1 to hop-2 -- send and receive are equal
- your hop-2 traffic is asymmetrical (10 to 1)
Since symmetrical traffic is usually used for routers not VPSs , simply and easily Web Hosting providers and DataCenters can detect that VPS behaves like a router, so it does a sort of "traffic or port forwarding" thus some / many of them disallow and warn users about "traffic or port forwarding" when users buy a VPNs from them.
Some Hosting are more smart, they know users ignore this warning and buy a VPS, they monitor users VPS traffic and when it became 1 to 1, they reduce the VPSs link to some lower speed e.g. 10M/bps or maybe 5M/bps.
Conclusion
I guess the issue is not the software you use (ocserv, openvpn, softether) it is the hosting company or datacenter. (I can be wrong, since I am not 100% sure)
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
so could you please help to configure this scenario?shakibamoshiri wrote: ↑Sat Feb 25, 2023 3:49 pmI guess the issue is not the software you use (ocserv, openvpn, softether) it is the hosting company or datacenter. (I can be wrong, since I am not 100% sure)
Code: Select all
client (open connect) =======> server A (OCSERV) =======> Server A (cascading softether server) =======> server B (Softether server)
Server A have two part I think. Part A(ocserv) configured and work well. part B is the problem I have. how to force ocserv to use internet coming from softether server?
-
- Posts: 289
- Joined: Wed Dec 28, 2022 9:10 pm
Re: I need help for some cascade like connection
relatively easy to setupWubian wrote: ↑Sat Feb 25, 2023 3:49 pmCode: Select all
client (open connect) =======> server A (OCSERV) =======> Server A (cascading softether server) =======> server B (Softether server)
Let go ahead first with OC on hop-1
assumptions
- OC server is up and running on hop-1
- IPv4 network is 192.168.200.0/24
then
ocserv.conf network setting
Code: Select all
ipv4-network = 192.168.200.0
ipv4-netmask = 255.255.255.0
Code: Select all
iptables -t nat -A POSTROUTING -s 192.168.200.0/24 -m comment --comment openconnect-nat-rule -j MASQUERADE
if done, go to next
Lets go ahead to configure SE server on hop-1
assumption
- SE server hop-2 IPv4 network is 192.168.30.0/24
- SE server hop-2 IPv4 range for DHCP is 192.168.30.10 - 192.168.30.200
- SE server hop-2 IPv4 gateway is 192.168.30.1
then
- go to SE server manager (for hop-1 = domestic VPS) or via "vpncmd" create a Local Bridge for that HUB (e.g VPN, DEFAULT, etc)
-- Local Bridge type is soft tap
-- Link your HUB to that name you want to create
- using "ip address" add a static address to tap devices you created
Code: Select all
ip addr add 192.168.30.9/24 brd + dev tap_xxx
At this point you should be able to ping the gateway of hop-2 which is 192.168.30.1
Code: Select all
ping -c4 192.168.30.1
Now we need to route OC traffic (just OC) to SE server-1 Local Bridge (e.g. tap_xxx).
For this we can use a custom routing table for just tap_xxx we have. This is called Policy Based Routing (= PBR)
first add a table mapped to a name
Code: Select all
echo 1000 vpn >> /etc/iproute2/rt_tables
Now we have a custom table 1000 named "vpn"
Code: Select all
ip rule add from 192.168.200.0/24 lookup vpn
We just have been left to add a default route for our custom table 1000 (= vpn)
Code: Select all
ip route add default via 192.168.30.1 dev tap_xxx proto static table vpn
and "tap_xxx" is the local bridge you created
Recap
1. OC clients connect to OC server on hop-1
2. OC traffic of 192.168.200.0/24 goes to custom table 1000
3. default route for custom table 1000 is default gateway of SE server hop-2 (192.168.30.1)
4. tap_xxx is a local bridge connected to your HUB of SE server hop-1 which cascaded to SE server hop-2
that is it
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Dear Shakiba
I appreciate you so much.
I know you are so busy and still consume huge time to Help people. I know this tutorial taking lot of your time.
Thank you so much. you are brilliant. I thank you so much.
and Yes! It is working!!!
I appreciate you so much.
I know you are so busy and still consume huge time to Help people. I know this tutorial taking lot of your time.
Thank you so much. you are brilliant. I thank you so much.
you made it easy for me because as an Industrial designer, dealing with Linux code is exactly like talking to an alien creature!
and Yes! It is working!!!
Regardsshakibamoshiri wrote: ↑Sat Feb 25, 2023 6:31 pmWubian wrote: ↑Sat Feb 25, 2023 3:49 pmCode: Select all
client (open connect) =======> server A (OCSERV) =======> Server A (cascading softether server) =======> server B (Softether server)
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Helloshakibamoshiri wrote: ↑Sat Feb 25, 2023 6:31 pmCode: Select all
ip addr add 192.168.30.9/24 brd + dev tap_xxx
Code: Select all
ping -c4 192.168.30.1
Code: Select all
echo 1000 vpn >> /etc/iproute2/rt_tables
Code: Select all
ip rule add from 192.168.200.0/24 lookup vpn
Code: Select all
ip route add default via 192.168.30.1 dev tap_xxx proto static table vpn
I face a little issue. do you know why these code seems to be gone after every reboot?
after every reboot I should use all of them to get the system work properly.
Thank you much
-
- Posts: 289
- Joined: Wed Dec 28, 2022 9:10 pm
Re: I need help for some cascade like connection
search for make ip route permanent linux
- https://www.mybluelinux.com/debian-perm ... ic-routes/
- https://www.xmodulo.com/how-to-add-a-st ... linux.html
- https://unix.stackexchange.com/question ... nent-route
- and more
- https://www.mybluelinux.com/debian-perm ... ic-routes/
- https://www.xmodulo.com/how-to-add-a-st ... linux.html
- https://unix.stackexchange.com/question ... nent-route
- and more
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Hello dear ShakibaMoshirishakibamoshiri wrote: ↑Sun Feb 26, 2023 9:20 pmsearch for make ip route permanent linux
- https://www.mybluelinux.com/debian-perm ... ic-routes/
- https://www.xmodulo.com/how-to-add-a-st ... linux.html
- https://unix.stackexchange.com/question ... nent-route
- and more
I thank you so much for your help. finally I can setup my server based on your help and guidance. the last part seems to be most simple part but take 2days for me to figure it. the problem was that ubuntu don't use interfaces file any more and use netplan instead.
again I appreciate all your help.
Thank you so much
Regards
-
- Posts: 289
- Joined: Wed Dec 28, 2022 9:10 pm
Re: I need help for some cascade like connection
Good, no problem.
I forgot to tell that you can use cron-job @reboot keyboard to set one time action after each reboot.
It could be more cross-platform if you need to have settings in different distributions.
I forgot to tell that you can use cron-job @reboot keyboard to set one time action after each reboot.
It could be more cross-platform if you need to have settings in different distributions.
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Hi Dear ShakibaMoshirishakibamoshiri wrote: ↑Wed Mar 01, 2023 10:16 pmGood, no problem.
I forgot to tell that you can use cron-job @reboot keyboard to set one time action after each reboot.
It could be more cross-platform if you need to have settings in different distributions.
your cron-job suggestion is far better than direct editing of netplan configuration. finally I learned how to use cron-job and use it for my case.
I have another question about IPv6 but since it is another issue I will create a new topic for that.
I thank you so much for all your help. based on your help and information my server fully working now.
I appreciate you
Regards.
-
- Posts: 16
- Joined: Sat Feb 25, 2023 12:18 pm
Re: I need help for some cascade like connection
Hi Dear ShakibaMoshirishakibamoshiri wrote: ↑Wed Mar 01, 2023 10:16 pmGood, no problem.
I forgot to tell that you can use cron-job @reboot keyboard to set one time action after each reboot.
It could be more cross-platform if you need to have settings in different distributions.
your cron-job suggestion is far better than direct editing of netplan configuration. finally I learned how to use cron-job and use it for my case.
I have another question about IPv6 but since it is another issue I will create a new topic for that.
I thank you so much for all your help. based on your help and information my server fully working now.
I appreciate you
Regards.