2012-05-25

Static network configuration in Ubuntu 12.04 "Precise Pangolin"

After upgrading my Ubuntu to Pangolin, my DNS resolution would not work any more. The exact reasons are not of interest here, I am in a corporate environment with a complicated proxy setup. I must edit /etc/resolv.conf, and configure my static DNS settings there.

However, Pangolin keeps overwriting this file, replacing it with a symlink, and tries to be clever in destructive ways. After a bit of fiddling, I found that Pangolin installs and runs a local DNS server (dnsmasq) without asking. This may make sense in a mobile environment, but here in my static setup, this makes no sense. Get rid of it.

sudo apt-get purge dnsmasq
rm -f /etc/resolv.conf
echo search mydomain.com > /etc/resolv.conf
echo nameserver 208.67.222.222 >> /etc/resolv.conf
echo nameserver 208.67.220.220 >> /etc/resolv.conf

Next, keep Network Manger from overwriting my configuration. Edit /etc/network/interfaces thus:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.177
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

iface wlan0 inet manual

This works for me. When clicking the network icon in the panel, the items "wired network" and "wireless network" are greyed out. That's OK for me, ymmv.

double colons in Bourne Shell function names

Bourne shell does not like double colons ("::") in identifiers. Other shells, e.g. bash, have no problems with them, and programmers like to use them for generating a pseudo-namespace look.

A problem arises when I want to write an include file that works for both, bash and sh.

Here is a workaround that lets me define function names in Bourne Shell with double colons in their name:

function foo__bar() {
  ...
}

alias foo::bar=foo__bar