3

So as stated I can access my server remotely, and locally using SSH, however I dont have access to "The internet". By this I mean I cant access webpages.

dtipp@mc-server:~$ ping www.google.com
ping: unknown host www.google.com

That is what I get when I try to ping google.

dtipp@mc-server:~$ curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'  

Doesn't yield an ip address like it used to. All my problems started after trying to setup a static ip address. I finally managed to get my file to look like I thought it was supposed to, but only just now have the issues started.

dtipp@mc-server:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:19:b9:d3:b1:fa  
      inet addr:192.168.1.120  Bcast:192.168.1.255  Mask:255.255.255.0
      inet6 addr: fe80::219:b9ff:fed3:b1fa/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:21401 errors:0 dropped:0 overruns:0 frame:0
      TX packets:20888 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:3207899 (3.2 MB)  TX bytes:4381547 (4.3 MB)

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:65536  Metric:1
      RX packets:4102 errors:0 dropped:0 overruns:0 frame:0
      TX packets:4102 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:353932 (353.9 KB)  TX bytes:353932 (353.9 KB)

 dtipp@mc-server:~$ sudo nano /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 192.168.1.120
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
dtipp@mc-server:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# nameserver 192.168.1.120
dtipp@mc-server:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=29.1 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 28.564/28.827/29.108/0.329 ms

This is the setup file, and the results of a few other ping things. Have I done something wrong or do I need to be doing something additional?

5
  • What's the output of cat /etc/resolv.conf?
    – muru
    Mar 4, 2015 at 21:16
  • # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # nameserver 192.168.1.120
    – Dtaivpp
    Mar 4, 2015 at 21:20
  • Could you edit your post to include that? Also, can you ping 8.8.8.8?
    – muru
    Mar 4, 2015 at 21:20
  • Ok done. Also I will note I wasnt exactly sure what to put as the nameserver.
    – Dtaivpp
    Mar 4, 2015 at 21:24
  • Since you can ping 8.8.8.8, you can use it as a DNS server (it's one of Google's public DNS servers). chili's answer covers that.
    – muru
    Mar 4, 2015 at 21:26

1 Answer 1

7

When you set a static IP address, you must also set DNS nameservers.I suggest you amend /etc/network/interfaces to:

# 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 192.168.1.120
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 192.168.1.1 8.8.8.8

Restart the interface:

sudo ifdown eth0 && sudo ifup -v eth0

Test:

ping -c3 www.ubuntu.com

Your /etc/resolv.conf is also incorrect. Please amend:

nameserver 127.0.1.1
3
  • Probably should have done this at home and not over ssh right? Will try in a few hours to bring it back up when I am home. Lost ssh connection and I am not sure if it is coming back up. Will update shortly.
    – Dtaivpp
    Mar 4, 2015 at 21:29
  • Ok so I did what you had said and I am online again. Would you mind explaining what I just did by removing broadcast, network and adding the dns? Also will I have to redo the nameserver everytime I restart?
    – Dtaivpp
    Mar 5, 2015 at 0:41
  • 1
    The primary thing is that you added DNS nameservers; required to translate names, ubuntu.com, for example, to numbers, 91.189.89.115, that the internet uses. Without DNS nameservers, you cannot reach the internet by name, as you saw. Removing broadcast and network were simply to streamline by removing extra needless information. You needn't repeat this step upon reboot. If my answer has been helpful, please accept it.
    – chili555
    Mar 5, 2015 at 1:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .