hosts-file interview questions
Top hosts-file frequently asked interview questions
I have the following problem:
I make a custom hosts file to test some features of my application and then push it to my android emulator.
The thing is that these settings do not take effect immediately. I have to wait about 10 minutes before they become active.
So my question is: how to make the new hosts file active instantly? I have many different settings to test and I can't wait 10 minutes every time.
Source: (StackOverflow)
For my development process I need to access a webserver which is behind a VPN and has no DNS entry.
What I was doing on 4.x was to edit /etc/hosts on the iPhone, and add it to the hosts file.
Now I'm on 5.0 beta, and don't want to jailbreak for now just for this purpose.
Is there a way I can add a line to /etc/hosts, just for development purposes (the final, distribution application does not need this hack), without jailbreaking? Can I use other means (declare a fake DNS entry by some unknown means at application launch, for example)?
Source: (StackOverflow)
I am using windows 7 and python 2.7 I want to map 172.16.45.84 IP address to myapp.nobies.in without mapping in hosts file.
I have the required certificate to this hostname. I don't want to map in hosts file as it requires administrative privileges.
So, how to create a DNS python server for it, which can be shipped with my app.
Source: (StackOverflow)
I am trying to block tumblr, and all it's pages, using my hosts file. Usually I would just add an entry like
127.0.0.1 tumblr.com
to my file, but tumblr has websites in the format " sitename.tumblr.com"
I have tried
127.0.0.1 *.tumblr.com
127.0.0.1 http://*.tumbr.com
And neither work either. Does anyone know how to block tumblr without installing bulky software?
Source: (StackOverflow)
I'm using the .NET WebRequest while changing my HOSTS file. I'm observing that System.Net doesn't honor those changes - how can I make it do so?
I have a number of servers load-balanced behind a single hostname, let's say 'example.com'. I want to target several of them individually, so my program will hard-code the machine-specific IP address in my HOSTS file before sending a request to example.com:
163.56.0.34 example.com
For the first server and first request, this works fine. Then my program changes the HOSTS file again:
163.56.0.48 example.com
And I create a new HttpWebRequest. When I send this one off, I can observe in NETMON that it goes to the first IP address (163.56.0.34) instead of the expected second one.
Using breakpoints and debug traces, I've verified that the correct value does get written to the HOSTS file each time. When I attempt to access example.com from a browser or other program, it does honor the HOSTS file and go to the second IP address.
Using NETMON I've verified that requests are going directly to the IP address shown; there is no HTTP proxy.
Since everything else is honoring the changed HOSTS file, I strongly suspect that the System.Net infrastructure has cached the DNS host-IP association for example.com. However, I can find no reference to this caching, and know of no way to flush it or turn it off.
I would welcome instructions for dealing with the cache, suggestions for what else might be causing these symptoms, or other proposed diagnostic steps that might be useful.
Source: (StackOverflow)
I have this working in an MVC project on IIS by adjusting the hosts file.
When running an Azure project, I can see some ports getting remapped, not sure what thats doing or how I can set up subdomains, is it also done in the hosts file?
Source: (StackOverflow)
I have some wrapper code that runs a set of NUnit tests that scan live websites for certain response codes.
I'd like to run these tests against a different server. When running manually, I can do this by editing the /etc/hosts file in Windows\System32\drivers and temporarily setting www.mysite.com to 10.0.0.whatever
Is there any way I can do the same within a .NET console application - temporarily override a DNS record or somehow intercept the resolution and return a different IP address?
EDIT: This is for testing multiple servers in a web farm. I have three live servers, all of which THINK they are www.mysite.com. Because the servers use HTTP host headers, I can't just run a test against server1, then server2, then server3, because an HTTP request to http://server1/ will NOT return the same thing as a request to http://www.mysite.com/ that's resolved to server1...
Source: (StackOverflow)
Hee guys, little question: So i have setup the Homestead 2.0 and everything is working fine. I wanted to add another project in the same code directory but link it to another url. So i added it in the sites list but when i visited laravel.app it all works fine, but when I visit larabook.app it shows me the laravel.app page! Both urls are linked to 192.168.10.10 in my /etc/hosts file.
I have tried restarting my mac and restarting the vm but nothing is working :'(
/etc/hosts
192.168.10.10 laravel.app
192.168.10.10 larabook.app
Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: laravel.app
to: /home/vagrant/Code/Laravel/public
- map: larabook.app
to: /home/vagrant/Code/Larabook/public
databases:
- homestead
- larabook
Source: (StackOverflow)
In nginx the proxy_pass
directive is not resolving DNS using the /etc/hosts
file. Any way to enable this possibility (maybe by leveraging Lua as a last resort)?
Source: (StackOverflow)
I'm using ApacheBench to do some load testing. I'd like ab to resolve the hostname using the IP address specified in /etc/hosts on my Mac. How can I force that? curl has a --resolve option to do exactly this, as specified here. I'm looking for something similar for ab.
Source: (StackOverflow)
I've started using IKVM to translate Java libs into .NET CIL. I can successfully write a C# program that pulls in (inproc) a translated Java assembly as a reference and make calls to the translated Java code.
My question is, is anyone familiar w/ how to make calls (callbacks) from Java to C# using IKVM? I've been looking for a good tutorial or explanation but haven't seen one yet.
Any help is appreciated. Thanks,
mj
Source: (StackOverflow)
Chrome caches DNS records and tends to ignore changes to the hosts file after it has successfully connected to my site (barring a restart). With DNS pre-fetching enabled, it is even more pronounced.
Are there any page headers that will instruct Chrome not to cache a site's DNS? Like Cache-Control
or a response status like 307 Temporary Redirect
?
Source: (StackOverflow)
Haven't been using windows (W7 particulary) for quite a while, so must've forgotten something.
Trying to add a custom ip-host line to the c:\windows\system32\drivers\etc\hosts
file.
The line looks like this: 199.229.249.151 models.db
.
But when I save the file and try to ping the host, it does not respond. Neither does the browser find it.
I tried using the command line to add read-only to the hosts file. Same result.
Tried flushing the dns cache. Nothing changes.
What can I be forgetting?
Source: (StackOverflow)
I'm creating a 'domain locking' script. Basically, the script will check my website to make sure that the host its running on is allowed to run it.
I don't want them to be able to modify their host file to reroute the connection.
Is there a way to check this and/or prevent it?
Source: (StackOverflow)