How to check if port forwarding is enabled

dnsfirewallport-forwardingSecurity

I have just set up a DNS server for my own network, and many guides online suggest to make sure that port forwarding on port 53 is not enabled.

The thing that is not clear to me is this: should I configure this at the router level or at the firewall level? If I should do this on the firewall, how would I go about doing this on an Ubuntu Server 12.04?

My home network has a few clients, an ESXi server and a home router. One of the VMs inside ESXi is the DNS server (running on Ubuntu Server 12.04) which is used to handle local DNS requests but is also configured as to forward requests for external IPs to Google's DNS servers.

Best Answer

This should be configured on whatever equipment you have between the DNS server and the outside world. AFAIK port forwarding is disabled by default on pretty much everything so you shouldn't worry too much about it. If you're using residential network gear, there should be port forwarding configuration options in the web interface. To check the port forwarding settings on Ubuntu use iptables:

$ sudo iptables -t nat -vnL

To ultimately check your network for the forwarded port use netcat to connect to the port via your external IP:

$ nc -vu [external ip] 53

You'll have to monitor the connections on the DNS server to watch for the netcat connection because netcat may incorrectly report that the connection was successful due to the stateless nature of UDP

Related Question