This NetworkManager thing in Ubuntu is horrible. Well; its not too bad actually but the commandline documentation sucks very very hard!
A quick brain dump after my questing for anyone dealing with this.. excuse my messy text.
A Google search for “Ubuntu NetworkManager Commandline” offers help disabling the NetworkManager; installing it (help.ubuntu) and refers you to the nmcli command. Which is just great help. No info to configure it without using the sodden graphical interface to do whatever.
The info about installing was particularly useless to me since it was already installed though the info about where the config files are and reference to nmcli was moderately interesting. Pity there is no info about those config files; anywhere. So .. I happily dicked around with generating configs on my laptop and using those on the headless xbmc box.
Right; so far my frustration; next up: trying to provide some meaningful info..
You probably won’t have to fuss too much with this as “Network Manager auto creates connections on a best effort base” though sometimes, and certainly on headless machines, you just want a fixed IP..
According to the help.ubuntu info, the configurations are in gconf or /etc. I did not find any of that data in gconf; but did find it in /etc
the config files go here.
The directory contains all your network configs and NM promises to try to choose the best possible network connection.
Configuration files are owned by root:root and have 600 rights. They are formatted as follows; you will need to edit the UUID in the config files, check the nmcli part below.
root@Benedict:/etc/NetworkManager/system-connections# cat Wired 2.44
The “addresses1=192.168.2.44;16;192.168.2.1;” is formatted as IP;Netmask;Gateway
root@Benedict:/etc/NetworkManager/system-connections# cat Auto C
For more info about getting your wireless network up; do a google search; the info is out there!
Next up: nmcli
At any rate; nmcli (command-line tool for controlling NetworkManager) wont be much help beyond listing data as “It is not meant as a replacement of nm-applet or other similar clients. Rather it’s a complementary utility to these programs.” You do need it to at least find out more about the connections, UUIDs and what NM is doing..
“nmcli con” lists the available connections
# nmcli con
NAME UUID TYPE TIMESTAMP-REAL
Wired 472a4a85-b432-446c-a704-c7df7b7f5e3e 802-3-ethernet Wed 11 Jan 2012 12:18:48 AM CET
Wired connection 1 472a4a85-b432-446c-a704-c7df7b7f5e3e 802-3-ethernet Wed 11 Jan 2012 12:18:48 AM CET
C e99af4da-5c7a-495e-b1ec-45c81519ad32 802-11-wireless Wed 11 Jan 2012 12:18:48 AM CET
The wired connection is my fresh; hand made connection; C wireless network was configured using the gnome interface; the “Wired connection 1” was created automatically by NM. Your new connection wont show up however without the right UUID, You need to copy the UUID for the connection you want to use to the config file.
Restarting the networking will choose the configuration file instead of the best effort config.
# /etc/init.d/networking restart
After restarting the connection, the best effort “Wired connection 1” vanished. I havent found anything about how to influence what connection is used when the best effort choice isnt the right one, but only need the one so I didnt really look either 🙂
I hope this helps