VPN with forced DNS server
Can you setup a VPN server which forces the client to use a specific i.e. local DNS server? Otherwise the client should not be able to resolve domain names. I do not want to involve any proxy servers and I cannot setup DNS servers on the clients themselves. It needs to be done on the server.
If the clients perform DNS
resolution through the VPN
link, you can redirect all requests to port 53
to your server:
iptables -t nat -A PREROUTING -s vpn_network -p udp --dport 53 -j DNAT \
--to-destination your_DNS_server
iptables -t nat -A PREROUTING -s vpn_network -p tcp --dport 53 -j DNAT \
--to-destination your_DNS_server
where vpn_network
is the subnetwork of your VPN clients (e.g. 10.8.0.0/24
, you can also filter by interface instead) and your_DNS_server
is the IP of your DNS
server.
If they resolve hosts through their normal connection, however, you can't do anything.