qemu/kvm tap networking

Date January 6, 2010

The following is the commands to create a virtual bridge and virtual interfaces so you can use it with kvm/qemu tap networking, Actually i think you can do all of this using a GUI interface via Virtual Machine Manager (virt-manager), but i don’t know why i feel its difficult to use it, anyway.

You will need a tun enabled kernel, also tunctl and bridge-utils packages are installed in your system, in Fedora 12 i used yum to install them:

yum install bridge-utils.`uname -m` tunctl.`uname -m` -y

For tun support in your kernel, you can modprobe tun and see the result, or checking the config file under /boot/ for CONFIG_TUN, for example in fedora:

[root@shaker-testing ~]# egrep ‘^CONFIG_TUN’ /boot/config-2.6.31.9-174.fc12.x86_64
CONFIG_TUN=m

anyway you do it, just make sure exist and probed (lsmod | grep tun)

Finally here is the commands to create the virtual interface and virtual switch:

[root@shaker-testing ~]# tunctl -b -u root -t tap0
tap0
[root@shaker-testing ~]# brctl addbr testing-br
[root@shaker-testing ~]# brctl addif testing-br tap0
[root@shaker-testing ~]# brctl addif testing-br eth0
[root@shaker-testing ~]# ifconfig tap0 0.0.0.0 promisc up
[root@shaker-testing ~]# ifconfig eth0 0.0.0.0 promisc up
[root@shaker-testing ~]# ifconfig testing-br 192.168.0.1 netmask 255.255.255.0
[root@shaker-testing ~]# brctl show
bridge name    bridge id        STP enabled    interfaces
testing-br        8000.0019d13401c0    no        eth0
tap0

thats all, btw, 192.168.0.1 was my eth0  IP Address, you have to give it to your virtual bridge.

now run your machine, i usually run it as followes:

qemu -hda /storage/testing1.img -m 256 -net nic,macaddr=00:1d:92:ab:3f:80 -net tap,ifname=tap0,script=no -alt-grab -vga std -name Testing1 -boot c -vnc :0

and then i login to it using vncviewer (i used -vnc :0 in the options) to configure its IP Address.. for example, if you are connecting/using it in localhost then i use:

vncviewer localhost:5900

or you can delete ‘-vnc:0′ so you don’t use vnc at all..

Google/HTC Nexus One?

Date January 5, 2010

Nice Phone, and very good performance, but is it a revolutionary Phone? No its not, we expected More from Google.

I don’t want to compare it to iPhone or any other Phones (am not expert in this field), but when i remember how iPhone changed the Phones then you can say iPhone is a revolutionary in that date, now all Phones stepping to be like iPhone, thought.

I used iPhone 3G for 2 weeks, it was so nice and i liked many features of it, but actually i hated it for many reasons, one of them its not Open Source (i can’t edit/change many things i want), another thing i really hated is when i want to open more than one application at the same time like opening skype or any IM application and keeping ssh tunnel open also browsing the web at the same time, am a sysadmin and usually use this 3 applications when i need to work on something urgently, anyway, i felt am restricted to apple and apple store, unless you use breakjail version which i hated to use too, so i left it with a bad experience.

Now i use Nokia E71, its nice one but also you are restricted to use some stupid applications Nokia developed, at least its good to call someone, very good battery, and good for receiving/sending emails, this phone mainly designed for business.

if ill buy Nexus One (i don’t have budget : ) then ill buy it because of its performance & because it run Andriod (i believe in opensource!).

Anyway, i think Nexus One is just a OpenSource iPhone …

ping tip: CTRL + \ (backslash)

Date September 28, 2009

I were checking one of the servers connectivity using ping, usually i use CTRL + \ (backslash) to send a quit signal for applications i run in terminal, but ping responded to the signal by showing ping status:

64 bytes from x.x.x.x: icmp_seq=1253 ttl=47 time=433 ms
64 bytes from x.x.x.x: icmp_seq=1254 ttl=47 time=239 ms
64 bytes from x.x.x.x: icmp_seq=1255 ttl=47 time=359 ms
1255/1216 packets, 3% loss, min/avg/ewma/max = 221.050/393.449/357.675/977.157 ms
64 bytes from x.x.x.x: icmp_seq=1256 ttl=47 time=325 ms
64 bytes from x.x.x.x: icmp_seq=1257 ttl=47 time=411 ms
64 bytes from x.x.x.x: icmp_seq=1258 ttl=47 time=260 ms
64 bytes from x.x.x.x: icmp_seq=1259 ttl=47 time=275 ms

Pressing CTRL + \ while using ping will show ping status.

Installing PPTP Client in Fedora 11

Date September 27, 2009

Usually, When i wanna connect to online servers for checking them or whatever, I ssh to my work PC then to them, unfortunately our main gateway is down today.

So i tried another solution which is trying our work VPN connection, Network Manager didn’t help me or maybe i didn’t know how to configure it (i don’t like it!), the other solution was PPTPConfig, i tried it before and it worked perfectly,

To install it in Fedora just follow the following steps as root:

[root@localhost ~]# rpm -Uhv http://pptpclient.sourceforge.net/yum/stable/fc11/pptp-release-current.noarch.rpm
[root@localhost ~]# yum install pptpconfig

now just run pptpconfig as root and configure your VPN connection..

Tornado, the real-time web server that powers FriendFeed, now open source.

Date September 11, 2009

Facebook announced Tornado as new open source web server framework, it can be used to serve thousands of simultaneous connections, its high performance is really interesting, i think ill test it in the coming days.
checkout the following links:
http://developers.facebook.com/news.php?blog=1&story=301
http://bret.appspot.com/entry/tornado-web-server
friendfeed website: http://friendfeed.com

some details:
Tornado is a non-blocking Web server framework written in Python, designed to handle thousands of simultaneous connections, making it ideal for real-time Web services.

Some of the distinctive features of Tornado:

  • All the basic site building blocks – Tornado comes with built-in support for a lot of the most difficult and tedious aspects of web development, including templates, signed cookies, user authentication, localization, aggressive static file caching, cross-site request forgery protection, and third party authentication like Facebook Connect. You only need to use the features you want, and it is easy to mix and match Tornado with other frameworks.
  • Real-time services – Tornado supports large numbers of concurrent connections. It is easy to write real-time services via long polling or HTTP streaming with Tornado. Every active user of FriendFeed maintains an open connection to FriendFeed’s servers.
  • High performance – Tornado is pretty fast relative to most Python web frameworks. We ran some simple load tests against some other popular Python frameworks, and Tornado’s baseline throughput was over four times higher than the other frameworks: 

not enough B12

Date June 20, 2009

Two days ago i checked my B12 Vitamin, and as expected it wasn’t enough so the Dr suggested to take one injected and then i have to take drugs course, so as suggested i started by taking the injected and here we go; it really did effect, and i started to be more active, feel in power to live and accurate but the more stupid thing it did is i started to remember things i tried to forget :( , anyway … feeling great ;)

back

Date May 15, 2009

whoops finally i feel am free,, for more than 2 months, am recalculating everything in my mind, and how the work was so much heavy those two months,, maybe a lot of you noticed i deleted a lot of posts, anyway, finally i just feel like i never tired before.

I just started to play with nextgen-gallery, the plugin for wordpress which i installed before a year ago, it really seems nice, i have uploaded  my Wadi-Ram and Aqaba trip that i did before 2 months ago,  the thing that i really like is [View with PicLens],, its really nice feature, to view the gallery just click on the above picture.

i have 3 days holiday next week, what will be next in this gallery :D .

Linux examination machine

Date March 4, 2009

Two days ago i did a nice interview, it was interactive exam, someone ask you through the phone to troubleshoot/do many things and in the same time he see what you do and what is the output of your commands, in my company, when i was interviewing people, all what i do is oral questions.. its oral conversation, but after making that interview i decided to prepare a examination machine to use it for future interviews i do in the company i work in.
the trick was using SCRIPT(1) and named pipe (fifo), simply like this:
in the first session do this command:
$ mkfifo foo; script -f foo
in another session do cat for ‘foo’
$ cat foo
and now you will see everything done in the first session, yup so nice.
to use it when the user login (for ex/ through ssh), you can put it on .bashrc file for that user, for example put those at the end of .bashrc file:
if [ ! -p /tmp/`whoami` ]
then
mkfifo /tmp/`whoami` ;
fi
exec script -f /tmp/`whoami`

thats it, now after user login, do cat /tmp/UserLoginName in your session ;)

inittab to auto restart script

Date February 2, 2009

Do you have a script/application that you want it running all the time, if it crashed then it auto restrart, auto launch on reboot ?, I have a php script that must run all the time, it do telnet to a port on another server and do some commands on that port… anyway i want this to be running all the time, i did it easily using respawn in inttab, this is the steps:

idlE ~ # vi /etc/inittab

at the end of the file add the following:

ax:2345:respawn:/root/scripts/sendSMS.sh

change /root/scripts/sendSMS.sh to your script/application path, then save and quit.

now you need to reread inittab file using the following command:

idlE ~ # init q

thats all, check the running process.

Running Bluetooth Headset on Linux

Date January 27, 2009

As i said before in a previous blog, i got a new headset as a gift from my uncle,, mm i tried to configure it in the first day but i failed,,, today i played again and yes i got it working,, here how i configured it.

I use Fedora 8 (yes i know currently there is F10 :P ), my headset vendor is Teac, you will need to install the following packages:

bluez-utils, bluez-utils-alsa also gnome-bluetooth if you use gnome and wanna add it to the panel.

now use hcitool to seach about the device:

[idle-boy@localhost Enigma]$ hcitool scan
Scanning …
00:1F:5C:87:95:D7 idle-BoY
00:09:DD:70:D9:AA Stereo Headset

Now set your Headset to paring mode and do the following command to connect (as root):

[root@localhost ~]# hcitool cc 00:09:DD:70:D9:AA

Add the following to your ~/.asoundrc file (a file alsa use):

pcm.bluetoothraw {
type bluetooth
device 00:09:DD:70:D9:AA
profile “auto”
}

pcm.bluetooth {
type plug
slave {
pcm “bluetoothraw”
}

}

thats all, at least for me :) ,, i use mplayer,, to play a song:

[idle-boy@localhost Enigma]$ mplayer -ao alsa:device=bluetooth */*

for more info and other players, see this Documentation: http://wiki.bluez.org/wiki/HOWTO/AudioDevices

weeeeeew so nice to move your head without cables :P