Raspberry PI Raspbian Static IP Address Configuration

Glad you found this! If you just Google, you’ll find lots of bad advice. This article applies to Raspbian circa 7.0

$cat /etc/debian_version      # to see your release version

The Raspbian’s default image, as circulated via the Pi’s website, has dhcp configured and turned ON by default. It is, after all, designed for noobs. If you want to set a static IP address, you might be tempted to use ifconfig or the ip command to do so. Don’t! Here’s the correct way to do it:

$cd /etc/dhcp
$vi dhclient.conf

This will put you into the vi editor to edit dhclient.conf … if you can’t or won’t use vi, then use your favorite editor instead.

Take a look at the bottom of the file. What you want to do is uncomment either the alias section, or the lease section, and make the appropriate changes.

#alias {
#  interface "eth0";
#  fixed-address;
#  option subnet-mask;

#lease {
#  interface "eth0";
#  fixed-address;
#  medium "link0 link1";
#  option host-name "andare.swiftmedia.com";
#  option subnet-mask;
#  option broadcast-address;
#  option routers;
#  option domain-name-servers;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;

So which should you chose? Are you sure you want to ask? If the answer is “yes”, do this:

$man dhclient.conf

I chose to use a lease for minimum impact on my network. I just wanted a simple setup: no bells and whistles.

lease {
  interface "eth0";
#  medium "link0 link1";
  option host-name "pi.mydomain.com";
  option subnet-mask;
  option broadcast-address;
  option routers;
  option domain-name-servers;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;

Some explanation is called for here…

  • “option broadcast…” isn’t really necessary if you’re on a 192.168.x/24 subnet
  • “” is one of the Google name servers. If you value your privacy, use Level(3) or the like instead

Empathy vs. Pidgin – Chat Client Showdown

I installed yet another instance of Ubuntu running in Oracle’s Virtual Box as a way of maintaining sanity in a WinDoZe environment. I am now hooked on the host+L integration with the Windows desktop, and have even learned to jocky the two taskbars over the same spot with autohide on. As a bonus, I do most of my surfing over a VPN on Ubuntu, and only got to websites on the WinDoZe side that I’m OK with having snooped (by my employer, ISP, Homeland Security, and who knows who else…)

Time to install a chat program. It will also be running over the VPN. Ubuntu comes bundled with Empathy, but Pidgin claims to have a small(er?) footprint. I installed Pidgin and fired it up with Empathy also running. Here’s the result?

$ ps axv | grep ...
2068 ?        Sl     0:00     19  1354 116461 21248  1.6 empathy
3899 ?        Sl     0:03    412  1004 160971 67560  5.3 pidgin

As you can see Empathy wins. In addition, Empathy squanders less screen real estate, so its more compact presentation is a bonus.

AIM Lite – Dead? Broken? (solved!)

As a mostly non-windows user, I try to keep my windows machine Lite. Not much I need it for these days. I do run an AIM IM client, “AIM Lite” – it’s very old hasn’t been updated in ages. It has a very small memory footprint, and is light on resource utilization as well as features. Monday, I fired it up to communicate with several AIM friends, and found it couldn’t connect.

Looks like AIM changed something in its server definitions. If you’ve experienced this or something related, comment below!

2/12/2012 – Solved by reader Toddkay!

Simply go into Settings and under the General tab, just set “Use Advanced Server” to NO. What this does is automatically change the connection host to “slogin.oscar.aol.com” and port 5190. And voila! AIM Lite is back!

Thanks for the comments. I briefly started using Pidgeon, because it is pretty vanilla, GTK+, small, and supports the protocols I need like IRC, Google, and Yahoo!

HOWEVER… I have gone back to using AIM Lite, because in the end it’s the smallest.

NIS a/k/a YP

Disclaimer: This post is not for newbies, and is a work in progress!

We’re using YP in a low security (walled in) development environment. The convenience of yp and automount NFS is key, and the downsides don’t apply. None of the machines are exposed to the Internet.

It’s just like the good old days of SunOS (BSD 4.3) or maybe even a working version of Solaris (the first versions of Solaris were horribly buggy). This post will provide a lot of detail in getting YP tamed in an environment that uses both CentOS 5.5 and Ubuntu 11.04 (Natty Nahrwal).

First, let us note that the code bases for NIS on CentOS (Red Hat) and Ubuntu seem to be different. They behave differently. They default differently. They seem to have different bugs. And they interact with nsswitch.conf differently.

NIS in CentOS 5.5

$ yum install nis

In an environment where CentOS is being used as a server OS, and not a desktop OS (our case), NIS works out-of-the-box the way you probably want it to. Which is scary, because it’s not supposed to do that. As a point of reference, I’ll refer to the first edition of Managing NFS and NIS by O’Reilly by Hal Stern (April 1992 edition). This book was written based on SunOS, and since I no longer have any instances of BSD4.3 around, it will have to do as a baseline.

So, NIS does what you want it to do, that is, underlay passwd, group, and hosts. However, you don’t have to make any changes to the affected files to make this happen! You can change the behavior in nsswitch.conf.

NIS in Ubuntu

$ apt-get install nis

When you install NIS this way, the assumption is that you’re installing a client (only). A nice little dialogue box pops up during install to as for the domain you wish to connect to (it assumes that domain exists and that all is awesomely perfect). Be sure you know what the domain is (or is going to be) before you do the apt-get.

If you have a server,and it has broadcast communication with the client, and nothing is blocked by the likes of iptables (YP uses RPCs), it will come right up. But, you’ll probably need to edit /etc/nsswitch.conf to have anything close to the functionality you want. And, how about that nsswitch.conf? There’s a lot of stuff in there!

I’m using this on my Laptop, which is running Ubuntu 11.04 most of the time. When I start up the VPN connection to the lab environment, I simply issue a:

$ sudo service nis start

… and when I’m done, and ready to close down the VPN,

$ sudo service nis stop

… which I usually forget to do and regret later when the RPC calls hang and I have to wait for them to time out before I unfreeze! :-P


to be continued…

Changing The Default OS to Boot in Grub (Ubuntu, etc.)

Dual booting Ubuntu with some version of Windows is highly desirable for many of us. It allows you have the ability to revert to the legacy Windows operating system when you want to run a video game or some other application that hasn’t been implemented on Linux yet. Some of us with domestic partners, or pets/children, have the need to make the default O/S that boots Windows. For example, my pet gerbil designs websites for a living, but has has trouble with Ubuntu.

With the release of Natty (Ubuntu 11.4) startupmanager no longer works to select the O/S to boot. While there are alternative applications, it would be nice to have a simple way to configure this. After spending some time researching the matter, I have found the answer (for those using Natty Ubuntu, or an installation of Linux with Grub2 1.99 or possibly later):

sudo grub-set-default 4

The number 4 is the position in the list of actions Grub displays during boot. The first entry, usually the most recent Linux kernel you’ve installed, is entry0. On my machine, Windoze XP was the 4th (again, starting from 0).

Note that if a new kernel is installed, or if for any reason other entries are added to the Grub list, then your change will be broken, and you’ll need to enter the new position of the desired entry. But now you know a one-liner that will fix it.

If grub-set-default doesn’t work on your machine, then it probably won’t work on your machine: know what I’m sayin’ ?

Netscreen 25 Search Domain Configuration

We set up an old Junper Netscreen 25 firewall/router to partition off a part of the local LAN and free up some IPs. We put about 30-40 clients devices on it and the router worked fine other than being limited to 100BaseT.

The problem was, DHCP clients were getting “netscreen-25” as the search domain. The PC’s were only slowed down a tad, but some CentOS machines got severe indigestion, name resolution-wise. Manually removing the “netscreen-25” SPAM from /etc/resolv.conf solved that problem. The web interface had no knobs or switches to control this behavior.

The solution was to issue the following command for each interface on which DHCP info was being handed out:

set interface ethernet2 dhcp server option domainname ourthing.local

Obviously, above you’ll replace “ourthing.local” with the domain you want searched first (for unqualified names). Replace the ethernet interface number as appropriate. I didn’t get a chance to figure out how to have nothing handed out there; if you have please let us know in a comment!

The hurt about using this rig is that it doesn’t support IGRP (although it supports BGP and OSPF!) and it doesn’t provide much in the way of reporting. In our case, it didn’t cost anything and helped make more room in the discard pile. The Netscreen 25 has an MTBF of 8.1 years, according to Juniper. Older models may not have the Juniper name on the face.

For the best synopsis of this old rig I could find as of this writing, look here.