Monday, May 26, 2008

Install Windows Vista from USB Flash Drive

Most machine nowadays has built-in USB 2.0 hi speed port and able to boot from USB flash drive . But not all machine has CD/DVD-ROM. The following method prepares a USB flash drive for Windows Vista installation: Requirements:
  1. A USB flash drive supports USB 2.0 with size of 4G (able to hold a Windows Vista ISO)
  2. A machine support USB 2.0 and bootable from USB flash drive
Steps to prepares a USB flash drive from Windows Vista machine:
  1. Insert USB Flash drive
  2. Run CMD from administrator account (or run as administrator)
  3. The following commands are run within diskpart:
    1. list disk (to list all disk in system including USB flash drive, identify your USB flash drive disk number here)
    2. select disk 1 (assume USB flash drive is disk number 1)
    3. clean (clean all partition in USB flash drive)
    4. create partition primary (create a primary partition in USB flash drive)
    5. select partition 1 (select the newly created partition)
    6. active (mark the partition active)
    7. format fs=fat32 (format the partition with FAT32 file system)
    8. assign (assign a drive letter to the partition, assume is drive E:)
    9. exit (quit diskpart utility)
  4. Insert Windows Vista DVD-ROM or mount the Windows Vista ISO file to drive D:
  5. Copy all file and folders from Windows Vista DVD-ROM to USB Flash drive:
    1. xcopy d:\*.* /s/e/f e:\
  6. Safely remove the USB flash drive from your machine
  7. Plug the USB flash drive to new machine for Windows Vista Installation
  8. Make sure you try to reboot the machine with USB Booting
  9. Enjoy and start Windows Vista installation from USB flash drive without DVD-ROM
Reference:
  1. HOWTO: Install Windows Vista from a high speed USB 2.0 Flash Drive

Wednesday, May 07, 2008

Some useful RPM command

Redhat or Fedora using RPM to manage package installation. RPM will report package dependencies if the installation failed. However, I found YUM is much more easy than RPM in install and uninstall operation. However, there are some useful aspect of using RPM.
# To list all installed packages
rpm -qa

# To query a package information and dependencies packages
rpm -qilR 

# To query which package require a package
rpm -q --whatrequires 

# To query which package provide the file
rpm -q --whatprovides 

# Test package installation
rpm -ivv --test 

Configure a masqueraded router

A router need at least 2 network interfaces. The following example using 2 network interfaces, eth0 and eth1 as example. eth0 is external network interface. All packets passed thru' this interface will be masqueraded before sending out. In real world situation, this interface is usually refer to internet gateway. eth1 is internal network interface. This is usually gateway for internal private network. There are 2 steps configure a masquerade router. Step 1: Enable IP packet forwarding
sysctl -w net.ipv4.ip_forward=1
Step 2: Enable IP packet masquerading Firewall (IPTABLES)
# Clearing any existing rules and setting default policy..

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F

# FWD: Allow all connections OUT and only existing and related ones IN

iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

# Enabling SNAT (MASQUERADE) functionality on $EXTIF
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
The masquerading router should have up once the above script is executed. You may try to ping both eth0 and eth1 to confirm that. Also try to ping public network to make sure it works. You may persist the iptables rules using
service iptables save