2

I have installed fresh CentOS 6.3 on my machine. Internet is not working at all. How ever I can ping my router and other computers connected on LAN. I've googled and searched various forums but all in vain. None of the solutions work for me :(

here's some information about my system -


output of "ping 192.168.1.1"

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.615 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2441ms
rtt min/avg/max/mdev = 0.301/0.476/0.615/0.130 ms

output of "ping 192.168.1.2"

PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=128 time=9.06 ms

--- 192.168.1.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2333ms
rtt min/avg/max/mdev = 2.686/5.669/9.066/2.621 ms

output of "ping 8.8.8.8"

From 192.168.1.1 icmp_seq=10 Destination Net Unreachable


contents of "resolv.conf"

# Generated by NetworkManager
domain Home
search Home
nameserver 192.168.1.1

contents of "network"

NETWORKING=yes
HOSTNAME=localhost.localdomain
NTPSERVERARGS=iburst

contents of "ifcfg-eth0"

DEVICE="eth0"
BOOTPROTO=dhcp
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="1c4b1997-00d4-432c-85cd-10d2acb91570"
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=LAN
HWADDR=00:1C:C0:B2:DD:86
PEERDNS=yes
PEERROUTES=yes
LAST_CONNECT=1362299730

output of "nslookup google.com"

;; connection timed out; trying next origin
;; connection timed out; no servers could be reached

output of "dig google.com"

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached

output of "ifconfig"

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:B2:DD:86  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:feb2:dd86/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1068 errors:0 dropped:0 overruns:0 frame:0
          TX packets:779 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:90280 (88.1 KiB)  TX bytes:72565 (70.8 KiB)
          Interrupt:20 Memory:d0200000-d0220000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

output of "route -n"

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

output of "iptables -L"

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Note : I have set "Obtain an IP Address automatically" on Windows 7 and everything works just fine there.

Manmohan Bishnoi
  • 131
  • 1
  • 1
  • 5
  • You have misspelled the resolv.conf file. There is no "e" at the end of resolv. –  Mar 13 '15 at 15:44

2 Answers2

3

EDIT 2013-03-04: as seen in the comments to this response, there actually is a routing problem of some sort as well, since ping doesn't work to external ideas even when given an ip address instead of a hostname.


Original response:

There is no evidence in your question that routing is a problem. What it does show is that the nameserver at 192.168.1.1 doesn't respond to DNS queries from your CentOS machine. You see this from the lines you posted reading

;; connection timed out; trying next origin
;; connection timed out; no servers could be reached

when you're using nslookup or dig. Since the nameserver you've entered into resolv.conf is one that you can ping, i.e. 192.168.1.1, this is not a routing problem.

If you want to confirm that this is a DNS resolve problem rather than a routing problem, try doing this instead:

ryo-ohki:~ jenny$ dig ns.google.com @8.8.8.8

If you still get "connection timed out", then you do have a routing problem. But if you get a proper response, you've shown that it's your own nameserver that's the problem.

So, once you've done that and verified that it's not a routing issue, the question instead becomes "Is the machine 192.168.1.1 actually supposed to be the name server?" Is it the same name server that you are using for the windows machines? If so, try to figure out why it's not responding.

If it's not, make sure to enter the right name server into /etc/resolv.conf.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • when I run `dig ns.google.com @8.8.8.8` response is **connection timed out** other LAN machines (192.168.1.x) are also able to ping me. – Manmohan Bishnoi Mar 03 '13 at 10:52
  • Your firewall configuration doesn't allow UDP traffic; sorry for not noticing that. Since DNS is carried over UDP, this may be the only issue you are having. You need to open for UDP traffic to and from port 53 on your nameserver. – Jenny D Mar 03 '13 at 11:02
  • Or, to put it clearer: can you pin 8.8.8.8? If so, that means that routing works and it's a problem with DNS lookups only. – Jenny D Mar 03 '13 at 11:05
  • DNS port 53 is open in my firewall. I've tried to ping google.com after disabling firewall also; still not reachable. and when I `ping 8.8.8.8` reply is `From 192.168.1.1 icmp_seq=10 Destination Net Unreachable` This configuration was working on my friend's laptop (connected to my LAN, same router). what's wrong now ? I'm really confused ??? – Manmohan Bishnoi Mar 03 '13 at 11:26
  • That's lovely, we've just got another piece of the puzzle! I'm adding that to the question because as it originally stood, it was really hard to tell that the routing issue was even there. Then I'm going off to think a little to see if I can come up with something. Oh, one more question: does your router have any kind of logs? – Jenny D Mar 04 '13 at 07:45
  • I've retrieved this from my routers log file - http://pastebin.com/T8ugsajY – Manmohan Bishnoi Mar 04 '13 at 09:01
0

Try adding another nameserver in nameserver /etc/resolv.conf, for example those of google at 8.8.8.8

And make sure the router at 192.168.1.1 really is routing the traffic.

Jeroen
  • 146
  • 1
  • the router at "192.168.1.1" is routing traffic for windows machines. I have also used that router with virtual machines on windows and it works fine. why is it not working with centOS on physical machine ? – Manmohan Bishnoi Mar 03 '13 at 10:08