May 31, 2011

hostapd madwifi in ap mode

If you are using hostapd, and hostpad is showing the following error:

ioctl[IEEE80211_IOCTL_DELKEY]: Invalid argument
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument


Try to add :
wme_enabled=0
in hostapd.conf

This is documented in http://madwifi-project.org/ticket/1561 and it worked for me.

May 25, 2011

udp port forward

------
Option 1: user-application based udp port forwarding

Ivan Tikhonov wrote a simple udp_redirect.c program to do just this. I like it.

The link: http://brokestream.com/udp_redirect.html

-------------

Option 2 is to use iptables.

You will need to set the middle computer (Linux) to
1. NAT
2. port forward to the local computer

iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 161  -j DNAT --to 192.168.1.10


Then set the local computer's default gateway to the middle computer:

route add default gw 192.168.1.100

------------
If you are looking for TCP port forwarding, I use and recommend the open source program rinetd. It works on both Windows and Linux, and supports multiple TCP connections, and is very stable. The link: http://www.boutell.com/rinetd/

php internal server error

If you just see a blank page instead of an error reporting and you have no server access so you can't edit php configuration files like php.ini try this:

- create a new file in which you include the faulty script:

<?php
 error_reporting
(E_ALL);
 
ini_set("display_errors", 1);
 include(
"file_with_errors.php");
?>

- execute this file instead of the faulty script file

now errors of your faulty script should be reported.
this works fine with me. hope it solves your problem as well!

May 20, 2011

Ubuntu Host, Windows 7 Guest, Raw disk, Virtual Box

Command in Ubuntu to create the win7 virtual machine using the raw disk Windows 7 partition that comes with the Dell computer.


This is tested on Virtual Box 4.0.4
Make sure you run everything as root
Make sure you use "IDE controller" type ICH6, otherwise the win7 will blue screen (BSOD)


This is based on the following blogs:
http://www.rajatarya.com/website/taming-windows-virtualbox-vm
http://www.researchut.com/site/virtualbox-native-partition

First install Virtualbox. I found it easier to install it using the "all platform" exectuable. Make sure you also download and install the Oracle Extension Package, which is installed using this command:
 VBoxManage extpack install Extention_file_name


Then do the following commands: make sure you are root, and you are at "/root".


----------------
VBoxManage createvm --name win7 --ostype Windows7_64 --register
 
VBoxManage modifyvm "win7" --memory 1024 --acpi on --boot1 disk --nic1 nat

 
VBoxManage storagectl "win7" --name "IDE Controller"   --add ide --controller ICH6

 
VBoxManage internalcommands createrawvmdk -filename /root/win7.vmdk -rawdisk /dev/sda -partitions 1,2,3 -mbr /root/vm.mbr -relative

 
VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 0 --type hdd --medium /root/win7.vmdk



------ Other useful commands------------

vboxmanage unregistervm win7 --delete

VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 1 --type dvddrive --medium "/root/Windows 7 64-bit Repair Disc.iso"

VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 1 --type dvddrive --medium /opt/VirtualBox/additions/VBoxGuestAdditions.iso


vboxmanage controlvm win7 reset


----If you still cannot boot your Windows 7, try to use the Windows 7 Rescue image to fix it. Use the above "vboxmanage" command to attach the repair disk ISO file and hit F12 when vbox boots to boot from CD, let it fixes it and then boot to regular Win7

May 19, 2011

boot Windows in Virtualbox

Use Xmount + Opengates, for MAC users, use openjobs

https://www.pinguin.lu/index.php

May 18, 2011

Headless Virtualbox on Ubuntu 10.04 LTS

Updated Scripts (06/07/2012):

VBoxManage createvm -name centos6 --ostype RedHat -register
VBoxManage modifyvm centos6 --memory 1024 --pae on --acpi on --boot1 dvd --nic1 nat --natpf1 "guestssh,tcp,,2222,,22"
VBoxManage modifyvm centos6 --natpf1 "www,tcp,,1888,,80"
VBoxManage storagectl centos6 --name IDE0 --add ide --controller ICH6
VBoxManage createhd -filename ~/centos6/sda.vdi -size 20000
VBoxManage storageattach centos6 --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/centos6/sda.vdi
VBoxManage storageattach centos6 --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium ~/bigfiles/CentOS-6.2-i386-minimal.iso

To enable VRDE:


VBoxManage modifyvm centos6 --vrde on --vrdeport 3392

After installation is finished, boot hdd:
VBoxManage modifyvm centos6 --boot1 disk

To add hostonly interface:
# sudo tunctl -u $USER # add tap0 device
# sudo ifconfig tap0 192.168.100.1 netmask 255.255.255.0
VBoxManage modifyvm centos6 --nic2 hostonly --hostonlyadapter2 tap0

To add the second interface as bridged interface:

VBoxManage modifyvm centos6 --nic2 bridged --bridgeadapter2 eth0

Original Post:
http://tuxnetworks.blogspot.com/2010/05/howto-virtualbox-31-headless-on-lucid.html

That's it, Virtualbox should be installed and ready to go.
Now we can move on to creating a virtual machine
Create a machine named "io"

VBoxManage createvm -name io --ostype Ubuntu -register

Configure it with a nic bridged to eth0, 256Mb RAM, enable acpi and set to boot from DVD

VBoxManage modifyvm io --memory 256 --pae on --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0

Create a virtual IDE controller

VBoxManage storagectl io --name IDE0 --add ide

Create a virtual HDD

VBoxManage createvdi -filename ~/.VirtualBox/Machines/io/sda.vdi -size 48000 -register

Attach the virtual HDD

VBoxManage storageattach io --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/.VirtualBox/Machines/io/sda.vdi

Create and attach a virtual DVD drive to the controller and insert the DVD image

VBoxManage storageattach io --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium /store/archive/ISO/ubuntu-10.04-server-i386.iso

The default vrdp port for machines is 3389, however, if you intend to run more than one guest then each one will need to listen on a different port. I use the 3xxx range with the xxx being the last octet of the machines IP address. For example, 192.168.0.1 would be 3001.

VBoxManage modifyvm io --vrdpport 3001

And thats it, your machine has been created. Time to start it up and give it a test drive!

Using the virtual machine

Start the machine

nohup VBoxHeadless -startvm io &

On a GUI workstation, establish a remote desktop connection to the machine. In my case, the host server is called "jupiter" so I type;

rdesktop -a 8 jupiter:3001

After you have installed the OS, you need to tell the machine to boot from the hdd.

VBoxManage modifyvm io --boot1 disk

You can also deregister the dvd image if you don't intend to use it again.

VBoxManage unregisterimage dvd /store/archive/ISO/ubuntu-10.04-server-i386.iso

To Stop VM/Hibernate/Save Sate:

vboxmanage controlvm centos6 savestate

To Power Off VM:
vboxmanage controlvm centos6 poweroff


Here are some other useful commands;

VBoxManage showvminfo io
VBoxManage list hdds
VBoxManage list runningvms
VBoxManage controlvm io poweroff
VBoxManage unregistervm io --delete
VBoxManage controlvm io savestate
VBoxManage closemedium disk UUID
VBoxManage modifyhd UUID --type immutable

May 17, 2011

Linux Command Line FTP/HTTP segemented download accelartor software

  1. aria2c

  2. axel

  3. lftp (use the "pget" command of lftp)

     

    ari2c and axel supports FTP, HTTP and HTTPS, while lftp supports more protocols such as FTPS, SFTP, etc.

May 16, 2011

/etc/hosts not working?

If you have a Linux machine and your /etc/hosts is not working, make sure you have a file called

/etc/nsswitch.conf 
 
with the following content: 
 
passwd:         files
group:          files
hosts:          files dns
networks:       files dns
services:       files
protocols:      files
netmasks:       files

May 13, 2011

Windows CE 5.0 QFE download

Microsoft has moved on to Windows CE 7 (Compact 7) and revamped their download site so that all the windows CE 5.0 downloads cannot be located anymore.

To patch your platform builder 5.0 to the latest, download the "rollup" files from here:

http://www.microsoft.com/windowsembedded/en-us/downloads/download-windows-embedded-ce-5.aspx

Once you installed any QFE, you will have a application called CEQFECHECK.exe  under C:\WINDOWS\system32\ceqfecheck. This application checks which QFE you have installed and did not install. Check it out.