0

I want to add to /etc/network/interfaces a new interface to make my IP static and accessible for a SSH connection (to configure a raspberry pi 3b remotely), so I'm using Ubuntu MATE 16.04. For now I'm testing it on a normal Ubuntu 16.04.

Apparently the naming standard for networks has changed and therefore eth0 is not a valid name anymore.

My raspberry pi is connected to a switch (same network as my computer).

Testing on my laptop (using wlan), ifconfig shows 3 networks called enp3s0, lo and wlp2s0, but I can't figure how to set up a static IP, as I learned using eth[0-9] and doesn't seem to work with the new standard.

Thanks in advance.

  • The interfaces now have stable names, meaning that instead of the system enumerating them in an arbirary order and naming them /dev/eth0, /dev/eth1 etc. now they get nice names which are guaranteed to have the same meaning at every boot. In your case /dev/enp3s0 is the wired Ethernet adapter, /dev/wlp2s0 is the wireless adapter and /dev/lo is the loopback interface (127.0.0.0/8). Use the new names as you would have used eth0. How to make a WiFi adapter use a static address is a different problem. – AlexP Mar 3 '17 at 11:41
  • I'd like to create a static ethernet connection. I'm now on the raspberry Pi and my ethernet looks like this enxb827ebca21d1 and I don't have any idea why, neither how to name a new one to create it (it won't recognize anything apparently) – dari1495 Mar 3 '17 at 12:10
1

In the new persistent naming convention, ethernet interfaces are typically named enp-something. As you see, you have an interface enp3s0. Since you say you are connected to a switch, I assume it is with ethernet.

On your normal desktop computer, running recent versions of Ubuntu, you are far better off to set a static IP address in Network Manager, as discussed here: static ip network guide

However, if you wish to use /etc/network/interfaces in order to learn and to be confident to use the same technique in the Pi, then, first, find out the range of addresses used in the router or other device that serves DHCP on your network. We will select an address outside the DHCP pool. Here is an example: http://www.mathgamehouse.com/oldmgh/istorm/help/manual/images/linksys.gif

In the example, the DHCP pool extends from 192.168.1.100 to 192.168.1.149. If it isn't otherwise reserved, a static address of, in this example, 192.168.1.5 would work perfectly.

Next, I suggest that you amend your file to:

auto lo
iface lo inet loopback

auto enp3s0
iface enp3s0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8

Of course, substitute your exact details here. Reboot and check:

ifconfig
ping -c3 www.ubuntu.com

If you get ping returns, you are connected.

| improve this answer | |
  • Okay this is getting really weird... I did that, rebooted and nothing new showed on ifconfig, I can't do ifup enp3s0either, it can't find the device. And I also can't ping from other machine to the ip specified in the interface. Surpringily enough, the ping -c3 www.ubuntu.com worked. – dari1495 Mar 3 '17 at 16:41
  • So I gave up and decided to connect the screen and the keyboard and do it manually. It worked. But the struggle continue here askubuntu.com/questions/889134/… – dari1495 Mar 3 '17 at 16:52
  • Doesn't enp3s0 show in ifconfig? Doesn't it have the requested address? – chili555 Mar 3 '17 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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