RIP – Autosummary convergence

The Routing Information Protocol (RIP) was one of the most commonly used interior gateway protocols, although it is a little outdated it still sees a lot of use.

In this example i have the following configuration:

Rip autosummarizes the subnets which are assigned to it by default,so if we where to assign an IP address of 10.2.2.1 255.255.255.252 to S0/0 the routing update that neighboring routers would get is:

R 10.0.0.0/8 [120/1] via 10.2.2.1, 00:00:11, Serial0/0/0

From The line above we can see that the routing update came from RIP, and we have a route to 10.0.0.0 through 10.2.2.2.

So, whats wrong with this you may ask? well if on Router2 we have another link to Router3 with an address of 10.2.2.1/30 then this IP will full into the 10.0.0.0 range that RIP gave us for the S0/0 link.

To fix the above situation we would do the following:

Disable the auto-summarization option in RIP, login to your router and run:

Router1#config terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router rip
Router1(config-router)#no auto-summary
Router1(config-router)#end

Once you have added this command to all routers you will need to clear the routing table in order to receive the new updates from RIP. To clear the table run:

Router1#clear ip route *

With the no-autosummary command in use on all routers this is the result:

Router1#show ip route
Gateway of last resort is not set

10.0.0.0/30 is subnetted, 2 subnets
C       10.2.2.0 is directly connected, Serial0/0/0
R       10.2.3.0 [120/1] via 10.2.2.2, 00:00:24, Serial0/0/0
Router1#
Router2#show ip route
Gateway of last resort is not set

10.0.0.0/30 is subnetted, 2 subnets
C       10.2.2.0 is directly connected, Serial0/0/0
C       10.2.3.0 is directly connected, Serial0/0/1
Router2#
Router3#show ip route
Gateway of last resort is not set

10.0.0.0/30 is subnetted, 2 subnets
R       10.2.2.0 [120/1] via 10.2.3.2, 00:00:09, Serial0/0/0
C       10.2.3.0 is directly connected, Serial0/0/0
Router3#

Please post any comments or suggestions.

How to delete an undeletable file

In this article I will be going over a method to delete an undeletable file that doesn’t require safe mode or killbox. The only requirement for it is that you are using Windows XP Professional/Corporate with Simple File Sharing turned off.

First of all find the undeletable file and right click on the file and click Properties on the menu that appears. When the properties load up click on the “Security” tab at the top of the file properties window. You should see something similar to this:


Windows XP Security Tab

Click the “Advanced” button at the bottom of the properties window and then uncheck the box “Inherit from parent the permission entries that apply to child objects. Include these with entries explicitly defined here.”. A messagebox will appear warning you about unchecking it and giving you three options: Copy, Remove and Cancel. Select “Remove”.

This will remove all the permissions to the file so if you just finished now nothing would be able to access the file, but it would also mean we can’t delete it so we need to add permissions in for us to delete it.

Click on the “Add” button which will bring up a dialog box “Select User or Group” click on Advanced down the bottom and then “Find Now” on the right hand side. This will list all the users and groups in your system. Find and select your user then click “OK”. It will return to the “Select User or Group” dialog and you can just click “OK” here again.

Now for the permissions. First click on the checkbox under Deny for “Full Control”. This will block all access of. Then click the Allow checkbox for “Delete”. It should look like this:


Deny all permissions Allow Delete

Click “OK” if it the checkboxes are as in the image, and keep clicking OK until the file properties window is gone. Now nothing in your system can run the file including SYSTEM itself. Heres a picture of what happens if you try to run it:

Trying to run a permission blocked program

Now that you’ve blocked it from being executed at all you can either use Task Manager or Process Explorer to end the program. If it’s spyware and is one of the several around these days that use Winlogon you will need to restart your computer to stop it. Otherwise if its a dll file you can use Process Explorer to find what application is using the dll file and provided its not a required windows system exe you can end the task in process explorer and it won’t be able to open the file again allowing you to delete it.

Please post any comments or suggestions.

VMware Guests Time Runs Too Fast!

While setting up my latest server i encounter an issue i have never come across before, in my VMware guest machine the time was flying very quickly into the future. Could this be time travel?

Unfortunately not, its caused by the CPU frequency scaling on a multi-core processor and by default VMware doesn’t quite no how to deal with it yet.

To rectify this issue you have to set your CPU’s max frequency into /etc/vmware/config.

To find your cpu’s frequency you have two options, the first:

$ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 

2000000

The second:

$ cpufreq-info

cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006

Report errors and bugs to linux@brodo.de, please.

analyzing CPU 0:

  driver: centrino

  CPUs which need to switch frequency at the same time: 0

  hardware limits: 1000 MHz - 2.00 GHz

  available frequency steps: 2.00 GHz, 1.33 GHz, 1000 MHz

  available cpufreq governors: userspace, powersave, ondemand, conservative, performance

  current policy: frequency should be within 1000 MHz and 2.00 GHz.

                  The governor "ondemand" may decide which speed to use

                  within this range.

  current CPU frequency is 1000 MHz.

analyzing CPU 1:

  driver: centrino

  CPUs which need to switch frequency at the same time: 1

  hardware limits: 1000 MHz - 2.00 GHz

  available frequency steps: 2.00 GHz, 1.33 GHz, 1000 MHz

  available cpufreq governors: userspace, powersave, ondemand, conservative, performance

  current policy: frequency should be within 1000 MHz and 2.00 GHz.

                  The governor "ondemand" may decide which speed to use

                  within this range.

  current CPU frequency is 1000 MHz.

As my MAX CPU frequency is 2.00GHz i added these lines to /etc/vmware/config

host.cpukHz = 2000000

host.noTSC = TRUE

ptsc.noTSC = TRUE

All that is left to do now is restart VMware and test the results.

The above commands where performed on:

Host: VMware Server 1.5.0 running on a 2.6 kernel

Guest: Ubuntu 8.04 Hardy Heron

Please post any comments or suggestions.

Mdadm – Growing Raid5 Array (Ubuntu)

Mdadm is used to create, manage, monitor, and maintain raid arrays.

In this simple guide I will be demonstrating the steps used to grow a raid5 array from 3 HDD’s to 4.

Prerequisites

  • Mdadm running a raid5 array
  • Linux kernel > 2.6

Steps

  1. Check the current raid array
  2. Partition the new HDD
  3. Add the new HDD to the raid array
  4. Extend the file system onto the free space

Check the current raid array

Examine the current raid5 array to ensure all HDD’s are currently active

At the console, type:

$cat /proc/mdstat

The output should be similar to the following:

md0 : active raid5 sdc1[0] sdd1[2] sdb1[1]

1465151808 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

Here we can see that all drives are active and part of the array.

An example of a failed array:

md0 : active raid5 sdc1[0] (f) sdd1[2] sdb1[1]

1465151808 blocks level 5, 64k chunk, algorithm 2 [2/3] [_UU]

In this example we can see sdc1 has failed, this can be determined by the “(f)” after the HDD name and “[_UU]” instead of “[UU]” in the output. The failed drive will need to be replaced before you attempt to grow the array size.

Partition the new HDD

Once you have added the new HDD to the machine, check its assignment:

$cat /proc/diskstats

Output:

8   65 sde1 168430629 1886732648 70507758 564062064

As you can see we have a new drive, referenced as “sde1”

The next step is to partition the new drive for the raid array, using:

$sudo FDISK /dev/sde

Replace “sde” with your new HDD

Now choose the following options:

Type "n" to add a new partition, use the default settings
Press "t" to change the partition type, now press "fd" to set the partition type to Linux raid autodetect
Press "p" to check the partition table

The output of “p” should be similar to:

Device Boot      Start         End      Blocks     Id  System

/dev/sde1        1             60801    488384001  fd  Linux raid autodetect

Make sure the System type is set to “Linux raid autodetect”. Once you are sure everything is correct press:

"w" to write the changes to the partition table

If the system type wasn’t set to “Linux raid autodetect” then make sure you select “fd” in the “t” menu.

Ok, your new drive is now ready to add to the array.

Add the new HDD to the raid array

First off run:

$sudo mdadm –add /dev/md0 /dev/sde1

Replace “/dev/md0” with your current raid array and “sde1” with your new HDD. This informs mdadm of the new HDD

Now run:

$ sudo mdadm –grow /dev/md0 –raid-devices=4

Replace “/dev/md0” with your current raid array.

This will tell mdadm to grow the current array onto our new HDD which was added before with the “mdadm -add” command.

While the array is growing (can take several hours) you can view the current status by running:

$cat /proc/mdstat

To speed up the growing of the array you can run the command:

$echo 25000 > /proc/sys/dev/raid/speed_limit_min

Finally once the array has finished growing check:

$cat /proc/mdstat

It should look similar to the following:

md0 : active raid5 sdc1[0] sde1[3] sdd1[2] sdb1[1]

1465151808 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

As we can see all drives are active, from “[UUUU]”. The number of U’s being displayed is equal to the number of drives in your array, so if you grew it to 5 HDD’s it will display 5 U’s etc.

Extend the file system onto the free space

Now its time to move onto expanding the current file system onto the free room on the array. We will first need to unmount the current raid array using:

$sudo umount  /dev/md0

Replace “/dev/md0” with your raid array.

Now we use the e2fsck command to check the file system (will take around 10 minutes on a 1TB array):

$e2fsck -f /dev/md0

Once again replace “/dev/md0” with your raid array.

Now run:

$sudo resize2fs /dev/md0

This will expand the current file system onto the free space. (took around 15 minutes for 1 TB)

Once the expand is complete you can remount your array:

$sudo mount /dev/md0 /media/raid

Replace “/dev/md0” with your raid array and “/media/raid” with the directory you wish to mount the file system into.

You should now have an expanded raid5 array, Please post any comments or suggestions.