Mapping domain name with local IP address?

13,386

Solution 1

A domain such as example.com has various records, such as the A record and MX records.

These records redirect traffic to a location. Where that location is doesn't matter.

If you setup the A record for example.com to point to your public IP address (the ip address provided by your ISP) then anyone who enters example.com can find its route to your modem.

It is then up to your modem to tell the traffic where to go next. If your modem is not also a router, the modem will simply redirect everything to the router behind it. The router then needs to have a port mapping that tells where the traffic needs to go to.

Given that websites use HTTP traffic, which by default is set to port 80, you need to forward port 80 to the local ip address where the webserver is located. If you host the webserver on your own computer, then you setup port 80 to the ip address of your local computer.

That said, this will continue to work until your IP address changes. If that happens you need to update your domain's A record to point to the new IP address. There are services that allow you to do this for you, but bringing your own domain is often a premium feature. In addition, using your own webserver at home means that you will lose internet speed.

If these problems are something you want to avoid, it is probably going to be cheaper to get a cheap webhosting. Most of the time, they include a free domain too.

That said, to answer your questions:

My question is Once I get domain name (say testWebsite.com) from domain name providers, Can i say them map it to my machine IP address where web application is deployed or it has to be deployed on their environment ?

You can map it to anything, including your own ip address, as long as you have control of DNS records (this is something you need to make sure, in case you go for webhosting + domain. If you only go for a domain, it is always going to provide DNS management.)

Also Do I ahve to provide this mapping at the time of domain registration or it can be done later as well ?

No, you do not have to provide this mapping at the time of the registration. Until you do, the domain will simply not forward or more likely forward to the website of the registration party. You can change it at any time if you please to whatever you want. Keep in mind that changing DNS takes time. You change it instantly at the location of the provider, but other DNS servers must then query and update the records. Given that there are over a million of DNS servers all around the world, it can take up to an hour before the changes are processed in your contry, and up to 48 hours until it is done all over the world.

Solution 2

1: You have to provide the IP of the server where your app is deployed. The location of the server is not important. He could be in your house or in a datacenter in another country. (Some datacenter provider take care of the DNS stuff for you)

2: The concrete process to register a domain depends obviously on the chosen domain name registrar. But you don't need one static IP adress, since there are methods to dynamically update the IP of an DNS entry.

Share:
13,386

Related videos on Youtube

user3198603
Author by

user3198603

Updated on September 18, 2022

Comments

  • user3198603
    user3198603 over 1 year

    On a local machine I can map my machine IP address with some domain like below:

    127.0.0.1       testwebsite.com
    

    My question is once I get a domain name (say testwebsite.com) from a domain name provider, can I say to them "map it to my machine IP address where my web application is deployed" or does it have to be deployed on their environment?

    Also, do I have to provide this mapping at the time of the domain registration or can it be done later as well?

    • Anaksunaman
      Anaksunaman almost 6 years
      You may wish to look at Namecheap for your DNS provider. They have a FreeDNS service which can often be used with a domain you own. Importantly, they offer a free Dynamic DNS Client (and alternatives) to anyone who uses their DNS services. This client lives on your PC and notifies them if your IP changes so you don't have to update your DNS records manually.
  • user3198603
    user3198603 almost 6 years
    When you say Some datacenter provider take care of the DNS stuff for you, I believe you mean some data center provides webhosting and Domain name registration both ?As evertime i restart modem, Dynamic ip changes. Also can you elaborate how it is updated in DNS servers automatically ?
  • user3198603
    user3198603 almost 6 years
    Say my site(testWebsite.com) is hosted at port 9001 and I want end user just types www.testWebsite.com not www:testWebsite.com:9090, Do I need to specify port number also in DNS server ? Second point is as everytime i my modem, Dynamic ip changes. Also can you please elaborate how it is updated in DNS servers automatically or it has to be done manually? Even if it is done automatically, you said it will update only some DNS servers, not all (which will take time). It means if call goes to those DNS servers, my site will be unavailable ?
  • LPChip
    LPChip almost 6 years
    You can setup a port forward on your router to forward traffic from public port 80 to local port 9001, and it will work. DNS servers don't use ports, only ip addresses. Changes of the modem ip address is a big subject. I didn't say only some DNS servers are updated. I said it propogates as a ripple to all DNS servers, and that process takes time. And yes, the moment your IP Address changes, no matter what, your site will become unavailable for a short period of time, until the new ip address is set to the DNS server and its propagated.