Saturday, April 5, 2008

CCIE practice - My new desktop environment in Ubuntu

After having taken the decision to move to Ubuntu for all the future dynamips labs, i sat down and tried to create a comfortable desktop environment in Ubuntu like the one i had in Windows.

By default Ubuntu comes with 2 workspaces. I added one more (right click on a workspace in the bottom/right corner, choose Preferences and increase the number of columns), so i'm having 3 in total. I'll be using the 2nd workspace for all my routers' consoles and the 3rd one for all my switches' consoles. The 1st one is going to be used for everything else; browser windows, new shells, etc. You can very easily move between workspaces by using this keyboard shortcut: CRTL+ALT+Left/Right Arrow.

I then created 10 new launchers (6 for routers, 4 for switches) in the bottom panel. You can add them in the top panel if you like, or you can create a new panel and add them there. You can also use a dock utility or anything else that can group icons and execute programs by clicking on them. As i have already written in a previous post of mine, i prefer the concept of a window per router/switch instead of using the terminal server and a single window for all the routers/switches. After all, in the lab you're given the option of both.

I also created 10 icons for these launchers, each one representing a router or a switch : R1-R6 and SW1-SW4 (you can see my icons below). Since i'm not a graphic designer, you can always use your own icons if you don't like mine. The icons are stored in a new directory i created under "/usr/share/icons/", called "dynamips".












In order to create a launcher, you can do the following:

Right click on the panel you want to add the launcher on and choose "Add to Panel...". Then choose "Custom Application Launcher" and enter the following:


Type : Application
Name : R1
Command : xterm -T R1 -geometry 80x30 -fn -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-* -sb -sl 5000 -rightbar -e telnet 127.0.0.1 2001


For every router/switch, you'll have to change the "R1" word (in Name and Command) and the "2001" port (in Command). The port number should be the same as the console port for this router/switch in your net file.

In the command field you can use your own terminal program if you don't like xterm. The options i used for xterm are the following:


-T R1 : title of the window
-geometry 80x30 : dimensions of the window in columns x rows
-fn -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-* : font used in the window (you can use "xfontsel" to see the available fonts)
-sb : display a scrollbar in the window
-sl 5000 : keep 5000 lines of scroll buffer
-rightbar : display the scrollbar on the right of the window
-e telnet 127.0.0.1 2001 : execute this command into the xterm window (this command has to be the last one)


There are many tricks to avoid configuring all these parameters for all routers/switches.

i.e. you can create an alias of xterm with these options (besides the -T, -e and maybe -geometry) already defined and use that command instead:


alias xterm-dynamips='xterm -fn -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-* -sb -sl 5000 -rightbar'


or you can define them in the .Xresources file in your home dir (and restart X), but then these will have effect for every xterm window.

If you don't want to allow Ubuntu/Gnome to automatically choose the positions that the xterm windows open, you can be more specific in the "-geometry" option. In my case, where i have 2 different workspaces for the xterm windows and a resolution of 1280x1024, i used the following options for each router/switch.

Workspace 2
R1 : -geometry 80x30+0+0
R2 : -geometry 80x30+680+0
R3 : -geometry 80x30+0+660
R4 : -geometry 80x30+680+660
R5 : -geometry 80x30+0+330
R6 : -geometry 80x30+680+330

Workspace 3
SW1 : -geometry 80x30+0+0
SW2 : -geometry 80x30+680+0
SW3 : -geometry 80x30+0+660
Sw4 : -geometry 80x30+680+660

On the top/left corner of the "Create Launcher" window you can see the default icon used for this kind of launcher. By clicking it, you can change it and use the one i said above.



After repeating this process for every router and switch, you'll end up with something like this in the bottom panel :



If you want to move each icon as close as possible to the other, you can right click at the icon you want to move and choose "Move" from the menu. That way you can have very precise placement of your icons.

Keep in mind that all these launchers are saved as text files in the "~/.gnome2/panel2.d/default/launchers" directory :


xxx@ubuntu:~/.gnome2/panel2.d/default/launchers$ ls -al
total 56
drwx------ 2 xxx xxx 4096 2008-04-05 20:37 .
drwx------ 3 xxx xxx 4096 2008-03-29 18:13 ..
-rw-r--r-- 1 xxx xxx 5538 2008-04-05 15:57 gnome-terminal.desktop
-rw-r--r-- 1 xxx xxx 330 2008-04-05 20:36 xterm-1.desktop
-rw-r--r-- 1 xxx xxx 328 2008-04-05 20:36 xterm-2.desktop
-rw-r--r-- 1 xxx xxx 332 2008-04-05 20:37 xterm-3.desktop
-rw-r--r-- 1 xxx xxx 363 2008-04-05 20:32 xterm-4.desktop
-rw-r--r-- 1 xxx xxx 365 2008-04-05 20:32 xterm-5.desktop
-rw-r--r-- 1 xxx xxx 365 2008-04-05 20:32 xterm-6.desktop
-rw-r--r-- 1 xxx xxx 367 2008-04-05 20:32 xterm-7.desktop
-rw-r--r-- 1 xxx xxx 365 2008-04-05 20:35 xterm-8.desktop
-rw-r--r-- 1 xxx xxx 367 2008-04-05 20:35 xterm-9.desktop
-rw-r--r-- 1 xxx xxx 330 2008-04-05 20:36 xterm.desktop
xxx@ubuntu:~/.gnome2/panel2.d/default/launchers$


and each one of them has the following contents:


[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Terminal=false
Icon[en_US]=/usr/share/icons/dynamips/SW3.png
Exec=xterm -T SW3 -geometry 80x30+0+660 -fn -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-* -sb -sl 5000 -rightbar -e telnet 127.0.0.1 2009
Icon=gnome-panel-launcher
GenericName[en_US]=
Name[en_US]=SW3
Name=SW3


If you're wondering where are the 3 BB routers, the answer is that i don't need to have console access to them all the time. I can always access them through the telnet command of dynagen, when i need to.

Clicking on any icon, won't do anything right now, because dynamips is not running. So start dynamips, then start all routers/switches through dynagen and voila! You have 2 workspaces filled with xterm windows.

In order to display the 6 routers' windows in the 2nd workspace and the 4 switches in the 3rd workspace, you have to click on the 6 R1-R6 icons while viewing the 2nd workspace and then move to the 3rd workspace and click the 4 SW1-SW4 icons.

There is also a program available (DevilsPie) if you want to define the workspace where each application window opens automatically, but it relies on pre-defined scripts.

I must admit that the feeling is much better in comparison to my Windows environment. I have access to all windows simultaneously and if i want i can move the SW1-SW4 windows to the same workspace as the R1-R6 ones, in order to resemble my Windows environment more closely.

Finally, some hints for xterm:

Ctrl + Left mouse click opens a menu with options for logging to a file (the default name is something like Xterm.log.ubuntu.2008.04.05.18.54.10.12838, where 12838 is the current xterm process number).
Ctrl + Right mouse click opens a menu with options for changing the font size.
Ctrl + Middle mouse click opens a menu with various options regarding xterm appearance/behavior.

4 comments:

  1. Only 3 workspaces? I'm surprised. Originally I only used 2 at max, but after 5 months of Ubuntu use I can't live with less than 4 (6 currently).

    Nice shortcut setup, however.

    ReplyDelete
  2. Hi Daniel,

    In my job, i use a 3x2 desktop (with Solaris). But there it's a different story.

    In my home, right now i don't have the need for more workspaces, because i use ubuntu only for my cisco labs.

    If the need arises, i'll increase them.

    ReplyDelete
  3. Hello tassos>
    I am working on my ccie .still written exam though.
    but I need dynamips . so I just try to install ubuntu 8.0 on my dell 2.13ghz 2 gig ram machine.
    but couldnt get start it.
    it says validation error when i boot from cd rom which i downloaded and burnt to a cd.
    Can you give me any help for installing ubuntu 8.0 server on my PC.
    thanks in advance.

    ReplyDelete
  4. @batista,

    Although i haven't seen this error message before, i think you're probably using a corrupted CD. Try downloading and/or burning it again.

    ReplyDelete

 
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Greece License.