2

Disclaimer: I'm totally new to Ubuntu.

I haven't been able to figure this out, and I've looked through a lot of posts online.

I have installed Ubuntu Server on a computer. The system seems unable to connect to the internet.

The /etc/network/interfaces file looks like this:

# The loopback network interface
auto lo
iface io inet loopback
# The primary network interface
auto enp0s31f6
iface enp0s31f6 inet static
address xxx
netmask xxx
gateway xxx
dns-nameservers xxx

When I try to ping something ("e.g. google.com"), I get "unknown host". I can't install any packages etiher.

When I run "ethtool enp0s31f6" I get lots of stuff that pops up, including "Link detected: Yes". If I unplug the ethernet, "Link detected: No".

I hope I have given enough information. Please let me know if I should add anything else.

Thanks.

EDIT: I restarted the PC after making the changes to a static address and it now shows the correct IP and info when I do ifconfig. However, ping still doesn't work.

closed as unclear what you're asking by Kevin Bowen, amc, MadMike, Eric Carvalho, user117103 Jul 20 '16 at 19:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Does ifconfig confirm that the ethernet interface of interest is indeed enp0s31f6? You only need address, netmask, gateway and dns-nameservers. With more information, I will propose an answer. – chili555 Jul 5 '16 at 15:59
  • @chili555 ifconfig does confirm that it is the one. I took out the unnecessary parameters. – Sastreen Jul 5 '16 at 16:02
  • Can you ping the gateway? How about: ping -c3 8.8.8.8? – chili555 Jul 5 '16 at 16:14
  • @chili555 See my answer to that comment in your answer. – Sastreen Jul 5 '16 at 16:18
  • 1
    I am flagging this for being a bit too broad now that we have narrowed it down a bit I have been able to formulate a better question. – Sastreen Jul 5 '16 at 16:48
2

If you have a DHCP Server in you network, try (as root):

$dhclient

In a Terminal/Shell. This should work.

If you need a specific configuration, you can do this like the others described in /etc/network/interfaces and /etc/resolv.conf (for the nameservers).

I think it would be a good idea, if you post your /etc/network/interfaces and /etc/resolv.conf, but maybe try dhclient first.

1

See if your interface got an ip from dhcp first.

ifconfig -a

(if it doesn't have an ip try assigning one manually) Then if you got an ip then try

ping <gateway>

(if this doesn't work your network config is wrong) If that works then try pinging a public ip like 8.8.8.8. (if this works then your name resolution is not working (dns).

cat /etc/resolv.conf 

and see if you have valid name servers there.

  • I am trying to set my IP address manually now, but it doesn`t seem to change in the ifconfig -a. It shows up as 10.0.0.10, when I have tried to set it to something else. See my edit. – Sastreen Jul 5 '16 at 15:44
  • You need to sudo ifdown enp0s31f6 and sudo ifup enp0s31f6 to get your new configuration to work. – Jos Jul 5 '16 at 15:46
  • @Jos After doing that, ifconfig still gives me the wrong inet addr. Should I have the line: auto enp0s31f6 in my interfaces? – Sastreen Jul 5 '16 at 15:56
  • Yes. You need that one, but you don't need the network and broadcast statements. Take these out and try again. Also address has a double d, perhaps that's where your problem is. – Jos Jul 5 '16 at 16:00
  • @Jos network and broadcast are gone now. The address was a typo in the question, but it is spelt correctly in the file. Still no luck. – Sastreen Jul 5 '16 at 16:01
1

Your interfaces file need only contain:

# The loopback network interface
auto lo
iface io inet loopback
# The primary network interface
auto enp0s31f6
iface enp0s31f6 inet static
address xxx
netmask xxx
gateway xxx
dns-nameservers xxx

Please note that you said 'adress' and it should be address. Be sure to select an address outside the range used in the router, switch or access point for DHCP.

Get the system to re-read and use the file:

sudo ifdown enp0s31f6 && sudo ifup enp0s31f6

Check:

ifconfig

ping -c3 www.ubuntu.com
  • My interfaces file now matches yours. The ping still does not work (unknown host). – Sastreen Jul 5 '16 at 16:13
  • Can you ping the gateway? How about: ping -c3 8.8.8.8? – chili555 Jul 5 '16 at 16:15
  • When I ping -c3 8.8.8.8 it appears to work (3 packages transmitted, 3 received). Pinging the gateway does not work. Does this mean I have the wrong gateway info? – Sastreen Jul 5 '16 at 16:17
  • Probably; and maybe the wrong DNS. Are your settings consistent with the gateway, DNS, etc., for other devices on the same network? Phones, desktop, 'Pads, 'Pods, etc.? – chili555 Jul 5 '16 at 16:19
  • It's identical (apart from address) to the settings on a PC connected to the same network. The settings say TCP/IPv4 though. – Sastreen Jul 5 '16 at 16:22

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