Route 2 Openvpn Connections
Im new to the linux world, so my skills are limited. First of all, soory for my bad english. I have a bigger problem with my linux server, and hope you guys can help me out.
A Month ago i rented a virtual root server (Ubuntu Server 64-bit), with 2 IPs. I have one physical interface (NIC), and tun/tap is enabled for use as proxy or vpn, exactly what i need. The server works perfect, no problems, issues or something.
What I have done so far:
I created a virtual network interface eth0:1 with the second IP. I installed openvpn and configured to use the second interface. With ip forwarding enabled, and with my own created iptables rule: iptables -t nat -A POSTROUTING -o eth0 --source 10.8.0.0/24 -j SNAT --to [MyServerIP], i got network access. So my Openvpn server works fine.
What i try to do:
I use a VPN Provider, where i got a vpn-config file and the ca's crt's. My goal is to route the traffic from my own vpn server from the second interface to the vpn tunnel of my provider.
eth0: WanAddress. <- Servers Output
eth0:1: WanAddress2. <- Servers Openvpn Input (Where i connect to)
tun0: My openvpn interface.
tun1: The openvpn interface of my provider.
I wrote a shell script to start both openvpn server. First i connect to my openvpn provider, after that i delete the servers default route (which is pointing to the vpn providers gateway), so i can connect to my openvpn server on eth0:1. Both vpns, have different subnets. And both ips on the server are in different subnets too. Is it possible to route all traffic from tun0 to tun1, so i have internet access over my server to my vpn provider? Client --> SERVER --> Openvpn Provider --> Internet. I dont know how the set the routes or how the iptables rules must look like. I would be really happy if somone can help me out.