Associating an IP address to a domain is the job of DNS. You need to register a DNS domain name with a domain provider and then point the domain to your external IP address.
If you just want to test out using a temporary domain, you can modify your hosts
file with the domain name and IP address. So, for example, if your IP address was 1.2.3.4 and your domain was www.example.com, you would add the following line into your hosts
file:
1.2.3.4 www.example.com
Your hosts file is in different locations, depending on the operating system that you are using:
- Windows -
C:\Windows\System32\drivers\etc\hosts
- Linux -
/etc/hosts
- MacOS -
/etc/hosts
Remember: You need to be root
or administrator
if you want to edit this file