1

After updating an old 'sandbox' type 14.04 desktop computer to 16.04 server to use again for mostly the same purpose, I was attempting to give the computer a static IP, and eventually forward a port to/for it, but I ran into trouble when editing the /etc/network/interfaces file to reflect the new static IP.

The file originally read:

auto lo
iface lo inet loopback

in it's entirety, save for the comments. There were no references to the other two network devices that ifconfig showed...

enp0s7    Link encap:Ethernet  HWaddr 00:19:21:f5:04:42  
          inet addr:192.168.1.116  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::4672:94c8:d31b:a04a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2694 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1765 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2345098 (2.3 MB)  TX bytes:166817 (166.8 KB)

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:385 errors:0 dropped:0 overruns:0 frame:0
          TX packets:385 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:37291 (37.2 KB)  TX bytes:37291 (37.2 KB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Anyone know why that is?

And besides that, when I changed the /etc/network/interfaces file to read:

auto lo
iface lo inet loopback

auto enp0s7
iface enp0s7 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 8.8.8.8 8.8.4.4

and used service networking restart, I lost internet connection, and the 'Wired' connection in the network tab of settings, i.e. the network connection symbol showing I was connected via wired connect, disappeared in both places. Upon restarting the system, the problem was still there, and the only way I've been able to regain internet connect/wired connection was to get rid of all of the enp0s7 items in /etc/network/interfaces.

Does anyone know what's going on? Even after looking up tutorials, as well as the official Ubuntu docs on setting a static IP, this is the way it all says to do this, and it isn't working. My biggest suspicion lies in the fact that the adapter wasn't already present in the /etc/network/interfaces file, and that I had to add it, but I don't know what that means.

Help?

  • That's the way to do it for a server - if you're running a desktop distribution of Ubuntu then by default networking is handled by a different service called network-manager: see Why can't I set a static IP address for my Linux box? – steeldriver Jul 10 '16 at 16:45
  • OP said he updated from 14.04 desktop to 16.04 server. – Alcuin Arundel Jul 10 '16 at 16:47
  • @AlcuinArundel regardless of the upgrade path, things like "the 'Wired' connection in the network tab of settings" and "the network connection symbol showing I was connected" make it pretty clear the machine is running a desktop interface – steeldriver Jul 10 '16 at 17:12
  • I have GNOME desktop installed just because I like the easy access to things sometimes. Althought that doesn't change the fact that I'm running 16.04 Server LTS. – Trevor Sears Jul 10 '16 at 17:13
  • @steeldriver is right; when you installed Gnome desktop, network-manager took over the reigns of your networking. You'll need to delete those manual settings from /etc/network/interfaces. – Alcuin Arundel Jul 10 '16 at 17:23
  • Is it possible to do it the other way around? Use /etc/network/interfaces and uninstall/stop network-manager? Or is network-manager hand-in-hand with GNOME? – Trevor Sears Jul 10 '16 at 17:26
  • Even with network-manager running, you are free to define interfaces in /etc/network/interfaces if you wish - just make sure they are correct (in particular, that the chosen static IP is outside any DHCP pool used by your router). And don't expect network-manager to "see" them - unless you configure it to do so (as explained in my previous link). – steeldriver Jul 10 '16 at 17:26
  • Thank you @steeldriver ! I didn't realize the implications of the network-manager when you previously said I was running a graphical desktop. I ended up just having to enter the same information into the manager, although I wish the manager 'see' (as you said) that file, and update itself accordingly.

    Thanks all!

    – Trevor Sears Jul 10 '16 at 17:32

0 Answers0