Watching an interface on McAfee’s Sidewinder with Perl


One of our requirements with one of our customers is to perform regular and routine failover tests. As the interface is not responsive to providing information about when service has failed from Primary to Secondary and back again, I have found [1] and modified this perl script to run on the SECONDARY NODE to show the interface address of one NIC every 5 seconds. I’ll also show how to slightly modify the script with different time delays and interface names. Please note, there may be much better ways of doing this. I needed something in a hurry, and this gave me what I needed. If you’ve got any better ideas, please drop me a note at or update this script yourself :)

Steps to perform

  1. SSH to the Secondary node.
  2. Check you’re not already primary with the command ifconfig em0 | grep inet this should return one line showing something like inet netmask 0xffffff00 broadcast
  3. Please note the exact syntax of this command – perl is a tricky beast at the best of times, and if you don’t have your apostrophies and backticks in the right place, it won’t run right!

    Type this command: perl -e ‘for (;1;) {print `ifconfig em0 | grep inet`; print `date`; sleep 5}’ and press return. This loops until you press Ctrl+C, showing the line, like I showed you before starting inet and then the next line shows a date and time – this is so you don’t go crazy and think the process has stopped…

  4. Perform your action to provoke fail-over [2], which may be to unplug an interface attached to the primary firewall, reboot the firewall or unplug a switch directly attached to the firewall. In response (and after approx 1 minute, based on your HA configuration) you should now see in the script’s output, it now shows two lines – as follows:

    inet netmask 0xffffff00 broadcast
    net netmask 0xffffff00 broadcast

  5. Perform your failback and after 1 minute or so, it should revert to just the single line – or equivelent for your network.

Breaking down the script

Here, I’ve broken down the command before with short blocks of information about each part of the command you’re running.

perl (which is a scripting language) -e (which means “evaluate the following string in quotes”) (that’s an apostrophy – the symbol on my keyboard at least, below the @ character) for (;1;) (note, those are normal brackets – shift+9 and shift+0, which, in combination with the for and ;1; bits, means loop around the following commands forever, or until the break command is sent) { (that’s a curled brace symbol – shift and the character next to the letter P) print (sends the following string) ` (backtick – the character to the left of the 1 key – which means execute the command between two of these symbols and return the result) ifconfig em0 (get the interface configuration for the interface em0) | (the pipe or bar character – next to the letter Z) grep inet (grep is a unix command to search for strings – in this case, the string inet which identifies the IP address) `; (backtick again and then a semicolon to say stop running that command and start doing the next thing) print `date`; (print the response from the command “date” – which returns a date string – and then do the next command) sleep 5 (the sleep command waits integer X number of seconds – here 5, but you could easily say 2 or 10 here – depends on how impatient you and the project manager are!) } (curly brace – meaning to close the for loop from near the beginning) (apostropy – which instructs it to close the string that the perl interpreter is evaluating)


[1] from – sadly, we can’t use the watch command on a Sidewinder, as it doesn’t have it installed.
[2] Assuming your firewall is in a Primary/Standby configuration (not Standby/Standby), has enabled “Monitor link status” and has addresses to monitor with – presumably the non-HSRP addresses of your attached routers attached to that interface.


I recently was asked how to provide an RDP session to a Linux Machine. Phoowey! I replied, you can’t RDP to a Linux box, and yet, someone I work with pointed me in the direction of XRDP – a package on Sourceforge.

I performed the following steps on a VMWare host running Ubuntu 8.10, but there’s no reason why it shouldn’t work on 9.04 or even 8.04.

Why would you want to RDP to a Linux machine? If you’ve got a windows host, you don’t always want to be running more and more different software to access that remote host – like VNC or X over SSH, so this seems like an effective solution if you don’t want your client machines to need additional software.

Some people don’t like to permit SSH through their firewalls as you can do an awful lot with a badly configured SSHd. In another situation, we have been using a device (which I don’t manage I should add) to access a development network. This device acts as a reverse proxy, and permits access to various websites, but most importantly, also proxies access to RDP systems, so this request was driven by that need.

Here’s what I did to configure up the XRDP on this Ubuntu 8.10 desktop

# apt-get install build-essential libpam0g-dev libssl-dev tightvncserver

Visit then click on Download, Browse all packages, click on the latest release (currently 0.4.1), Copy the link for filename xrdp-x.x.x.tar.gz

# wget http://path/to/file/xrdp-x.x.x.tar.gz
# tar xfz xrdp-x.x.x.tar.gz
# cd xrdp-x.x.x
# make
# sudo make install
# cp /usr/local/xrdp/ /etc/init.d/
# update-rc.d -f defaults

Using Posterous with Ubiquity… really *really* easily. #Tutorial

Connect the web with language.

Ubiquity is an experiment into connecting the Web with language in an attempt to find new user interfaces that make it possible for everyone to do common Web tasks more quickly and easily. It’s a Firefox extension, so it works on Macs, Windows, and Linux.

With only a couple keystrokes, it lets you use language to instruct your browser. You can translate to and from most languages, add maps to your email, edit any page, twitter, check your calendar, search, email your friends, and much more. All without leaving the page you’re on.

See, this is why I like the Internet. Some of you will have heard of Posterous – that funky site where you e-mail them with your pictures, videos and the like, and they just *host* it.

All of it.

Yehr, the lot.

You get to have your own domainname (like mine is and you can even have it auto-update your blog, your twitter stream, and all sorts (although they still don’t support… damn you Garry! :) )

But just recently, they said “Here, take this bookmarklet and use it as you will.” so I did. I went

But I don’t know about you – I’m all for maximising my screen real estate, so I ditched my bookmarks bar ages ago, so now I have to drag my poor mouse all over the screen to get to the button.

In the mean time… I discovered Ubiquity, which is an add-on for Firefox. It’s pretty cool, and it acts like a command line for the web. I was showing off it’s translation skills today with a colleague, and discovered there was a function called create-bookmarklet-command-from, so I put that in, and added “Share on Posterous”… and what do you know, if I now highlight some of the page and hit Ctrl+Space (my shortcut to Ubiquity), I then type share-on-p, it pops up, well, the box I’m currently typing in!

Now, you may think, hangon, he’s *already* dragging his mouse around the screen – why doesn’t he just click on the bookmarklet? That’s a really good question. The answer is, I’m not. Hit F7 and you can turn on the text-mode cursor! So I click once, then Shift and cursor around to highlight my text and then Ctrl+Space share-on-p and then get to write my stuff in here!

Oh, and what does that command actually look like?


name: “share-on-posterous”,

url: “javascript:var%20b=document.body;var%20POSTEROUS___bookmarklet_domain=’’;if(b&&!document.xmlVersion){void(z=document.createElement(‘script’));void(z.type=’text/javascript’);void(z.src=’’);void(b.appendChild(z));}else{}”


Yep, that’s right, four lines of code, two of which just make it a script and one which *names* the script (and yes, if you want, you can rename it here too).

So, it’s all good :)

I know it’s an April Fools, but… from ThinkGeek – Tauntaun Sleeping Bag


Slumber in the Belly of the Beast

In the sub-zero wasteland of the planet Hoth, only the strong survive… and of course those lucky Jedi protected by the thick skin of a Tauntaun. Now after exhaustive movie viewing research and analysis ThinkGeek Labs has isolated the exact synthetic compounds needed to re-create Tauntaun fur. What have we done with this supreme knowledge? Created a Tauntaun sleeping bag of course.

This high-quality sleeping bag looks just like a Tauntaun, complete with saddle, internal intestines and glowing lightsaber zipper pull. Now when your kids tell you their favorite Star Wars movie is “Attack of the Clones” you can nestle the wee-ones snug in simulated Tauntaun fur while regaling them with the amazing tale of “Empire Strikes Back”.

Use the glowing lightsaber zipper pull on the Tauntaun sleeping bag to illustrate how Han Solo saved Luke Skywalker from certain death in the freezing climate of Hoth by slitting open the belly of a dead Tauntaun and placing Luke inside the stinking (but warm) carcass. If your kids don’t change their tune on which Star Wars film is the greatest ever, you can do your best Jar Jar impression until they repent.

Product Features

  • Classic Star Wars sleeping bag simulates the warmth of a Tauntaun carcass
  • Built-in embroidered Tauntaun head pillow
  • Glowing Lightsaber zipper pull
  • Great for playing pretend “Save Luke from the Wampa” games
  • Teach your children about the best Star Wars movie ever
  • Fully Licensed Lucasfilmâ„¢ Collectable
  • Fits children (and small adults)
  • 100% Polyester construction, Machine washable
  • Exterior Dimensions – 32″ x 60″

Oh my god, this is *so* wrong!