Ports, DNS, Oh My!

This is an answer to a question I wrote for someone trying to get their web server configured. While this isn’t the next part in the Building Modern Church Websites series, it goes into a bit more detail on DNS, and might be useful to those trying to set up a web server for the first time:

I’ll start with the easy question, about ports and port forwarding. You know, I am assuming, that your computer has USB plugs, printer plugs, etc on it, right? You’ve probably also heard them called USB ports, com ports, printer ports, etc. A port is really just another term for a plug.

But what does this have to do with the internet? Well, every time someone wants a web page from your server, they need to connect to it somehow. So, every computer has 65535 internet ports. These are like virtual plugs that various programs connect to, over the internet. A web server, for example, expects your web browser to connect to it using port number 80. Before that can happen, of course, your router and any firewalls in front of your web server need to be configured to allow connections to the web server using port 80. If you’re using a web host like Linode, all of this should have been done for you already, and you don’t need to worry about it. Linode knows you’re running a server, so they allow computers to connect to any of the ports of your Linode. If you chose a Linux distribution like CentOS, or installed a Firewall, though, you will need to configure this somehow. But Linode with Ubuntu should be all ready to go. If you’re having problems connecting to your server, I don’t think port forwarding is the issue.

Note: the above is a simple summery of ports, that doesn’t get into TCPIP and UDP, the workings of packets, NAT, or how a firewall does what it does. If you actually do find yourself needing to configure a firewall, it would be helpful if you gave more details about how your network is configured, and what firewall you’re using, so we can give you more detailed information and instructions.

Now, DNS! This is a complicated topic, and books almost the length of the Bible have been written about it. But to simplify: DNS is a system for storing information about domain names. Each domain name can have many, many different DNS records associated with it, and each record stores a different bit of information about the domain. For example, MX Records store the address of the server that any email delivered to the domain should be sent to. So, if you send an Email to john@example.com, your computer checks DNS for the MX record for example.com, and connects to the server specified in that record to deliver the Email.

Now, when you type example.com into your web browser, it also uses DNS. But instead of asking for an MX record, it asks for an A-record. It expects the A-record to tell it the IP address it should connect to for example.com. So, to make your server accessible by your domain name, instead of just by IP, you need to set the A-record for your domain name to the IP address of your server. Depending on where you purchased your domain, and how you have it configured, the instructions for how to do this can be quite different.

This entry was posted in Sam's Stuff and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *