Website self hosting using a dynamic domain name service (DDNS)
This post explains how to setup a self hosted website using a dynamic domain name service on the internet.
This is done in 3 steps:
- Reserve a local IP address for your local server
- Define your domain name in a ddns service on the internet
- Route the incoming HTTP traffic on your router to your local web-server
- Synchronize the IP Internet address of your router withe the DDNS
Let's comment the four steps above and illustrate a common topology for home networks with the following diagram.
Reserve a local IP address for your server
First of all, you have to reserve an IP address for your local web server, so the router knows every time where to route incoming http traffic from the Internet. This configuration is done inside the router. Internet routers usually have a web administration interface that you can access by typing the local network address of the router in a web browser (192.168.10.254 in the example above). You then have to reserve the IP address of your choice in the router using a mapping between the mac address of the network interface card of your web server. (IP address 192.168.1.1 is reserved for mac address 00:13:36:0F:AC:D9 in the example above). This setting ensures the web server will get 192.168.1.1 IP address every time the web server is restarted.
Define the domain name in the ddns service
This step is required if you do not have a fixed IP address from your Internet service provider (ISP). This is the case most of the time. Remember it could happen the router Internet IP address given by the your ISP renews when a router is powered on
There are many free DDNS services for non commercial use that ensure the link between your domain name and the current Internet IP address of your router (for example www.dnsdynamic.com). You just have to setup an account and then give a unique name (that is not already in use by another website) for your domain and enter the Internet IP address given by your ISP when the router powered on. Also assume the dnsdynamic.com shown as example is able to capture the Internet IP address of your Internet router, so you do not have to care about it.
Note you can define multiple domains to be hosted by a single web server. You can for example define multiple virtual hosts in Apache configuration to support the corresponding domain you reserved from your DDNS provider
Routing the the Internet incoming HTTP traffic to your web server
HTTP traffic from the Internet usually comes through port 80. You have to route this traffic to your web server using its web administration interface. Find the application settings inside the router and define the external and internal port to "80", the protocol to "TCP" and finally the IP address of your web server as destination (you are now sure the IP address of your web server is always the same).
Synchronize the router IP address with the DDNS on a regular basis
DDNS providers usually offer for free a utility that refresh the DDNS with the current Internet IP address of your router. Install this on your server and schedule it to be started each time the server is started.
Get in touch!
We'd love to hear from you, what you think about this page or what we can do for you.Contact Us