Passed RHS333

I just passed another one of RHCA certificates – EX333 (Security: Network Services Certificate of Expertise).

It was the most difficult exams in RHCA courses. It required lots of detailed configurations and commands which was too much to me. By the way, I finished it so I just left one more to be RHCA.

Set up test environment with two virtual machines.

To test some problems usually I have to have two machines which is not easy to have. Especially if I have to configure it for each version, RHEL4, RHEL5, Fedora, etc.

Virtualzation comes here to solve those kinds of difficulty. But, just installing new operating system each time is also not a perfect solution. You should wait couple of hours before you can do test something. It’s also applied even though you already have that operating system because you need fresh system. Most easiest way is to use LVM’s snapshot feature.

Here are the steps I did to build my own test environment.

To use snapshot feature, you should make LVM partition first. There are many useful documentations for this steps. Easiest way to make room for virtual image is using ’system-config-lvm’ if you use Fedora or RHEL. With GUI, you can resize the existing volume and make new volume on the free space. This new volume will be the space for the original operating system.

If you preper command line tools, you can use ‘lvreduce’ for reducing exsiting filesystem’s size and ‘lvcreate’ for creating new logical volume.

In my case, I created logical volume for RHEL5U4 with name rhel5u4. Following is the output from ‘lvdisplay’ command.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  --- Logical volume ---
  LV Name                /dev/VolGroup/rhel5u4
  VG Name                VolGroup
  LV UUID                kkk383-IDE3-Lzh1-tKm4-a3YT-3k23-EIKFD5E
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                20.00 GB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

Create new virtual system with this volume. ‘virt-manager’ is a good tool to this. I’ll not describe how to install new operating system with ‘virt-manager’.

After installing new operating system and configured everything that will be necessary to work basically, you also need to edit ‘/etc/hosts’ file in this operating system if you want to make two different virtual machine easily communicate. I did it as following for my test environment.

1
2
192.168.122.100		station1.example.com		station1
192.168.122.101		station2.example.com		station2

If you want have more than two systems, you also add more lines with new IP address. I decided to use internal IP addresses but if you want the systems accessible from the outside, you should build bridge network first. I’ll not describe it here. After add above lines in to the ‘etc/hosts’ you need to shutdown the virtual machine and you will not use it until you want to install something common between each virtual machine.

It is time to create new volume for each virtual machine. I made simple script for this.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
 
if [ /dev/VolGroup/rhel5u4_test1 ]
then
	lvremove /dev/VolGroup/rhel5u4_test1
fi
lvcreate --size 1g --snapshot --name rhel5u4_test1 /dev/VolGroup/rhel5u4
 
if [ /dev/VolGroup/rhel5u4_test2 ]
then
	lvremove /dev/VolGroup/rhel5u4_test2
fi
lvcreate --size 1g --snapshot --name rhel5u4_test2 /dev/VolGroup/rhel5u4

It will remove exsiting volume and will create new volume as a snapshot based on existing rhel5u4 volume with 1G of space for modification.

As a last step, you should fix IP address for each machine. If you do not, you can’t reach each machine with their name and always have to recheck current IP address for testing. Some documents says that it is necessary to restart dnsmasq because virtual machine get address from dnsmasq, but it it not true. Only thing you should have to do is stay on ‘virsh’ command.

Basic steps are as something like following.

1. cd /etc/libvirt/qemu/networks/
2. vi default.xml
3. virsh net-destroy default
4. virsh net-define default.xml
5. virsh net-start default

At the second step, you should add each virtual machine’s MAC address with desired IP address. As a result, mine is something like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
<network>
  <name>default</name>
  <uuid>8dc538f3-ce99-4708-8e53-46aad24e6157</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
      <host mac='52:54:00:77:c8:94' name='station1.example.com' ip='192.168.122.100' />
      <host mac='52:54:00:af:5d:59' name='station2.example.com' ip='192.168.122.101' />
    </dhcp>
  </ip>
</network>

You don’t need to restart dnsmasq or libvirtd at all. Just update this configuration file and restart each virtual machine is the enough step. From now, you have configured two systems and at any time you can restart with recreate snapshot.

Winter Song – Sara Bareilles/Ingrid Michaelson

Christmas is just around the corner and I’m really waiting it to come.
I hate cold weather, but I won’t be able to live without white X-mas. It is my favorite time during the year.

Right now, I’m enjoying to listen my favorite singer’s winter song. Her voice is really gorgeous.


Steve Jobs’s speech

In 2005, Steve Job did a speech in Stanford University Commencement. Following is what I want to keep in mind for everyday of my life.

For the past 33 years, I have looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something… almost everything — all external expectations, all pride, all fear of embarrassment or failure — these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.

If today were the last day of my life, would I want to do what I am about to do today? – I hope I can say ‘Yes’ for this everyday.