What can be done to avoid hosts file entry? - networking

In our organization, we've a in house maven repository say http://mymavenrepo.com to store private artifacts and that is being used across projects.
But recently ip address of machine, where mymavenrepo was hosted, has changed and hence we had to make a change in hosts file with new ip to build maven projects successfully.
My question is why we need to make change in hosts file with changed ip and what can be done to avoid change in hosts file every time ip is changed, like for http://www.google.com, we never have to make entry in hosts file.

Well I would say this is somewhat of a loaded question. The Hosts file on your machine may overwrite a DNS query because it is the first file that a computer reads to find a domain. The Hosts file essentially acts as the DNS in the sense that it translates IPs to Domains.
Now, I am assuming that the local repository is a private repository or in other words NOT published on the internet. Which I might be wrong, but that would mean that it might have a private IP address accessible only to the local network which would make it reasonable to stay in the hosts file. If it DID have a public address, or accessible to the outside internet, then removing its entry from the hosts file would allow for the DNS to query it.
My suggested solution here based on my local-local assumption is to SET a static IP to the repository and exclude it from the DHCP server so it doesn't change. The way to do that depends on the solution you have and the underlying OS.

Related

How do we get public IP history

I got my public ip by www.whatismyip.com, but it changed every modem restart. Any hope to get a list of public ip as history.
Kindest Regards,
There are three ways I can think of to achieve this:
Router Logs
External DNS Service
Custom Tool
Router Logs
This is highly dependent on the model of your router and what it stores. Consult your router's documentation for more specific instructions.
External DNS Service
This would be the easiest to do. On your router you would configure a dynamic DNS service such as No-IP, DynDNS, etc.
I am not sure about DynDNS, but for No-IP, they have 90 days of IP address history for their "Plus Managed DNS" paid plan.
Custom Tool
If you are tight on budget, you could write a script that pulls the results of www.whatismyip.com or a similar service every time you turn your PC on or on a regular schedule.
The simplest address to pull would be to download http://checkip.dyndns.org which is a page with "Current IP Address: 155.143.XXX.XXX" as it's content. Download the file, check if the last one is different, if different, save to a CSV file. There are various grievances to this, but it's free and could be done with a simple script.
If http://checkip.dyndns.org is too simple, you can also use https://ifconfig.co

How to operate Active Directory with DNS on another computer?

Is it possible to operate Active Directory while the DNS server is running on another computer ? or it should be installed exactly on the Active Directory running computer ? thnx.
No this is not possible.A DNS zone is the contiguous portion of the DNS domain name space over which a DNS server has authority or is authoritative.In all DNS is the authority level registration.
You cannot install Active Directory without having DNS on your network, because Active Directory uses DNS as its location service.
However, you can install DNS separately, without Active Directory. If you install DNS on a domain controller, you can also choose whether or not to use Active Directory to provide storage and replication for DNS. Using Active Directory for storage and replication provides some benefits like :
Increased fault tolerance, Security, Easier management, More efficient replication of large zones.
Have a look to Setting Up DNS for Active Directory.

Subdomains. How do you do development with subdomains?

I am currently building an web app which also utilizes websockets. (Rails for webserver and Nodejs for socket.io)
I have structured my application to use subdomains to separate between connection to the Nodejs server and the Rails webserver. I have "socket.mysite.com" redirected to the Node server and everything else to the webserver.
I am able to test this functionality on localhost. I simply modified my /etc/hosts to include the following:
127.0.0.1 socket.mysite.com
127.0.0.1 mysite.com
I know that on production I simply have to generate a CNAME record for socket.mysite.com and this will also work on my users' computers.
However, I am accustomed to testing my application by passing an IP address around. My team typically set up the server on our own machines and do development. When we want to test our individual servers, we just pass around an IP like "http://123.45.123.45".
With the new subdomain hack, this is no longer possible without modifying each of my tester's /etc/hosts. I honestly don't expect my testers to modify their /etc/hosts on the spot. What I can do is have each member of my team have their own domain and create the appropriate CNAME records for each individual team member.
Is there an easier way to allow me to run my app on an IP and just pass that IP around?
It sounds like your needs have scaled beyond the days of just simply editing a host file. While you could continue to have everyone on your team continue to edit host files, there are two main risks that I see here:
For your idea to just use IP Addresses, you risk missing something in testing that you wouldn't see unless you were on production, as the issue may be dependent on something in the domain configuration.
For using host entries, you introduce a lot of complexity and unnecessary changes to each developer and tester's configuration, which of course leaves the door open for mistakes, and it also takes time that will add-up over the long term.
Setting up a DNS server may be helpful in your case. You could map a set of domains for each developer that match a certain pattern so that your application will still run correctly. This would allow you to share the URLS without having to constantly reconfigure each person's computer. Additionally, marketing and sales stakeholders can easily view product demos as well, without needing to learn what the elusive host file is for.
If you have an IT department, they can help you setup the DNS. However, if you are a small team without a real IT department, some users have found success using DNS systems designed for home or small office networks.

Intermittent 'the remote name could not be resolved'?

I have an ASP.NET application that I use to read the contents of a web page by a HttpWebRequest frequently. There's no problem with the remote address and my application is always working fine.
While I don't change anything, sometimes (about once a day) I get this error:
the remote name could not be resolved.
Why a previously resolved DNS name sometimes fails to be resolved?
The intermittent nature of this is going to be extremely difficult to resolve and it's going to take a configuration change instead of a code solution. (hint: read everything ;)
I would guess that the remote servers DNS is set to expire pretty often. Probably daily or maybe even every 12 hours or so. This is the TTL (time to live) setting. Admins sometimes set this to an artificially low level if they need the ability to quickly move the site to a new server.
You can determine how often it expires by going to a command prompt and running:
nslookup
set debug
www.theserverdomain.com
At the top of this will be a section that says "AUTHORITY RECORDS:" with an item under it that says "ttl".
Now, (and I'm making an educated guess here), what's probably happening when you query your DNS server to resolve that host name your server will have this value cached.
However, once it expires the your server will have to contact another server upstream to get the ip address resolution, called DNS forwarding. If there are a lot of hops between yours and the remote server OR if one of the DNS servers between the sites is overloaded then it could timeout and send back the message you are receiving.
If this is true then the ONLY thing you can do is hardcode the DNS and IP address combination in your web servers hosts file. This is usually at C:\Windows\System32\drivers\etc and is a file named "hosts". There is an example on how to properly edit this within the file itself.
Once you create the host mapping in that file, your web server will no longer have to contact the DNS server to perform name resolution and it won't matter what the TTL is set to.
The only danger here is if they move the web site to a new IP address. At which point you could simply update your hosts file again...
The first thing I would check is if DNS is no longer correctly configured or malfunctioning.
Try (from a Windows command line)
nslookup MyDnsNameHere
and see if you get the IP you would expect.

How to support custom user domains (like WordPress) in IIS/ASP.NET

I would like to know if it is possible using IIS and ASP.NET (and ideally something that might be employed on a shared hosting account, but this isn't required) to mimic WordPress.com's ability to allow end users to use their own domain names.
WordPress has users who own their own domains change the domain's DNS settings to point to WordPress's own DNS. My guess is this is not something that would be able to be done on a shared hosting account since it would involve adding an entry to the DNS server's table for each custom user domain.
However, for future reference, is this something that might be automated programmatically on perhaps a VPS?
My guess is this is not something that would be able to be done on a shared hosting account
You're nearly correct. The default site in IIS listens to all connections on port 80 for the default IP address.
You can add more sites in 3 ways:
Add new sites listening on different ports. This is not entirely practical if you want "ordinary" sites litening on port 80.
Add more IP addresses to the box (not too eaisly done) and set up new IIS sites to listen to the new IP addresses independently.
Add new sites to the server listening to different "host headers" (domain names to you and I) but on the same (default) IP address .
So called "Shared hosting" usually uses options 3, because a hosting company can get away with only using a single IP address for possibly hundreds of sites.
Therefore you would have to go through the tedious process of adding each host header to the box, and while I'm almost certian this could be done with Wscript, I'm no expert in that area.
If you really wanted to get into it, you could write an ISAPI module to intercept the calls and set up some clever (ish) database/hash table of domain names and target folders to server as the different sites.
Bottom line is, there are various ways to achieve this on Windows. Probably none quite as easy as on a *nix platform where everything is super-scriptable.
What we do is have a wildcard DNS entry set up for our domain. That way, whatever domain the user types will resolve to our website as long as it ends with ".mydomain.com". Then our .Net code just looks at the "HOST" header coming in and serves up the content that matches that domain name.

Resources