It's easy to add DNS host DNS (type A) to have a good information returned in your domain if you search by the name the host to work with.
For example, I have to work in domain called MyDomain.local so I've a server which works with a new one.
How could I work with it if I know the name of the server and not is IP Address ?
If you ping the name, for example MyNewServer.MyDomain.local, I'll receive no answer... No host was found and my machine doesn't have the possibility to resolve the IP Address linked to this machine.
So, in a enterprise domain we put some informations in DNS.
We will see how to add two type of informations :
Type A to link Host name to an IP Address. (Forward DNS)
Type PTR to link the IP Address to an host. (for Reverse DNS)
With this two type of informations I'll be able to search and find an information by the name or by the IP address.
To do that it's easier to use nslookup command like it :
nslookup MyNewServer.MyDomain.local
or
nslookup IPaddress
The result will give me informations on my targeted server.
If it's don't work refresh your information in DNS servers and your local machine.
To add the two types :
dnscmd DNSserver /recordadd YourDomain.local MachineName A IPaddress
dnscmd DNSserver /recordadd FirstIPnumber.in-addr.arpa FourthIPnumber.ThirdIPnumber.SecondIPnumber PTR MyServerName.Yourdomain.local
Sometimes you will need to use an alias name to be sure user doesn't forget the name. For example I've create a farm of web servers. I mixed some of them to published an internal website to relate some activities on my company.
All of my server names are ugly to understand and memorized, so I put an alias name for activities called Activities.MyDomain.local.
They don't have to know the name of the servers and I let them type the name on their browsers "activities" and they access to it.
To do that the command is :
dnscmd DNSserver /recordadd aliasname.MyDomain.Local. CNAME truename.YourDomain.Local
Caution : Don't forget the dot in the end of your alias name...
To delete your old informations or correct it with new one, you could use also the dnscmd command as it :
DnsCmd DNSserver /RecordDelete YourDomain.Local ServerName.YourDomain.Local A IPaddress
If you want to script it, go to Powershell section...
I'll provide some examples.