Restore panel in ubuntu

Well, this was funny though, but today I messed up the top panel of my desktop πŸ˜›

So, a little search gave me some results and which actually worked for me. Just few lines of commands gave me the top panel back again.

$ gconftool-2 --shutdown
$ gconftool --recursive-unset /apps/panel
$ rm -rf ~/.gconf/apps/panel
$ pkill gnome-panel


Internet sharing using a gateway computer

Gateway setup:
eth0 = the network adapter with internet (IP:
eth1 = the network adapter with client machine (IP:
The local network card cannot have the same subnet with the internet adapter.

Now, configure the internal network card for a static IP address as you need.

Configure the NAT (Network Address Translation):
Basically, here I’ll be configuring the iptables for NAT translation so that packets can be routed through the gateway.

$ sudo iptables -A FORWARD -o eth0 -i eth1 -s -m conntrack --ctstate NEW -j ACCEPT
$ sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
$ sudo iptables -A POSTROUTING -t nat -j MASQUERADE

These are the iptables rules.
Rule 1: It allows the packets being forwarded
Rule 2: Allows forwarding of established connection packets
Rule 3: It does the NAT

iptables rule doesn’t save by default. It has to be saved manually.

$ sudo iptables-save | sudo tee /etc/iptables.sav

Edit the /etc/rc.local and add the following lines so that it calls that file every time when the gateway machine is booted.

iptables-restore < /etc/iptables.sav

Run the following line

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

Uncomment the following line from /etc/sysctl.conf


Client setup:
eth0 = the network adapter with the gateway pc (IP:

Change the gateway to the host machines IP address.

To configure DNS server edit the /etc/resolv.conf file and add ISP’s DNS servers.

nameserver xx.xx.xx.xx

And Boom!! πŸ˜€

Switch between eth0 and eth1 in debian based system

So I bought a new NIC. Putting two NICs together I was having a little annoying problem as I had to setup mac and IP bindings every time I give a new installation. Sometimes the devices was choosing their sequences randomly. I don’t know what’s the methodology behind choosing in their architecture. But they obviously put a ways to fix it.

To change the detect the ethernet in your way just do a simple editing.

 sudo nano /etc/udev/rules.d/70-persistent-net.rules 

and change the NAME as you want it e.g. eth0 or eth1.

Reboot the machine. That’s it!

Folder path in Mac OS X

By default Mac OS X doesn’t give a folder path like we get in Windows. Sometimes I really felt the address bar I had in Windows. While I was googling for a address bar I found something really cool. I tried the cool trick and got it so perfect.
To activate folder path, go to Terminal and type:

defaults write _FXShowPosixPathInTitle -bool YES

To see the changed effect right away, type:

killall Finder

Now, open up Finder and see the change on the top of it. πŸ˜€
To get back to the default mood, type:

defaults write _FXShowPosixPathInTitle -bool NO

and see! It’s gone! πŸ˜€

Setting up Virtual Host

Few days ago, while working on a project, I was in need of a vhost/virtual host. Then, I searched Google and found so many answers. I just didn’t know which one to try. All of them seems important. While working on my favorite lappy I tried most of those and now I forgot the places I edited.

However, I got a small process to make the thing done. I guess, when ever Name-based Virtual Host Support is needed, it’s gonna work.

I’ll be telling about *nix system.

From terminal.

sudo gedit /etc/apache2/httpd.conf

A new window is supposed to be visible. Go to the end of the file and paste the following lines or you can modify as needed.

<VirtualHost *:80>
	DocumentRoot /www/shaon

Then save and close this one and type on terminal,

sudo gedit /etc/hosts

put this your desired name for vhost just after localhost.	localhost

Now restart apache by typing

sudo /etc/init.d/apache2 restart

Name-based Virtual Host is now ready to go. πŸ™‚ Check it on your browser.