Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

one of my friend changed some network config in my laptop at home, He said he tried something related to block a website(he tested it with www.google.com).Now www.google.com not loading . Even he dont no what to do now .

Now Everytime when i try www.google.com in chrome browser its saying , could't connect to www.google.com,i tried it even with different browsers,but same result.But not problems with other domain names.

Instead of domain name i am using the the ip address of www.google.com ,That time it's loading

But no problem in other google websites like www.google.co.in , www.google.co.uk , www.gmail.com ,

i guess the problem is in dns settings . But i am not familier with networking .

Details of file /etc/hosts

127.0.0.1   localhost
127.0.1.1   karthi-Vostro-1550
192.168.1.1 www.google.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

**this is the result of nslookup**

Server:     127.0.1.1
Address:    127.0.1.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 74.125.236.180
Name:   www.google.com
Address: 74.125.236.178
Name:   www.google.com
Address: 74.125.236.177
Name:   www.google.com
Address: 74.125.236.179
Name:   www.google.com
Address: 74.125.236.176

result of Ping www.google.com - 100 % packet loss

My friend changed the config in my home. Now i am in college .The same problem is happening in my college too . But there is a difference

In home When i enter into a website that enabled google adsense then the google chrome asking username and password . But even though that page is loading .

In college Chrome not asking for any username or password . But www.google.com not loading

If any further details needed i am ready to give

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Your friend added a mapping forwww.google.com to /etc/hosts which points to an IP address in the private IPv4 network address space corresponding to the 192.168.0.0/16 CIDR block. This block has been reserved by IANA for private networking and is commonly used for home, office, and enterprise LANs, when globally routable addresses are not required or not available. The mapping in /etc/hosts overrides regular DNS lookups, and unless there happens to be a host with the IP address 192.168.1.1 on the local network, the address is unused.

To remedy the situation, remove the following line from /etc/hosts:

192.168.1.1 www.google.com
share|improve this answer
    
May I know why you said the network is 192.168.0.0/16? –  Ron Vince Apr 30 at 5:08
    
@RonVince The goal of the OPs friend is to block a web site based on its hostname. To do this, he maps the hostname to a "bogus" IP address in the hosts file, in this case 192.168.1.1. Presumably this address was chosen because it is in the 192.168.0.0 - 192.168.255.255 range, which is one of the three IP address blocks reserved for private use. Because these addresses have no global meaning, packets with private source or destination addresses should not be forwarded across inter-network links. –  Thomas Nyman Apr 30 at 6:40
    
@RonVince Of course, if the OPs laptop happens to be in a LAN which uses addresses from 192.168.1.0/8 block, there might be a host with the address 192.168.1.1 present, which might have unintended consequences. As you wrote, the particular address is the conventional address for the 192.168.1.0/8 network gateway, making it a somewhat unfortunate choice, although the significance of the address is that it would not be used on the global Internet. –  Thomas Nyman Apr 30 at 6:41
    
I missed 'result of Ping www.google.com - 100 % packet loss' which makes 192.168.1.1 mapped to www.google.com is obviously not network gateway or host. The fact that OP could surf internet validates that 192.168.1.1 is not network gateway. But no one except the network administrator can know that if 192.168.1.1 is mapped to a MAC address which is probably not online. None of the given information can lead to deduce to what network is being used on the LAN. I understand your reasoning why 192.168.1.1 was used in this case and 192.168.0.0/16 (quite rare). –  Ron Vince Apr 30 at 6:51
    
@RonVince You are misreading me. I'm not saying that the OPs network is 192.168.0.0/16, nor that it isn't 192.168.1.0/8 (the gateway could be at a different address). You cannot determine the network from the information provided. I'm only saying that the significance of the 192.168.1.1 address is that it belongs to a private block, which means that it is less likely that the address would point to a host (although in this particular case it happens to correspond to the conventional gateway address), and certainly not a host on the global Internet. –  Thomas Nyman Apr 30 at 7:02
show 5 more comments

Based on the content of /etc/hosts, www.google.com is set to be the IP 192.168.1.1. It does not matter if you have set your computer to use any DNS servers including Google DNS server. Your computer will check the hostname, e.g. www.google.com, if it matches the hostname on /etc/hosts file first before it request the hostname to be resolved by the pointed DNS server.

As for the solution, remove '192.168.1.1 www.google.com' line on /etc/hosts file and save the edit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.