Re: [Dorset] Using the host file
On 23/05/2013 17:16, Tim wrote: So I edited the /etc/host file as follows Do you mean '/etc/hosts'? It seems from a later post that your ping looked up the correct IP address, so presumably you did edit the correct file, but I thought it would be worth checking. -- Andrew. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
Hi Tim, Starting from the beginning because I have a little more time... I am trying to access a web site via a different IP address than the normal web site sits on. I have been told (by the owners of the the web site) to add an IP address to my host file which resolve to the domain name. So I edited the /etc/host file as follows 1.1.1.1 thesite.co.uk (all fictitious, just an example) I then saved it and restarted the networking. No need to re-start networking. /etc/hosts is read by the program you're running, e.g. the browser or ping. sudo strace -e open ping -c 1 google.com Re-starting the browser would do in case it remembered it couldn't find thesite.co.uk from your previous attempts. I then tested the access to the web site and while I could access the web site I am unable to access the bit of the web site that I need to access which the above mod to the host file should of let me access. I see what the owners want you to do and why but don't know if thesite.co.uk is already known, e.g. through DNS, and you're trying to override it or whether it's unknown and yours is the only definition visible. If the former then your browser may have been using the old public definition and if there's two different IP addresses, public and private, serving apparently the same site but with extras on private, you may not obviously know which you're accessing. I understand why we can't know the details but it makes investigation awkward. :-) If I ping the web site it comes back saying ping website.co.uk (1.1.1.1) 56(84) bytes of data (where 1.1.1.1 is the ip address I put in the host file). That's good. When I do the tcpdump -i any -n port 80 (I only have the website.co.uk on a single tab in the browser) I get a lot of traffic between my PC and an NTL server (which I would expect as I am on Virgin) but out of some 40 odd lines it produces as I change page on the web site it is only those two IP addresses that it shows. Is your browser configured to use an NTL proxy in some way? What if you repeat the test but have google.com as the single tab; is it still the NTL server? Could that be interfering? Martin Hepworth wrote: Also make sure 'file' is mentioned before dns in the hosts line within /etc/resolv.conf My resolv.conf only has one line (unhased line) nameserver 127.0.1.1 Yes, I think Martin meant /etc/nsswitch.conf and/or /etc/host.conf, as shown by that strace of ping above. You can check if your /etc/hosts line is having an effect by pinging thesite.co.uk with the line there and without it. The IP address should change if you line is having an effect and there is any point having it. Mine, for example, has `files' first. $ grep -w hosts /etc/nsswitch.conf /etc/host.conf /etc/nsswitch.conf:hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 /etc/host.conf:order hosts,bind $ You could pass an explicit Host header just to check the server is configured as you expect. As an example, try curl -sSvIH 'Host: dorset.lug.org.uk' http://google.com/ I assume you wanted me to replace google.com with the web site I am trying to access Nope! :-) Sorry, I thought you knew how this worked under the covers and that a means of testing the remote server without involving a browser might be useful. Let's say 1.2.3.4 is the IP address you've been told to contact when your enter http://thesite.co.uk/foo/bar in the browser. Do curl -sSvIH 'Host: thesite.co.uk' http://1.2.3.4/foo/bar This tells curl to access 1.2.3.4 and ask it in the HTTP protocol for the headers of /foo/bar on the thesite.co.uk website. /foo/bar could be either a public part everyone can reach or private. Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
[Dorset] Using the host file
I am trying to access a web site via a different IP address than the normal web site sits on. I have been told (by the owners of the the web site) to add an IP address to my host file which resolve to the domain name. So I edited the /etc/host file as follows 1.1.1.1 thesite.co.uk (all fictitious, just an example) I then saved it and restarted the networking. I then tested the access to the web site and while I could access the web site I am unable to access the bit of the web site that I need to access which the above mod to the host file should of let me access. How can I check that the web browser is accessing the web site via the changes I made in the host file and not using the old settings? Tim -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
First: ping thesite.co.uk ...and see what address it pings. Next, run tcpdump while you access the site and see what address is accessed: tcpdump -i any -n port 80 -- You can't live a perfect day without doing something for someone who will never be able to repay you. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
Also make sure 'file' is mentioned before dns in the hosts line within /etc/resolv.conf Martin On Thursday, 23 May 2013, Keith Edmunds wrote: First: ping thesite.co.uk ...and see what address it pings. Next, run tcpdump while you access the site and see what address is accessed: tcpdump -i any -n port 80 -- You can't live a perfect day without doing something for someone who will never be able to repay you. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.ukjavascript:; How to Report Bugs Effectively: http://goo.gl/4Xue -- -- Martin Hepworth, CISSP Oxford, UK -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
Hi Tim, I am trying to access a web site via a different IP address than the normal web site sits on. You could pass an explicit Host header just to check the server is configured as you expect. As an example, try curl -sSvIH 'Host: dorset.lug.org.uk' http://google.com/ Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
On 23/05/13 18:37, Keith Edmunds wrote: First: ping thesite.co.uk ...and see what address it pings. Next, run tcpdump while you access the site and see what address is accessed: tcpdump -i any -n port 80 Hi If I ping the web site it comes back saying ping website.co.uk (1.1.1.1) 56(84) bytes of data (where 1.1.1.1 is the ip address I put in the host file). But there are no replies (but the web site does load ok and I can browse the web site as I normally do ok) When I do the tcpdump -i any -n port 80 (I only have the website.co.uk on a single tab in the browser) I get a lot of traffic between my PC and an NTL server (which I would expect as I am on Virgin) but out of some 40 odd lines it produces as I change page on the web site it is only those two IP addresses that it shows. Tim -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
On 23/05/13 19:22, Martin Hepworth wrote: Also make sure 'file' is mentioned before dns in the hosts line within /etc/resolv.conf Martin On Thursday, 23 May 2013, Keith Edmunds wrote: First: ping thesite.co.uk ...and see what address it pings. Next, run tcpdump while you access the site and see what address is accessed: tcpdump -i any -n port 80 -- You can't live a perfect day without doing something for someone who will never be able to repay you. -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.ukjavascript:; How to Report Bugs Effectively: http://goo.gl/4Xue My resolv.conf only has one line (unhased line) nameserver 127.0.1.1 Tim -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Using the host file
On 23/05/13 19:38, Ralph Corderoy wrote: Hi Tim, I am trying to access a web site via a different IP address than the normal web site sits on. You could pass an explicit Host header just to check the server is configured as you expect. As an example, try curl -sSvIH 'Host: dorset.lug.org.uk' http://google.com/ Cheers, Ralph. Hi Ralph I assume you wanted me to replace google.com with the web site I am trying to access, this is what I got (apologies for hiding the details) curl -sSvIH 'Host: dorset.lug.org.uk' http://website.co.uk * About to connect() to website.co.uk port 80 (#0) * Trying 1.1.1.1... * Connected to website.co.uk (1.1.1.1) port 80 (#0) HEAD / HTTP/1.1 User-Agent: curl/7.29.0 Accept: */* Host: dorset.lug.org.uk HTTP/1.1 307 Temporary Redirect HTTP/1.1 307 Temporary Redirect X-IPC-BALANCEID: 02:80 X-IPC-BALANCEID: 02:80 Server: Apache Server: Apache Vary: Accept-Encoding Vary: Accept-Encoding Content-Type: text/html; charset=iso-8859-1 Content-Type: text/html; charset=iso-8859-1 Date: Thu, 23 May 2013 18:52:16 GMT Date: Thu, 23 May 2013 18:52:16 GMT Location: http://www.***.com/ Location: http://www.***.com/ Transfer-Encoding: chunked Transfer-Encoding: chunked Connection: Keep-Alive Connection: Keep-Alive X-Cache-Info: not cacheable; response code not cacheable X-Cache-Info: not cacheable; response code not cacheable * Connection #0 to host website.co.uk left intact So I take it it is reading my host file and redirecting the browser to the IP address I entered. What are the redirect at line 10 11?? Tim -- Next meeting: Bournemouth, Tuesday, 2013-06-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue