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
/etc/NetworkManager/system-connections/
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
[802-3-ethernet]
duplex=full[connection]
id=Wired 2.44
uuid=6a6e191a-4a8b-47ea-bc38-ef8b98748281
type=802-3-ethernet
timestamp=1318578920[ipv6]
method=ignore[ipv4]
method=manual
dns=192.168.2.1;
addresses1=192.168.2.44;16;192.168.2.1;
The “addresses1=192.168.2.44;16;192.168.2.1;” is formatted as IP;Netmask;Gateway
or
root@Benedict:/etc/NetworkManager/system-connections# cat Auto C
[connection]
id=Auto C
uuid=b6006760-005b-4fc7-b29a-f3565b6fdd8e
type=802-11-wireless
permissions=user:gert:;
timestamp=1320427786[802-11-wireless]
ssid=C
mode=infrastructure
seen-bssids=00:18:aa:aa:aa:aa;
security=802-11-wireless-security[802-11-wireless-security]
key-mgmt=wpa-psk
wep-key-flags=1
psk-flags=1
leap-password-flags=1[ipv4]
method=auto[ipv6]
method=ignore
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