Thursday, June 5, 2008

Hardy Heron woes... network-admin

So the new network app is irritating. There are a couple of flaws over the previous version. Just to be clear, I'm talking about /usr/bin/network-admin.

First, the entrance to this app changed. In the previous version, I'd start it and it would detect that I'd started it as a non-root user, so it would prompt me for a password. The focus was on the password box, so all I had to do was type in my password and hit enter, then I was into the app and able to edit. Now starting the app brings it up immediately, but now I have to click the "Unlock" button to do anything. The app is useless without unlocking, and the point of accessing it is to do something. Clicking the "Unlock" button brings up a dialog to enter my password, so really, it is the exact same functionality other than now I have to click an extra button to get into the app.

Second, and I don't think this is necessarily a new bug since I see it on my wife's laptop with gutsy, is that it doesn't remember the settings for my wireless card. My wireless router is set for WPA2, so I've set that in the network-admin app along with the password. Neither of the settings are remembered, the app always comes up with WPA and the password is blank.

To get around this, I've written a script and a few configuration files. The script is pretty simple, it just copies the appropriate file to the right place, then restarts networking. I put these files in ~/bin. Here's the script:

-------

#!/bin/bash
case $1 in
home)
sudo cp ~/bin/interfaces-home /etc/network/interfaces
sudo cp ~/bin/resolv.conf-home /etc/resolv.conf
sudo /etc/init.d/networking restart
;;
work)
sudo cp ~/bin/interfaces-work /etc/network/interfaces
sudo cp ~/bin/resolv.conf-work /etc/resolv.conf
sudo /etc/init.d/networking restart
;;
*)
echo $0 home\|work
;;
esac

-------


Then the two files, one for my home network, and one for work.

This one for home sets up both eth0 (wired) and eth1 (wireless) interfaces.

interfaces-home file contents:

-------

auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

iface eth0 inet static
address 192.168.99.7
netmask 255.255.255.0
gateway 192.168.99.1

iface eth1 inet static
address 192.168.99.6
netmask 255.255.255.0
gateway 192.168.99.1
wpa-psk 94292f8d8ce41907c34e84fd21e6980c32b3ac997c621c2cfa 3dcf15b73b2b7a
wpa-driver wext
wpa-key-mgmt WPA-PSK
wpa-proto WPA2
wpa-ssid myssid

auto eth1

-------


And the associated resolv.conf-home file:

-------

nameserver 4.2.2.1
nameserver 4.2.2.2

-------


This one for work is a little simpler since it's a dhcp managed network.

interfaces-work file contents:

-------

auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

iface eth0 inet dhcp

auto eth0

-------



The associated resolv.conf-work just has the work nameservers listed.

Now I just run the script to change networks instead of using network-admin. This is easier, and more user friendly, which is an odd thing to say when discussing an Ubuntu installation. :)

No comments: