Where does Ubuntu/MATE store a static IP address?

I have a Ryzen7-2700x running Ubuntu-MATE 18.04. The MATE network connection app is completely greyed out. Somehow I managed to set my machine up with a static IP address (ethernet) since I run it headless, but I now don't remember how I did it, nor where the address is stored. If I upgrade to 20.04, I would like to know where such network information is stored. I have searched via grep for the IP address that has to be on the machine somewhere, likely /etc/[...] but I have not found it. I have read many postings about networkd, NetworkManager, .yaml files, and most of them don't seem to apply to my machine since the files, if they exist at all, are empty, implying that IP addresses are set somewhere else.

Is there a set of instructions somewhere that apply to MATE/Ubuntu 20.04 (not necessarily earlier versions) for setting a static IP address, plus gateway and name server?

Hi @BKFC,

I know only 3 places for that :

  • NetworkManager - run nmcli connection show and try to figure out if you have a connection configured with NetworkManager

  • /etc/netplan/* (ubuntu 18.04 and above) - a yaml file that configure your network after boot time.

  • /etc/network/interfaces (before ubuntu 20.04) - - a conf file that configure your network after boot time but in previous ubuntu releases.

Do not hesitate to ask for help :slight_smile:

Thanks for your comments. Here's the output:

%/ nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 9d83eda6-d46a-35f7-948c-a3c2eef607f6 ethernet enp4s0

%/ cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager

%/ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

So nmcli doesn't provide much information, the two files are essentially empty, except that one says "let NetworkManager manage all devices." I've actually looked at these files before. It appears that there's another file somewhere else where the 'real' information is. Maybe it's not in human-readable form, but then there should be a way to change it, yet the nm-connection-editor in MATE has all options greyed out. I really don't understand how this is supposed to work. It's fairly common in linux for 'legacy' configuration files to be either ignored or overwritten in future OS releases, but in this case it's a mystery as to what that is.

So it is configured with NetworkManager.
You can confirm it using this command :

nmcli connection show 9d83eda6-d46a-35f7-948c-a3c2eef607f6
and search for ipv4.addresses (scroll with enter key)

To set up static IP (if this got lost somehow) with nmcli on your connection you can run :

nmcli con mod 9d83eda6-d46a-35f7-948c-a3c2eef607f6 ipv4.addresses 192.168.1.4/24

when 192.168.1.4/24 is your IP / netmask - here 255.255.255.0 so /24

Probably the same config will be insife GUI of Network Manager :

Thanks for that input. In the meantime I found the configuration file:

/etc/NetworkManager/system-connections/'Wired Connection 1'. It contains all the relevant parameters. I learned this from another web site, but I needed to use 'sudo grep' to find it in a search.

The other half of the question concerns the fact that the GUI is completely greyed out:

image

That is, clicking the gear to edit does nothing. I have two machines with MATE, one 18.04, the other 20.04, and it's greyed out with both. For future use it would be nice to know what 'feature' of MATE disables the GUI.

Can you try running it with sudo framework from a prompt ?

sudo nm-connection-editor

and see if it's still grayed out ?

Mixed results.

For the 18.04 machine, entering this on the command line without sudo gives me a grayed-out window, but with sudo I get the full functionality.

For the 20.04 machine, it's grayed out without sudo. With sudo, I get this:

Client is not authorized to connect to ServerUnable to init server: Could not connect: Connection refused

(nm-connection-editor:25226): Gtk-WARNING **: 20:03:54.762: cannot open display: :1

Try to remove this lines from /etc/network/interfaces

iface lo inet loopback

Next restart your pc or run sudo service network-manager restart

Probably Network Manager cannot edit this connection because its configure by /etc/network/interfaces file.

The file /etc/network/interfaces is empty on my 20.04 machine, which is the one that won't launch nm-connection-editor via sudo

/% cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown

The nature of the error messages suggests some sort of problem running a MATE app as root while logged into a windowing session as not root, even though my account is set up as an administrator account. If I invoke nm-connection-editor inside MATE not as root, the app at least launches, though options are grayed out.

You can try to unplug the wire, delete the actual connection (the one without possibility to change it) with root privileges, next exit nm-connection-editor running as root, and open again nm-connection-editor without root and configure this connection again as regular user.

Problem solved. It turns out that for MATE 20.04 (Odroid N2 ARM), one has to double click the gear on the nm-connection-editor app, after which one authenticates to get access. In any event thanks to olek for staying with me on this!

1 Like