I have an OpenVPN server running, and I can connect to it and ping its IP address without problems. However, I cannot ping its hostname and have my remote machine resolve the hostname to an IP address. For example, "ping 10.8.0.1" works, whereas "ping hostname" (where hostname is the name of the machine, and can be used to ping it on the local network) does not work.
Any insights anyone might have as to the cause of this would be very helpful. Thanks.
My client config is as follows:
client
dev tun
proto udp
remote example.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
comp-lzo
verb 3
My server config is as follows:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
Resolve Hostnames Over VPN
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
- Traffic
- OpenVPN Protagonist
- Posts: 4066
- Joined: Sat Aug 09, 2014 11:24 am
Re: Resolve Hostnames Over VPN
Resolving hostnames relies on DNS which has nothing to do with OpenVPN.
What DNS server does your client use ?Isonite wrote:For example, "ping 10.8.0.1" works, whereas "ping hostname" (where hostname is the name of the machine, and can be used to ping it on the local network) does not work.
-
- OpenVpn Newbie
- Posts: 8
- Joined: Wed Sep 09, 2015 8:17 am
Re: Resolve Hostnames Over VPN
I am not using any DNS servers other than the default ones for my ISP.
I should've clarified: I'm trying to resolve the names of other clients connected to the VPN.
I was under the impression that there might be a way to resolve hostnames without specifying a DNS server, such as over the Address Resolution Protocol on the local area network (or in this case, the VPN connection). Is this possible using TUN, or do I need to use TAP?
I have tried using "dhcp-option DNS 10.8.0.1" in the client config file, but that does not solve the problem.
I should've clarified: I'm trying to resolve the names of other clients connected to the VPN.
I was under the impression that there might be a way to resolve hostnames without specifying a DNS server, such as over the Address Resolution Protocol on the local area network (or in this case, the VPN connection). Is this possible using TUN, or do I need to use TAP?
I have tried using "dhcp-option DNS 10.8.0.1" in the client config file, but that does not solve the problem.
- Traffic
- OpenVPN Protagonist
- Posts: 4066
- Joined: Sat Aug 09, 2014 11:24 am
Re: Resolve Hostnames Over VPN
Public DNS servers such as your ISP or google 8.8.8.8 et al have no knowledge of your private LAN machines or your VPN clients, so DNS will not work that way.Isonite wrote:I am not using any DNS servers other than the default ones for my ISP
For that to work you must run your own private DNS server.Isonite wrote:I have tried using "dhcp-option DNS 10.8.0.1"
You can also consider your OS hosts file to hold static names.
-
- OpenVpn Newbie
- Posts: 8
- Joined: Wed Sep 09, 2015 8:17 am
Re: Resolve Hostnames Over VPN
Thank you for your responses, Traffic.
Does that mean there is no way to dynamically resolve the hostnames of other machines when I'm connected through OpenVPN? I can resolve the hostnames of machines on my LAN, is there a way to do this with OpenVPN?
I figured that, if I have two machines (e.g. client1 and client2) connected to the same OpenVPN server, and I have client-to-client enabled in the server config, I'd be able to go to client1 and enter "ping client2" and it would work.
Does that mean there is no way to dynamically resolve the hostnames of other machines when I'm connected through OpenVPN? I can resolve the hostnames of machines on my LAN, is there a way to do this with OpenVPN?
I figured that, if I have two machines (e.g. client1 and client2) connected to the same OpenVPN server, and I have client-to-client enabled in the server config, I'd be able to go to client1 and enter "ping client2" and it would work.
-
- OpenVpn Newbie
- Posts: 8
- Joined: Wed Sep 09, 2015 8:17 am
Re: Resolve Hostnames Over VPN
Update: I tried using TAP mode instead of TUN mode and I was able to resolve the hostnames of other clients on the VPN connection. I'm assuming this is just not possible with TUN.