1

I have a PC connected to my ubuntu OpenVPN server.

what I'm trying to do is making google.com resolve to my IP address instead of Google IP address when I browser google.com on my client pc.

Attempts

I have tried editing the hosts file on my openVPN server and I was pretty sure it will not work.

Also I tried to get domain IP address and redirect it using iptables but it didn't work as well.

I think that I need to have a dns server or something easier, any suggests?

Note: I don't want to edit my hosts file on client pc.

2

Setup DNSMasq on the VPN server and have it override google.com using an address directive

address=/google.com/192.0.2.2/

Substitute your IP address as appropriate.

Push DNS server information to the client such that it will use the VPN server as it's DNS server.

push "dhcp-option DNS 10.0.10.1"

Where 10.0.10.1 is the address of your OpenVPN interface.

  • should I add address=/google.com/192.0.2.2/ to /etc/dnsmasq.conf right? how do I get my openVPN interface? – Adam Dec 31 '18 at 18:41
  • Yes and erm it's whatever you set it up to be tun0 ??? On Linux ip address show would list it while OpenVPN is running – Iain Dec 31 '18 at 18:43
  • Thanks for your help, I have installed DNSMasq from this tutorial and added address=/google.com/192.0.2.2/ to /etc/dnsmasq.conf then on my client openVPN config file added push "dhcp-option DNS 10.0.8.1" but it didn't work :( – Adam Dec 31 '18 at 18:57
  • ...It didn't work :( is a useless statement. You'll just have to roll up your sleeves, dust off you scientific method and apply your sysadmin skills to solving the problem yourself. – Iain Dec 31 '18 at 19:02
  • @lain you are right, I'm sorry, I thought we've just missed something or I did something wrong so added work summary in my comment. I'm already rolled up my sleeves and trying hard to solve the problem and asking you for your help. – Adam Dec 31 '18 at 19:10

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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