Proxy Sharing Using SSH Tunelling
Many a times, we are working on internet behind a proxy server
and have download limit that expires faster than we expect/want it to.
Students generally resort to sharing proxy passwords among themselves.
While this is ok, it creates a lot of security and other problems. Here
is a way for a student to access another's proxy without sharing the
password.
Consider a scenario where personA is connected to proxy and personB
wants to connect to it using personA's connection. Since A is logged
into the proxy, http, https, ftp and socks connection to proxy-server
must be available on local port. We will consider a scenario for
http_proxy of IIT Delhi.
The proxy-server's ip is 10.10.78.62 and the http_proxy is available on
port 3128. Lets call them proxy_server and http_port respectively
At A :
-
Connect to Proxy
At B:
-
ssh -L $my_http_port:$proxy_server:$http_port userA@userA_IP
- Cool. Proxy tunnel has been setup for http.
- Point your firefox to use the port $my_http_port on localhost for http_proxy.
You are done.
The funda behind this is :
At B, you are mapping a localport 19000(any unused port should work) to
point to 10.10.78.62's (proxy ip) 3128 port (http) using userA@userA_IP
as an intermediate.
Using multiple versions of gcc at the same time
Chances are that many programs compiled for
gcc 4.6 may not work for gcc 4.7.
Hence you must keep both and at the
same time make the link to
gcc4.7 vary according to the situation.
You
can edit your gcc file to be a shell script :
#!/bin/sh
if [ -n "$GCC_SIX" ];
then
exec /usr/bin
/gcc-4.6 "$@"
else
exec /usr/bin/gcc-4.7 "$@"
fi
Now, whenever you find a program not working on gcc4.7 just set an environment variable and
you have switched to gcc4.6 for the current execution. Notice that for a multi-user system, this
can prove to be a life saver.
Setting up wifi in Dell Laptop for Ubuntu 11.04/10
To be added later.
Using GNU screen to run your programs on server
To be added later.
Using Skype behind proxy
To be added later.
Connecting qemu guest to real network using bridge
There are literally dozen or more methods available on the internet for bridging qemu guest to the real network.
But sadly, most of them are too complicated or too stupid to work.
Below are simple steps for bridging a qemu guest to the host network.
- Release ip address on the host (dhcpcd -k eth0)
- Make sure eth0 is refreshed (ip link set eth0 down) (ip link set eth0 up)
- Create a bridge (brctl addbr bridge)
- Connect eth0 to bridge (brctl addif bridge eth0)
- Start ip-stack on bridge. (dhcpcd -n bridge)
Now, when qemu uses tap device, we should attach this device to bridge.
Add this line to /etc/qemu-ifup
brctl addif bridge $1
Here $1 is the name of the tap device that qemu uses for guest
When the guest is powered off, qemu should remove the interface of tap device from bridge.
Add this line to /etc/qemu-ifdown
brctl delif bridge $1
For connecting qemu guest to the bridge, just tell qemu to configure guest's network using the tap device.
sudo qemu-system-i386 -enable-kvm -net tap,vlan=0,ifname=tap0 -net nic,vlan=0 -hda ~/Data/OS_DiskImages/ubuntu11.10/disk.qcow2
Here is a link to all the three scripts.
- Starting bridge
- qemu-ifup script
- qemu-ifdown script