Access VirtualBox Guest Network From Outside

I have been looking for a way to enabling network inside virtualbox so that I can access it from anywhere thus being able to run various services inside virtual environment, trying out anything without any worries.

Here’s a simple how-to borrowed from archlinux wiki

Install bridge utils for creating bridge and uml_utilities for creating a tun device

pacman -S bridge-utils uml_utilities

Open the file /etc/udev/rules.d/60-vboxdrv.rules and add the following line to it

KERNEL==”tun”, OWNER=”root”, GROUP=”vboxusers”, MODE=”0660″

Then type the following command to load the tun module

modprobe tun

Now, let’s setup a bridge device to bridge network from your physical network interface to the virtual one

  • Create a bridge interface

brctl addbr br0

  • Set your interface in promiscous mode so it can accept packets from any interface

ifconfig <interface name> 0.0.0.0 promisc

  • Now, bridge the bridge interface with the real network interface

brctl addif br0 <interface name>

  • Now set the bridge interface to acquire IP address as your physical network interface would. eg if eth0 is your network interface and it acquires IP via DHCP then

dhclient br0

  • And finally add virtualbox host interface

VBoxAddIF vbox0 <VirtualBox user> br0

Now start VirtualBox and go to network settings. Select network interface as ‘host networking’ and interface device as ‘vbox0′.

Now you need to give an unused IP address in your IP range of the internet gateway. If you cannot provide that due to some reason then what you can do is create a virtual interface say eth0:0 then bind bridge network to that interface and setup NATing to pass packets between virtualbox and external network.

Some nifty fun with Linux and PDF files

Let me narrate 3 nice experiences with pdf on Linux while at work

1) Merging multiple PDF files

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=filename.pdf file1.pdf file2.pdf……..fileN.pdf

2) Convert ps to pdf

ps2pdf file.ps file.pdf

3) Compressing PDF files.

4) Convert images to PDF

convert image1.jpg image2.gif image3.tiff…….imageN.xyz filename.pdf

Viewing MS Word files on Command Line

I had to urgently view a MS Word file but I didn’t have a word processor on my system to view it in, KWord2 beta wasn’t able to support MS Word files. And I couldn’t find any small word processor or the one that wouldn’t being a gnome and a half in with itself. So, I decided to explore the CLI way.

I came across this nice article on how to view MS Word files on CLI. One of those softwares which I tried out is antiword, as it seemed most suitable to my purpose. A nifty utility to download and use while Oo.org takes it’s sweet couple of hours.

Another nice thing is that it can be used when you don’t have X running or if you’re connecting via SSH.

Viewing the file in antiword is as simple as typing

antiword filename.doc

Though it has a few options to format stuff via parameters, I don’t need them. But, they can be quite useful for some purposes.

Pipe the document through a pager and nicely sit and enjoy reading your MS Word document over Command Line Interface.

My thoughts on the software – simple, easy to use and makes life easy when all you want is to view simple text from a MS Word document. What I miss the most in the software is the ability to open odt files :(

2 Minutes To Your Own Planet

Heh! Please don’t mistake me for one of those LHC guys. No, I am not talking about planets as in heavenly bodies which reflect lights from the stars but have give out no light on their own. I am talking about planet as in a feed aggregator.

Firstly, planet is a web based feed aggregator software developed in python. Planet was originally developed for GNOME and Debian. It can parse RSS, Atom and RDF feeds.

So, let’s get started up.

First step is to download planet software from here or checkout the latest stable bzr version from here.

Then untar the file if you downloaded the tarball.

tar -xpvf planet-xx.tar.bz2

Now untar the planet tarball and install the planet files eg.

tar -xpvf ~/planet-2.0.tar.bz2

cd ~/planet-2.0

su

./setup.py install

Now we need to configure the config.ini file in fancy directory to get started quickly. If you wanto take your time

vim examples/fancy/config.ini

Look at the file, it’s nicely commented you should have no problem at all in configuring it to your tastes, believe me. It’s too easy.

I set my output directory as

output_dir = /var/www/localhost/htdocs/planet

cp -R examples/output/* /var/www/localhost/htdocs/planet

This will place all the output files in the planet and the second command will copy the images folder and css file to the DocumentRoot so your page renders well.

Now to generate the output

./planet.py examples/fancy/config.ini

Now you can install the planey.py and planet-cache.py to /usr/bin using setup.py so that you can run it via cron

./setup.py config && ./setup.py install

crontab -e

0 * * * *   /usr/bin/planet.py /home/user/planet-2.0/examples/fancy/config.ini

Now open up your web browser and point to localhost/planet. Of course you need a web server running on localhost to try this out.

To show your image, put it in /var/www/localhost/htdocs/planet/images

Happy journey. Enjoy the feeds on your own planet!

Using tor and privoxy in linux

No how-to from my side this time around. But a nice link I followed to setup tor and privoxy on my machine. It’s really easy to follow and straightforward.

http://www.opensourcehowto.org/how-to/privoxy/setup-tor–privoxy-for-anonymous-searching.html

Probably I will write a how-to on customising privoxy to block ads, unwanted url’s, redirect machines on the network to use tor and privoxy using firewall rules.

Installing MaraDNS

Today on ##linux-india at irc.freenode.net people were discussing about DNS and the recent DNS security issue and it’s implications and solutions. So, I decided to try out the test for my ISP’s nameservers, the default nameservers that I use. The test can be found on Kaminsky’s Website.

The test confirmed that my ISP’s nameservers aren’t patched, so I decided to finally configure my dnsmasq finally and again use local DNS servers. But, the dnsmasq configuration is too lengthy and complicated for this purpose. It’s a great software if you want to have a lot of function like tftp boot, dhcp and such. But, in my case I just need a caching DNS server so decided it was either bind which I always use or try maradns, as suggested by someone on the channel.

Since, I have gone with bind in the past I decided to go with maradns, which I heard is easy to configure and is supposedly as secure as djbdns. So maradns it was. I downloaded the latest release from their download page as no binaries are available in arch repos.

So, let’s start with the process, now that you’ve downloaded the binary. This will work, only for linux. Please check the README files and documentation for further details and different platforms.

First untar the downloaded file, in my case the tar.bz2 file

tar xjvf maradns-1.3.07.08.tar.bz2

cd maradns-1.3.07.08

Then run

./configure

make

Now, your binaries have been created and you’re ready to test out the DNS server

Note:-You need to be root henceforth

mv server/maradns /usr/local/sbin

mv tools/duende /usr/local/sbin

mkdir /etc/maradns

touch /etc/mararc

Now open the /etc/mararc file in your favourite text editor and add the following

ipv4_bind_addresses = “127.0.0.1″
chroot_dir = “/etc/maradns”
recursive_acl = “127.0.0.1″

Now start maradns

/usr/local/sbin/maradns

Then test it

dig @127.0.0.1 example.com

If it returns a reply, you’re good to go :) If not, post the errors I will be glad to help out.

Now, try running it in daemon mode

killall maradns

/usr/local/sbin/duedne /usr/local/sbin/maradns

If all is fine till here then we can proceed to actually install maradns.

First cd to the maradns directory, where the source is place then run

make install

Now, we need to add /usr/local/sbin and /usr/local/bin to our PATH variable

add the following to your bashrc

export PATH=$PATH:/usr/local/sbin/:/usr/local/bin

That’s it, you’re done! Your server is ready to run.

TODO :- Find init scripts for starting it at boot time. My distro is arch. If anyone can supply me one I will be thankful.

PS :-

If you want the server to listen to multiple IP’s add them in a comma separated list inside the quotes for ipv4_bind_addresses. Check http://www.maradns.org/tutorial/recursive.html

Lots of nice stuff can be found at http://www.maradns.org/tutorial/tutorial.html

Hurray! Got my webcam working on linux

I was sitting at night browsing some friend’s blogs and adding RSS feeds to Akregator, after my new found fondness for KDE 4(more on that in a later post). Then Gaurish Sharma asked how to get webcam and fingerprint scanner to work on linux. I didn’t really have much clue but asked him to dig around with /var/log/dmesg and /var/log/messages to get more info on the webcam to start with. While he was looking around, I decided to dig up my own webcam from the closet.

I connected the webcam to the PC just to see a bunch of errors being spewed out by /var/log/messages. Then I installed gspcav1 kernel module and loaded it

pacman -S gspcav1

modprobe gspca

Still, no go. I still got errors on reconnecting the webcam. Then, I peeked around the Arch Linux wiki and found some other drivers that may be needed by device. Then ran

lsusb

It showed up a microdia webcam but still /var/log/messages spewed out errors. Then I went for verbose option of lsusb to see if there’s anything worthwhile.

Here’s the lsusb -v output for those interested

Still nothing. :(

Then I decided to remove bluetooth from the other port and insert the webcam there. And voila! there it works. The webcam was detected, no errors this time and the required device was created.

Now, to test if it works or not. I tried kopete but alas! it doesn’t support all the webcams and mine is in one of those unsupported ones. I started looking at other apps which support more webcams. I started with cheese and ekiga but both looked to install evolution-data-server, why would I want that? Then I installed skype

pacman -S skype

Then add the user to video group and execute

chown :video /dev/video0

Now, logout and log back in for group settings to take effect. Then I ran skype.

Hurray! My webcam worked! Though the picture was hardly visible, I would place the blame on the webcam rather since it hasn’t been used in years now and it has always been throwing out grainy pictures since the beginning.

qingy – a desktop manager with a difference

What is qingy?

Here’s the quote from qingy developers Quote:
qingy is a replacement for getty. Written in C, it uses DirectFB to provide a fast, nice GUI without the overhead of the X Windows System. It allows the user to log in and start the session of his choice (text console, gnome, kde, wmaker, …).

Source :- http://qingy.sourceforge.net

Features:-

  • It works
  • It remembers last user who logged in, with focus on password
  • It also rememebers last session each user chose
  • Alternatively it remembers last session on a per-tty basis
  • Fully themable
  • A theme will look the same on all machines, independently of the resolution
  • You can select your favourite theme, or a random one every time
  • Both text and X sessions are supported
  • You can start more that one X session at once
  • You can even start X inside a console when X sessions are already running
  • PAM support
  • Support for screen savers
  • Auto log-in support
  • Session locking support
  • Session timeout, with lock or logout as available actions
  • tty specific options support
  • Customizable key bindings
  • Text mode support

I came across qingy while browsing gentoo-wiki

Here is the gentoo-wiki qingy guide