[linux-elitists] nmcli and NetworkManager configuration
p.mayers at imperial.ac.uk
Tue Aug 31 04:56:10 PDT 2010
On 08/29/2010 04:30 AM, Jason White wrote:
> NetworkManager is increasingly being installed by Linux distributions
> these days. Recent versions come with a shell utility, nmcli, intended,
> for use by users who prefer the command line (I'm in that category) and
> for servers. I understand that NM provides multiple network profiles and
> facilitates the configuration of WPa2, 3G modems, etc.
> Some of those features could be useful. I've read the nmcli(1) manual
> page and experimented with running nmcli, but it seems to be missing the
> ability to configure new connections. (Having just installed NM, I don't
> have any profiles or interface configurations set up.)
NM is pretty damn good these days IMO. It's bluetooth DUN support wowed me.
> How is one supposed to configure NM from the shell, i.e., without
> running X?
If you're not running X, nm-applet won't be running and thus won't be
providing the User settings service. Therefore any NM connections will
need to be "system" connections. NM get the config for these by running
one or more plugins. This is a good primer:
The short version is that NM will read RedHat/Fedora-style ifcfg-*
files, so you can just write these out. However, the ifcfg plugin only
support ethernet-style connections, not VPN or DUN/PPP/3G.
To support these, you'll need to run the "keyfile" plugin, and write out
an appropriate keyfile. This is basically an .ini file in
> Are there any alternative projects that I should look at?
> The main use cases at the moment are, for example, switching between
> multiple network profiles with different IPv4/IPv6 configurations;
Can I ask whether you're aware that you can have >1 profile on the same
adapter? So you don't need to "change" any config for this - just
activate the relevant profile (in theory - I haven't tested this)
> setting up wireless (including WPA2) networking quickly on a laptop,
> etc. I could write shell scripts, of course, but I'd rather work with
> daemons and tools designed for the purpose than to reinvent what others
> are devoting significant development effort to create.
Without X, writing keyfile configs out is probably the quickest route.
If you wanted to get really ambitious you could write a non-X User
settings provider (which ran in the background, like ssh-agent) using
something like python-dbus - but I suspect that would be highly non-trivial!
More information about the linux-elitists