Sunday, June 4, 2017

Local DNS resolution

We can always run a DNS server and resolve a URL/URI to a specific IP address. But in development  environment there is no point running a beast to resolve url to ip address.

Let's say your URL : myServer.companyName.com
IP address : 10.20.30.40

So there is an easy alternative if you don't want to modify your source code and change the IP address.
You can add entry in /etc/hosts

MacBook-Pro-2:~ Siddheshwar$ sudo vi /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
172.24.1.5 myServer.companyName.com
127.0.0.1        localhost
255.255.255.255 broadcasthost
::1 localhost
#172.24.1.5              abc.sid.com
# BEGIN section for OpenVPN Client SSL sites
127.94.0.1 client.openvpn.net
# END section for OpenVPN Client SSL sites

:wq (enter)
to save



No comments:

Post a Comment