Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm not sure if my solutions lies in openvpn routing or iptables, but if i explain what i'd like to do, maybe some can help.

I have two open vpn daemons running on different ports. One on 1194, with server ip 10.8.0.1 and one on 1195, ip address 10.9.0.1. I am using two so I can lock down server port access based on the interface (tun0 and tun1) using iptables. This is all working fine, with the first instance supplying services for trusted users and the other locked down to port 80 for less trusted users. I'm running GitLab on nginx which I need to provide for both sets of people.

Now the problem is inside gitlab I have configured it to show all the git links as git://10.8.0.1 etc. These don't make sense to people connecting on the second vpn daemon where the server will be 10.9.0.1.

So, is there a clever use of route in the server configs that will allow the 10.9.0.1 subnet talk to the server as 10.8.0.1. Or can I create a different common ip address for the server that both can use? Or am I in completely the wrong area and I should be considering some iptables routing / masquerading?

Any ideas?

share|improve this question

2 Answers 2

You should "create" another network like e.g. 192.168. 0.0/24 and put your server in this network. Enable ip_forward if needed.

share|improve this answer
    
The server already has an internal address of 192.168.1.252 on it's eth0 adaptor, but I didn't want to create a route to this subnet from the vpn due to the likely conflicts with address ranges on the client side. Is this what you meant? –  microwavesafe Jul 6 '13 at 9:47
    
You could use any other net too, that was just an example ;) –  krissi Jul 6 '13 at 11:14

This turned out to be easier than I thought.

I added

push "route 10.8.0.0 255.255.255.0"

So from the 2nd vpn daemon I can use both 10.9.0.1 or 10.8.0.1 as the server address, so the links in GitLab will work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.