Tag Archives: Howto

Internet Connection Sharing on Ubuntu & Windows with Ad-hoc 2.

A few months ago I made a quick tutorial about Internet Connection Sharing focusing to the case when we are sharing the connection from a machine with Windows installed to the other PC with Linux operating system. In this guide I’ll show you the contrary case, how to share your incoming connection with Linux.

First of all, make sure that you have installed the appropriate drivers for your network interfaces.

Let’s get started with my configuration: I have 2 laptops, one with Ubuntu 10.04 (Laptop 1) and the other with Windows XP (Laptop 2) installed. Both have 2 networking interfaces, Wireless and Ethernet – in the rest of the text just wlan and eth.

We need to share the incoming Internet connection from Ubuntu machine. This laptop is connecting with its network card to the modem with automatic IP address (through DHCP).
I’ll connect my laptops through Wireless. Here is the configuration for the first wireless card (wlan0) on the laptop which is directly connected to the modem:
Create a new Wireless connection, name it and set the mode to Ad-hoc.

Under the tab IPv4 Settings set the following parameters:

Gateway: Leave empty or set to the IP of your Ethernet card on this machine.

Type the following command in root terminal, do not use sudo:
First, configure the laptop for NAT-ing with the following command:
# iptables -t nat -A POSTROUTING -o ethN -j MASQUERADE # (1)
in my case N is 0, replace N with the number of the card which is directly connected to your modem.
Set IP Forwarding:
# echo 1 > /proc/sys/net/ipv4/ip_forward
Install dnsmasq using apt-get:
# apt-get install dnsmasq
and restart it:
# /etc/init.d/dnsmasq restart
Add the following line to /etc/sysctl.conf:
"net.ipv4.ip_forward = 1"
Reboot and repeat (1).

Before continuing with the next laptop make sure that you have working Internet connection on Laptop 1.

First you need to create an Ad-hoc network on your Windows machine too:

Because we are doing our sharing without any security, switch to Open network under Properties > Associations.

Set the following configuration for the Laptop 2 with Windows installed:

DNS: (must be the IP of the wireless card on Laptop 1).

Comments are welcome, happy surfing! 🙂


Getting started with KDE development on openSUSE


In this guide I’ll share my experiences and show you how to get started with KDE development. This article is based on the opensuse-wiki article on my personal solutions and on the helpful suggestions from the guys on #kde-devel channel.

If you are looking for something more official take a look to KDE TechBase.


    1) Space required for source files, executables, etc. is ~6.5GB (yes, pretty huge because building with full debugging symbols).
    2) Build dependencies: Here is the list for several distributions.
    3) an svn client

The openSUSE KDE team also provides two scripts kde4-run-env, kde4-build-env to set up the environment variables for the build dependencies (2).

  • Set up the environment

Some guides are suggesting the use of different startup scripts also. However I’ve created a new user for KDE development to protect my stable KDE configurations from my mistakes:

useradd -m -G users,audio,video -s /bin/bash kde-devel

you can do it without the -G option – like I did – If you want to create a user with default groups. And finally set a password for this user:

passwd kde-devel

Now you can continue your work on different ways, I did the following: my graphical session is running on tty6 and i started a new terminal session on tty1. To switch between terminal sessions use the <Ctrl>+<Alt>+<Fn>, n = 1,…,12 key combinations. This isn’t the best solution from the view of debugging because you can’t use clipboard between your terminal and graphical session and if something goes wrong and you need to copy+paste an output to the IRC channel/forums then this operation takes extra time.

So, Instead of switching to a new terminal session open your terminal emulator in your graphical session – Konsole – and log in with the kde-devel user and jump to the home directory:

su kde-devel
cd ~

Copy the scripts kde4-run-env, kde4-build-env into kde-devel‘s home directory. and add the following line to the~/.profile:

. ~/kde4-build-env

Now execute the script kde4-build-env with

. kde4-build-env

– actually re-logging with kde-devel have the same effect.

  • Download the sources

We’ll store everything what is related to KDE sources/build in the directory kde. Under kde create a subdirectory for the sources, and finally jump into the sources directory:

mkdir ~/kde/sources
cd ~/kde/sources

Now get the directory structure of KDE svn trunk:

svn checkout -N svn://anonsvn.kde.org/home/kde/trunk

with the -N option you are getting only the root directories without its contents. This will be useful later, after every checkout take a look to the current directory structure – just to see what are you doing.
So, you’ve checked out the trunk directory, go there

cd trunk

and check out the remaining directories.

svn up -N KDE
cd KDE

KDE is the last directory on the svn before the three module directories: kdebase kdelibs kdepimlibs – containing: base runtime elements, Personal Information Management modules and the basic libraries. Check out the sources for every module with:

svn up kdelibs kdepimlibs kdebase.
*This may take some time depending on your network connection speed.

  • Build the sources

We have all the sources just need to build them. The command cs is provided by the script kde4-build-env – if you’ve added the script properly to the .profile. First we need to build the kdelibs directory. Change the source patch to kdelibs with:

cs KDE/kdelibs

and start to build kdeblis:

*This may take some time depending on several factors, like systems load, CPU speed, etc.

Repeat this for the remaining modules:

cs KDE/kdepimlibs
cs KDE/kdebase

Remember, you can pause the building/compiling with <Ctrl>+<Z>:
[1]+ Stopped cmakekde
and resume with:
fg 1.

  • Run KDE 4

You can start from the terminal or with KDM. I started from a terminal session the KDM way is seems to be more complicated to implement.
Create a script runKDE:

echo Setting up the KDE runtime environment.
. kde4-run-env
echo Starting the DBus session.
eval `dbus-launch --auto-syntax`
echo Starting the X server.
export DISPLAY=:1
X -novtswitch $DISPLAY &
echo Starting KDE 4 on tty8
sleep 2

and copy into /home/kde-devel/. Log out with kde-devel in your Konsole session. Switching between terminal sessions explained under “Set up the environment”. Now switch to tty1 and login as kde-devel and run the script runKDE:


if the script doesn’t switch automatically to tty8 – where your KDE is starting – then switch manually. The first start takes more time because KDE is build the configuration from scratch.

  • SVN Changes

For updating the sources just do:

cs KDE
svn up kdelibs kdepimlibs kdebase

and repeat the steps under “Build the sources”.

It’s possbile that while trying to “svn up” your sources svn returns with an error like:
No such revision X. This happens because the synchronization between the mirrors providing the sources for the anonymous svn. Wait a few minutes and try again.

All comments and corrections are appreciated.

Happy hacking!

KDE 4 trunk


KDE 4 turnk


Internet Connection Sharing on Ubuntu & Windows with Ad-hoc


First I was very excited when my brother asked for my help to choose him a laptop. My other task was to share our internet connection between a Desktop PC and two laptops without using switch or router. Of course the story became more interesting due to the different operating systems. I’ll try to show how to set up your home network in such situations.

Important to make sure that you have installed drivers for networking interfaces!

About the connection: cable-net,  the modem is connected to the Desktop-PC with USB.

Configuring the wired interfaces:

Desktop-PC has two networking interfaces, the first (in the following text: eth0) has automatic network  address through the modem (DHCP). We need to allow to the other computers in our network (in this case just one laptop) to connect to the internet through this connection [1].

The another network interface of Desktop-PC is eth1 – it has static address, set to with subnet mask . We need to connect this network card (eth1) to one of our laptops directly. I connected it first to the laptop with Windows XP, of course you can connect it to the laptop with Linux but the Internet Connection Sharing and the IP configuration becomes more complicated in that case. When connecting our Desktop-PC and laptop directly we must to use crossover (crosslink) cable! So, we connected our Desktop-PC’s card (eth1) with our Laptop’s ethernet card (in the following text: eth2). The address configuration for this card need to be also automatic – eth1 will deal for eth2 an address, subnet mask and gateway too.

Configuring the wireless interface on Windows:

At this point you have working internet connection on both Desktop-PC and laptop (with the interface eth2). We’ll share this connection with the second laptop through an ad-hoc network. First of all you need to configure the eth2 card to allow the other computers in the network to connect to the internet through this connection ( see [1]).

Create an Ad-hoc wireless network with your integrated wireless card (wlan0 in the following)  on the laptop with Windows XP (no encryption used in this example to simplify the setup).

After creating an Ad-hoc network,  set static address for wlan0, IP:, subnet: You have configured your Windows machines, move to the laptop with Linux.

Configuring the wireless interface on Linux:

In this example I’m using Ubuntu 9.10 Karmic Koala, but you will find the same expressions on other Linux distributions and in different Network Configuration Interfaces. Create a new wireless connection and set the connection type to Ad-hoc.

The most important part is the IP configuration. On your Linux laptop for the wireless interface (wlan1) set static addresses for IP: (actually the end of this address can be anything – in the allowed range – the only important thing is that it must be different from the last part of your static address of the interface wlan0), subnet, for Gateway and DNS set the IP address of the interface wlan0.

Apply the changes and connect to this Ad-hoc network on your Windows and Linux laptops.

If you have any question, please comment.

Find executables for missing start menu applications

You will find the most programs in your Start menu. They have search function. Type there the programs name, that’s all. But, sometimes it happens that the installer doesn’t create start menu entry.
Our freshly installed package called tightvnc. So, if the program isn’t there, then you need to find the executable for it. In windows, you go to the place where the program was installed, and double click to the executable. In Linux: you need to open the Terminal, Konsole, whatever – the Command line.
Like in windows you can search for all installed programs in Add Remove programs. Here is the alternative – a bit faster. Type in Command line (CLI) the following:

rpm -qa | grep tightvnc

the output will be all installed packages containing the name tightvnc. Copy the FULL name (including number) of the tightvnc package, this is what you need. Now type this:

rpm -q --fileprovide [pasteherethefullname]

This will output the complete list of files installed from this package. The executables are mostly in the /usr/bin/ directory.
My output:

akoskm@linux-3fx0:~> rpm -q --fileprovide tightvnc-1.3.9-80.41

Now you can simple start any of these executables in the /usr/bin/ directory by typing them to the command line.

Creating and mounting ISO images in Linux terminal

There are thousand of applications outside for creating ISO images, and also a thousand for mounting and reading these virtual disks – but, have you ever thought that it’s possible through the Linux terminal, by using 2 simple commands? You’ll need 2 core applications: dd (DiskDump) and mount. These small applications are core components in every Linux distribution, so you don’t need to install anything. So, how to create ISO image with them?
Insert a disk into your optical drive – of course it’s also possible to create ISO image from an USB disk. Open the terminal window, and execute:

dd if=/dev/sr0 of=test.iso

where if points to your optical drive (input file), of is the patch, where the ISO image will be created (output file).
Now, our ISO image is done, lets go mount it! The first thing what we need is a mount point for our ISO image. Lets create one:

mkdir isoTmp

this will be the name of the directory where the ISO image will be mounted. Now mount the ISO with the command (only root can mount so you need superuser rights – and his password :)):

sudo mount -o loop test.iso isoTmp/

where the -o specifies that our device is a loop device, after that comes the patch for the .iso file, and finally the directory where we mount this ISO image. After executing this command the image will be mouted, and you can browse it on the local filesystem.
You can unmount it by executing:

sudo umount tmpMnt/


For more information about filesystems, and other specific options type:

man mount

in terminal.
Happy hacking! 🙂

Traffic Limit on Linux

On the Unix-like operating systems the user can choose from many advanced tools to control the network. My opinion is that these tools are too advanced (for an everyday user – no programmers, admins, hackers 🙂 ) – so after some searching I’ve found a little script what can be easily modified and executed to limit the network speed.
Grab this script from http://lartc.org/wondershaper/. Extract it, then with your favorite text editor open the script called wshaper. Intuitively, these lines:


are indicating the upload, download speed (in kilobits!), and the network interface. After modifying these parameters you need to comment out the following two lines:

echo Please read the documentation in ‘README’ first :-\)

by adding the # sign to the beginning of these lines. Save your script. Open the console window and navigate to the directory which contains the script wshaper, get root powers with


and execute the script:

sh wshaper


A little speedup.
Use command line for every action. Command line is x10 faster then any GUI application. It’s easy to learn and use. Use the edit command for editing the wshaper script (assuming the you can navigate in console with cd command):

edit wshaper

. When the editor loads the script with arrow-keys navigate to the lines what you want to modify. Press A – now you can write into the text – and modify the values. To save, press the : key (SHIFT + ;) and type:

save wshaper

. Use the same commands to execute the script:

sh wshaper


About HOWTO’s

As you can see a new label has been appeared on the side-bar, called HOWTOs. The users need it. When I’m finished with my first how-to on the next week I’m linked it in ~5 forum posts on KDE and openSUSE forums.
Users – came from Windows world – are opening posts about renaming, moving files and they are making longer thread then Fixing your Buggy DST code table. They aren’t lames, but the words like permission, user, execute have no meaning in their world, they are calling these things like: ActiveX, I, double-click. I’m absolutely sure that an ordinary people (at least reading and writing skills) who uses computer for browsing the Internet can’t figure out anything from manuals like this (part of man mv 1):

mv – move (rename) files


. Nobody can say me that working in Linux is hard. No it isn’t… actually, my girlfriend (no programming skill, no PC using skill) is using openSuSE. And she is very happy with it. I’m explained a lot of things and now she is using her Laptop as a productive machine. HOWTOs are important, if you are new to Linux and want to learn how to live different, how to live in community, you need just once to read these tutorials after it’s going like 1+1, and you’ll have more fun!