0

I have tried to setup a small openvpn network but I ran into one big problem. I have a server and a machine at home. So I created a openvpn server on my machine and a configured the client on the other machine.

Ping and anything else work fine. But now I am trying to setup an openvpn client on the server which connects to itself. The server uses tun0 and the client tun1. If I check ifconfig, anything is setup correctly and the server interface has the ip 10.0.0.1 and the client on the server 10.0.0.10.

My other machine (10.0.0.13) can only ping the service instance and not the client instance on the server.

Why I want this: This network should contain 10-15 machines which use vpn for different services. When I move the vpn server, I have to change the ips on every machine because 10.0.0.1 is only for servers.

Question 1:
May I able to give the server instance an additional ip, so I have not to run a seperate client? (Server has 10.0.0.1 and 10.0.0.10 as ip)?

Question 2: May I use DNS for this? So I only use hostnames which are looked up. Then the ip can change. How can I do this

Thank you!

1 Answers1

0

You could use a lightweight DNS server light dnsmasq for that. The dnsmasq server would run on any machine that is also connected to the VPN and you would push the IP adress of the DNS server using openvpn:

push "dhcp-option DNS 10.0.0.4"

The DNS server would then resolve hostnames to IP addresses by configuring it in your dnsmasq.conf file:

dhcp-host=01:BD:43:B9:11:AF,10.0.0.4,myserver

Don't forget to add these lines to your client config:

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
schneida
  • 339
  • 1
  • 4
  • 16
  • Yeah, I found out, that it uses my hosts file too right? But I can solve hostnames on the server but on the client it doesn't work. There is no entry in the resolv.conf of the client too. –  Oct 14 '15 at 19:49