LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   OpenVPN Client can't ping host by name (https://www.linuxquestions.org/questions/linux-general-1/openvpn-client-cant-ping-host-by-name-433612/)

mrpc_cambodia 04-10-2006 04:08 AM

OpenVPN Client can't ping host by name
 
hi,

I'm using openVPN addon for IPCop as my VPN Solution. from my xp pro pc, I can connect to the OpenVPN server. and I can ping any computer on the VPN server Lan by IP but not by computer name.


What other configuration should I make to be able to ping lan pc by computer name?


THanks,

acid_kewpie 04-10-2006 04:11 AM

well you'll need dns and all that to ping by hostname. sounds like you aren't being given DNS details from the DHCP

farslayer 04-10-2006 12:32 PM

you could also edit the hosts file on the client machine .. but that is a maintainnace headache..
That is why DNS was invented after all, so you didn't have to edit hosts files on evry machine :)

mrpc_cambodia 04-17-2006 03:01 AM

so how to configure on the OpenVPN to provide dns info to the connecting client?

thanks,

mrpc_cambodia

farslayer 04-18-2006 09:30 PM

How to push DHCP options (DNS) to openVPN Clients
http://openvpn.net/howto.html#dhcp

DNS How-to
Simple
http://www.linuxhomenetworking.com/l...dns-static.htm
More detailed info
http://langfeldt.net/DNS-HOWTO/BIND-9/DNS-HOWTO-5.html

begleysm 07-09-2019 06:39 PM

Your `/etc/resolv.conf` file defines where your computer should look to resolve hostnames into IP addresses. The basic problem is that `/etc/resolv.conf` doesn't get updated when you run `openvpn` by default.

Here's what you need to do to fix the problem.

1.) Append the following onto your `server.conf` file on your OpenVPN server machine (typically located at `/etc/openvpn/server.conf`) to have the server to the client where to look to convert hostnames to IP addresses.

push "dhcp-option DNS 192.168.1.1"
push "dhcp-option DOMAIN mylocaldomain.lan"



2.) Install `resolvconf` on your client machine and link the standard `resolv.conf` to `resolvconf`'s version with the following commands to have a function capable of modifying `resolv.conf`

sudo apt install resolvconf
sudo mv /etc/resolv.conf /etc/resolv.conf.orig
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf


3.) Append the following to the bottom of your `client.ovpn` file to run `resolvconf` whenver the OpenVPN server is connected to or disconnected from.

up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf


4.) Whenever you run `openvpn` you'll have to do so with the `-script-security 2` flag to allow `openvpn` to run `resolvconf`. Here is an example call

sudo openvpn --script-security 2 --config /path/to/client.ovpn


You can read a more detailed version of the above instructions with some example code of my (working) OpenVPN server here: https://steamforge.net/wiki/index.ph..._%26_hostnames


All times are GMT -5. The time now is 11:30 AM.