Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I'm trying to get OpenVPN to work on port 53 - sadly this isn't working.

I used IP tables to map port 53 to port 1194 (standard OpenVPN port)

Here's what I run to do this:

iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 1194
iptables -I INPUT -p udp --dport 53 -j ACCEPT

This works as the connection is fine except for when I try to visit new domains! DNS just no longer works at all.

Here's my server configuration:

local #- your_server_ip goes here
port 1194 #- port
proto udp #- protocol
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/ /etc/pam.d/login
push "redirect-gateway def1"
push "dhcp-option DNS"
push "dhcp-option DNS"
keepalive 5 30
#status 1194.log
verb 3

I specify the DNS servers as (Google's DNS Servers) so I don't know why DNS doesn't work!

share|improve this question
up vote 3 down vote accepted

Bind your NAT rule to the IP address openvpn is listening on. Your current rule is intercepting all traffic going through the server with a destination port of 53 (in this case, traffic traversing your tun interface). Always try to make your rules as specific as possible; if you don't, weird things like this will happen.

Try something like this:

iptables -t nat -A PREROUTING -p udp -d -i appropriate_interface --dport 53 -j REDIRECT --to-port 1194

share|improve this answer

i faced this problem too , and solved it by flush the iptables :

sudo iptables -F

then change the listening port number in the OpenVPN Server Admin Panel > Network Settings to 53 , then Update the Server Button , and working for me without any port forwarding or DNS problems , hope it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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