Static IP address configuration

How can I configure a static IP address?

I’m fairly comfortable with Linux in general, but clearly missed recent developments in this area (on Ubuntu/Lubuntu that is). Fiddling with the ‘/etc/network/interfaces’ file seems not to be the way anymore.

Well, I’ve figured it out… I’ve tested it on my laptop (with WiFi).

Static IP etc. can be set by the GUI (desktop-)function: nm-connection-editor.

It is all straightforward, and on a per-connection base, which is very convenient in the case of WiFi.

1 Like

After finding out how to configure networking items things with the nm-connection-editor application, I’ve digged a bit further. Lubuntu and friends use an elaborate method of configuring network devices (NetworkManager), while I was still used to (say) the ‘‘Debian-way’’, with the more minimalistic ifconfig-method, with if-up-down-scripts, aided by ConnMan on the desktop.

If you don’t like configuring your systems network with an application, and prefer to configure it (as root), you should have a look at how NetworkManager (the system) works, including the command-line tool for controlling NetworkManager: nmcli.

WiFi connections are stored in files at location: /etc/NetworkManager/system-connections. It might be a dangerous bend, but worth having a look at what’s going on there :sweat_smile:.

1 Like

If you correctly specify a static IP address as described above, but omit the DNS server entry, you will be using implicitly your gateway DNS (via the systemd-resolved service). The traditional file(-link) /etc/resolv.conf shows IP address 127.0.0.53 (as it always is with a static or dhcpd provided IP address).

If you specify a DNS record you may wonder why it does not show up in (the file linked by) /etc/resolv.conf.

In both cases you will see 127.0.0.53, which is the default systemd-resolved DNS resolver.

Verify the use of your specified DNS('s) with the following command:

$ resolvectl status

Note: The ubiquitous tools nslookup and dig will do what they are intended to do (show the resolved IP address of its arguments), and additionally show you 127.0.0.53 as the resolver IP address (i.e. the DNS used by the system). This is correct behaviour (ofcourse) but can be confusing. I am a great fan of systemd. After a mildly steep learning curve it is easy to use for personal daily usage (starting your own programs as services). For me, the network part remains vague. Perhaps a challenge for one of the technical writers on board of the Lubuntu team?

1 Like