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.

I just have setup a Linux server. But currently I am having problem in connecting to the outside world. I am not able to do wget,apt-get or ping. Here ar some relevant details:

$ping google.com
ping: unknown host google.com

cat /etc/resolv.conf

search dmust.local
nameserver 198.154.126.1

vim /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 198.154.126.179
        netmask 255.255.255.0
        network 198.154.126.0
        broadcast 198.154.126.255
        gateway 198.154.126.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 198.154.126.1
        dns-search dmust.local

Update

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
198.154.126.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         198.154.126.1   0.0.0.0         UG    100    0        0 eth0

grep '^hosts' /etc/nsswitch.conf
hosts:          files dns
share|improve this question
5  
Give the output of route -n instead of route since we don't know what localnet is. But it looks like the problem may be your nameserver. Try ping 8.8.8.8 and if that works, try host google.com 8.8.8.8. –  depquid Apr 3 '13 at 18:14
2  
In addition to what depquid said, can you also provide grep '^hosts' /etc/nsswitch.conf? –  Patrick Apr 3 '13 at 18:22
    
@depquid it works, both ping 8.8.8.8 and host google.com 8.8.8.8. it shows googles IP and mail servers. –  Subhransu Apr 4 '13 at 14:29
    
@Patrick please the nsswitch.conf has hosts: files dns entry in it. –  Subhransu Apr 4 '13 at 14:34
    
The problem is probably that your namerserver is invalid or broken. Where did you get 198.154.126.1 from for the nameserver? –  depquid Apr 4 '13 at 15:03
show 2 more comments

1 Answer 1

up vote 1 down vote accepted

You need to get the incorrect nameserver out of your configuration.

Check out https://help.ubuntu.com/12.10/serverguide/network-configuration.html#name-resolution for more information.

To use Google's free nameservers, edit your /etc/network/interfaces file as below.

Remove:

dns-nameservers 198.154.126.1

Add:

dns-nameservers 8.8.4.4 8.8.8.8

And then restart your network interface, via

$ sudo /etc/init.d/networking restart

share|improve this answer
    
Thanks depquid and me.sedal for melping me out, it did resolved the issue . –  Subhransu Apr 6 '13 at 17:10
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.