hosts interview questions
Top hosts frequently asked interview questions
I doubt this is possible without extensive jail-breaking, but is it at all possible to edit the iPad's (or any iOS device's) hosts file?
Source: (StackOverflow)
I recently wanted to point all subdomains for a test domain, let's say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127.0.0.1
Source: (StackOverflow)
To run powershell commands on a machine from a remote machine we have to add the remote machine to the trusted hosts list of the host machine.
I am adding machine A to machine B's trusted hosts using the following command :
winrm set winrm/config/client ‘@{TrustedHosts="machineA"}’
How to add more machines say machine C, machine D to trusted hosts list of machine B?
Source: (StackOverflow)
The /etc/hosts
file can be used to override dns definitions, i.e. to point an hostname to a different ip.
I want to use /etc/hosts
to make an alias record, i.e. to make my computer think that www.mysite.com does not point to a "hard coded" ip but instead is synonym of mychangingip.myip.com.
Can it be done?
Source: (StackOverflow)
Since on an iPad we cannot edit the hosts file (without jailbreaking), how can we arbitrarily redirect web traffic to another url?
This would be important for something such as developing a website that uses a Virtual Host configuration where you want to redirect to a development machine.
(This is related to this question: Can I edit an iPad's host file?)
Source: (StackOverflow)
I am currently testing a site with multiple sub domains pointing to the same ASP.NET application, and the routing handles what to do with each request.
For testing, I have added several sub domains to my "hosts file", e.g. "127.0.0.1 admin.TestDomain.com", which is working fine.
However, the problem is that when I call any function in c# to get the host name/domain/url (HttpContext.Current.Request.Url...), the host url always comes back with "localhost", rather than "TestDomain".
Any ideas why this name is being resolved in this manner, and where I can get hold of "TestDomain.com"?
Source: (StackOverflow)
I have many local websites set up in IIS and have entries in my hosts file to make the websites available locally.
I've come from a Windows 7 machine where everything was working correctly in all browsers. The move to Windows 8, using the same hosts file and the same websites in IIS seems to be causing issues with Internet Explorer (11).
I can access the website: mywebsite.local in Firefox and Chrome but am unable to access the same website in Internet Explorer. I've made sure that I'm not connected via any proxies or VPN connections and that my hosts file entry is typed correctly yet Internet Explorer is still aborting the connection with the error: "This page can't be displayed".
Any help or suggestions would be greatly appreciated!
Thanks,
Jon
Source: (StackOverflow)
I tried pinging "tracker.thepiratebay.org" and for some reason the DNS returns 127.0.0.1
I get 0% packet loss, but, obviously, it isn't going to the correct website.
My college uses a local DNS server, but I don't think that's where the problem is, since I asked a friend outside my college, and he reported the same results.
Can someone verify this result? And if yes, is there a reason? Also, can I access the real website somehow? (So, someone who can give me the ip of the website would be appreciated)
(Btw, "http://tracker.thepiratebay.org/announce" is one of the default trackers used by torrents downloaded from The Pirate Bay.)
EDIT: I've tried using the google DNS lookup instead of my own, and that too is returning 127.0.0.1
Can a possible explanation be that the site doesn't exist any more? or would not-existing return some other identifiable result?
Source: (StackOverflow)
I am working on a website which authenticates with Facebook, so that the user can sign in through his/her Facebook profile. I've seen similar questions like this one, but none that covers exactly my issue.
To test this Facebook authentication locally, I figured that some hacks were needed. You see, Facebook only allows redirects to certain domains after the authentication process. For these domains, localhost
is not an option.
So I decided to do some research. I ended up changing my hosts
file to point the domain local.fablelane.com
to 127.0.0.1
. However, now it complains when I try to change the virtual directory in Visual Studio 2012.
First, I see this dialog after changing it.
I then click Yes and end up with this dialog here.
What do you suggest I try? How can I change my virtual directory? It is important that I find a way to do this either programmatically, through changing a file somewhere, or through the commandline. The reason for this is that I intend to make an automatic setup program that does this for me in the future.
Source: (StackOverflow)
Like a lot of programmers, I test sites locally.
I use the hosts file to map domain names to my local ip (127.0.0.1).
I use qualified domain names, usually with a "d" subdomain (for "development").
For example:
d.somewebsite.com
d.anotherwebsite.com
and so on...
In Microsoft edge, most of the web sites work. However, a couple of them do not. There is nothing special or weird about the domain names that won't work. Just a simple d.someletters.com
.
They work fine in Chrome, IE, and Firefox.
In Edge, I get the error message:
"Hmm, we can't reach this page."
At first I thought it wasn't resolving the IP. However, I realized when I made a typo on another non-related url, that requests which are not routed by the hosts file are sent to my ISP to be resolved. If my ISP can't resolve it, they send back this special search results page with suggestions of what you might be trying to find. Well, when I go to my local domain, I do not get this page from my ISP. I get the error mentioned above straight from edge.
So, it seems to me that Edge is resolving the domain correctly, otherwise it would have been sent off to my ISP's DNS.
So, I would think then that maybe Edge just can't connect to the local machine. But like I said, several of these local domains are working fine. Also, using 127.0.0.1 directly in Edge also works. It's just these couple of domain names giving me a problem. And only in Edge (all other browsers work) Any ideas?
The web server is Apache2 for Windows (xampp) if that matters.
Also, if I open the debug window in Edge and monitor the network, I do not see any requests going out at all.
EDIT: I am no longer using the hosts file. I have dnsmasq running on one of my Linux boxes and I am using it for DNS instead of hosts. Also no longer using loopback (obviously since DNS is on another box now), I am using an internal private ip address (192.168...). Same issue.
Source: (StackOverflow)
I am using genymotion emulator and pulled hosts file from it using
adb remount
adb pull /system/etc/hosts C:\Users\Rkn09\Desktop\hosts
and I added new mapping like
192.168.0.115 xxx.mydomain.com and I pushed it back to emulator using
adb push C:\Users\Rkn09\Desktop\hosts /system/etc/hosts
but when I make a request to xxx.mydomain.com its not redirecting to my local machine in LAN 192.168.0.115. I even checked the hosts file using cat /etc/hosts and it has my mapping, can anyone help me with this issue.
PS: Same process is woking fine in Mac OS X EI Captain, I am getting this problem in windows7
Source: (StackOverflow)
I'm sitting in front of a fairly complex Ansible project that we're using to set up our local development environments (multiple VMs) and there's one role that uses the facts gathered by Ansible to set up the /etc/hosts
file on every VM. Unfortunately, when you want to run the playbook for one host only (using the -limit parameter) the facts from the other hosts are (obviously) missing.
Is there a way to force Ansible to gather facts on all hosts, even if you limit the playbook to one specific host?
We tried to add a play to the playbook to gather facts from all hosts, but of course that also gets limited to the one host given by the -limit parameter. If there'd be a way to force this play to run on all hosts before the other plays, that would be perfect.
I've googled a bit and found the solution with fact caching with redis, but since our playbook is used locally, I wanted to avoid the need for additional software. I know, it's not a big deal, but I was just looking for a "cleaner", Ansible-only solution and was wondering, if that would exist.
Cheers,
Source: (StackOverflow)
i am using apache and have a domain e.g.: www.example.com.
I redirected example.com to www.example.com by using this:
http://stackoverflow.com/a/1100363/441907
I also have a virtual host entry for www.example.com.
I had then performance issues which were resolved by putting www.example.com into my hosts file for 127.0.0.1.
My Question is:
Would i gain performance improvements by also putting example.com into the hosts file or does this make no sense since it simply gets resolved to www.example.com which is already in the hosts file?
Source: (StackOverflow)
I am using docker-compose
to run a test environment, that consists of about 5 different containers. The inter-container links and the shared volumes (volumes-from) works wonderfully. I also expose some ports up to the host machine, which works nicely.
What I am missing is a way to link some of my real servers into this environment, without hardcoding ip address. With docker run
, you could use --add-host
to add another line in your /etc/hosts
file. Is there any way to do something similar with docker-compose?
Thanks,
Pieter
Source: (StackOverflow)
Is there a way to get a System.Net.WebRequest
or System.Net.WebClient
to respect the hosts
or lmhosts
file?
For example: in my hosts file I have:
10.0.0.1 www.bing.com
When I try to load Bing in a browser (both IE and FF) it fails to load as expected.
Dns.GetHostAddresses("www.bing.com")[0]; // 10.0.0.1
WebRequest.Create("http://10.0.0.1").GetResponse(); // throws exception (expected)
WebRequest.Create("http://www.bing.com/").GetResponse(); // unexpectedly succeeds
Similarly:
WebClient wc = new WebClient();
wc.DownloadString("http://www.bing.com"); //succeeds
Why would System.Net.Dns
respect the hosts file but System.Net.WebRequest
ignore it? What do I need to change to make the WebRequest respect the hosts file?
Additional Info:
- If I disable IPv6 and set my IPv4 DNS Server to 127.0.0.1, the above code works (fails) as expected. However if I add my normal DNS servers back as alternates, the unexpected behavior resumes.
- I've reproduced this on 3 Win7 and 2 Vista boxes. The only constant is my company's network.
- I'm using .NET 3.5 SP1 and VS2008
Edit
Per @Richard Beier's suggestion, I tried out System.Net
tracing. With tracing ON the WebRequest
fails as it should. However as soon as I turn tracing OFF the behavior reverts to the unexpected success. I have reproduced this on the same machines as before in both debug and release mode.
Edit 2
This turned out to be the company proxy giving us issues. Our solution was a custom proxy config script for our test machines that had "bing.com" point to DIRECT instead of the default proxy.
Source: (StackOverflow)