New website – Anuj
using wget
wget is a very good utility to download large files or iso images.
When downloading large file or DVD iso, you can use wget -c ‘url to iso file’ which you can resume download from where you left last time.
Sometimes there are scuh links which keep a lot of garbege, and using wget -c ‘url to iso file’ causes a new thread a new download instead of resuming.
In such a case you can use wget -c ‘url to iso’ -O my-dvd.iso
Using -O file name downloads file with file name and always can be resumed.
Anuj
Website moved
bypass port blocking of ISP using hamachi
Here we will be connecting two linux machines, of which ISP is blocking ports.
On the machine behind the blocked ports:
Download hamachi for linux.
https://secure.logmein.com/products/hamachi/list.asp
I have hamachi-0.9.9.9-20-lnx.tar.gz
- Uncompress tar file with
tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz -C /usr/src/ - Change directory
cd /usr/src/hamachi-0.9.9.9-20-lnx/ - Install hamachi
make install - Run tuncfg command
tuncfg - Generate crypto identity
hamachi-init - Start hamachi daemon
hamachi start - Put hamachi daemon online
hamachi login - Create hamachi network
/usr/bin/hamachi create myHamNetwork password - Now become online in created network
/usr/bin/hamachi go-online myHamNetworkFollow these steps on the machine from which you want to connect to the blocked machine:
- Download hamachi for linux.https://secure.logmein.com/products/hamachi/list.aspI have hamachi-0.9.9.9-20-lnx.tar.gz
- Uncompress tar file with
tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz -C /usr/src/ - Change directory
cd /usr/src/hamachi-0.9.9.9-20-lnx/ - Install hamachi
make install - Run tuncfg command
tuncfg - Generate crypto identity
hamachi-init - Start hamachi daemon
hamachi start - Put hamachi daemon online
hamachi login - Join the hamachi network
hamachi join myHamNetwork - You will be prompted for the password of myHamNetwork, in earlier steps we defined password as ‘password’ on machine behind blocked ports.
- Check the list of hamachi network with
hamachi list
* [myHamNetwork]
* 5.66.11.169 118.94.50.194:32774
Here we can see 5.66.11.169 is th - Now become online in created network
/usr/bin/hamachi go-online myHamNetwork - a
- hamachi-init
Configure sifyconnect on linux- Auto Connectivity
Following steps will give you sify client on linux, working with an automatic connectivity, you need to be root.
- Create a directory where we will be keeping sifyconnect related files or scripts.
mkdir /usr/src/sify - Change directory
cd /usr/src/sify - Download sifyclient from http://thegoan.com/supersify/
wget http://thegoan.com/supersify/supersify.zip - unzip downloaded sify client.
unzip supersify.zip - I modified the provided ss.sh script just as for my needs, there may be some other method. Just added ‘cd /usr/src/sify’ line as first line to ss.sh.
cd /usr/src/sify
java -jar supersify.jar $*
if [ $? -eq 1 ]
then read
fi - Created a second script to login without providing password every time#!/bin/bash
#
#Change USERNAME, PASSWORD and ETH according to your system and user/pass
#Change ETH with the ethernet card connecting to sify ISP
#mail me: anuj.unix@gmail.com
#Ends.
USERNAME=my_sify_username
PASSWORD=my_sify_password
ETH=eth1
#Get the mac address here
MAC_SIFY=`ifconfig $ETH |grep HWaddr|cut -d ” ” -f 11`
if [ "$#" -ne 1 ];then
echo “To connect: `basename $0` -c ”
echo “To disconnect: `basename $0` -d ”
exit
fi
#Change directory where we unzipped the supersify.zip
cd /usr/src/sify#To connect sify
if [ "$1" = "-c" ];then
/bin/sh ss.sh -u “$USERNAME” -p “$PASSWORD” -m $MAC_SIFY
#To disconnect sify
else if [ "$1" = "-d" ];then
echo “Logging out from sify”
/bin/sh ss.sh -l
else
echo “To connect: `basename $0` -c ”
echo “To disconnect: `basename $0` -d ”
exit
fi
fi - chmod the script
chmod 700 /usr/bin/sifyconnect - To check the internet connectivity create one more script, f.e. /usr/bin/sifychk#!/bin/bash
#
#to check the internet connectionping -c 4 google.com
if [ "$?" -ne 0 ];then
/usr/bin/sifyconnect -c
else
exit
fi - chmod 755 /usr/bin/sifychk
- Add an entry in cron to automatically try to connect in case you are disconnected. Following crontab entry will check the internet connectivity every minute and connect automatically in case of disconnection. Obviously network cable and ISP should be reachable.crontab -e
* * * * * /usr/bin/sifychk >/dev/null 2>&1
That’s it.
Anuj Singh.
Link Aggregation and High Availability with channel Bonding
Channel bonding treats multiple physical connections to switch units as a single logical link.
1. Create /etc/sysconfig/network-scripts/ifcfg-bond0 file with following entries:
DEVICE=bond0 |
2. Create an ifcfg-ethn file for each interface in the bond.
l Our /etc/sysconfig/network-scripts/ifcfg-eth0 file
DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none |
2 Our /etc/sysconfig/network-scripts/ifcfg-eth1 file
DEVICE=eth1 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none |
3. Add the following lines to /etc/modules.conf:
alias bond0 bonding |
4. restart networking
service network restart |
how to ssh without password
public key based authentication
Objective: To run a command on a remote linux machine without entering a password.
Remote Linux Machine (10.1.10.6)
Local Machine (10.1.10.20)
Steps for Local Machine:
-
Generate a public key with command
ssh-keygen -t dsa |
Generating public/private dsa key pair. Enter file in which to save the key (/home/anuj/.ssh/id_dsa): Created directory '/home/anuj/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/anuj/.ssh/id_dsa. Your public key has been saved in /home/anuj/.ssh/id_dsa.pub. The key fingerprint is: 6e:c0:f4:ad:d7:97:37:e6:09:9a:56:ee:79:48:5f:92 anuj@node2.example.com |
Copy generated ‘id_dsa.pub‘ on remote server as ‘authorized_keys’ in ‘.ssh’ under the home directory of intended user for remote command execution. Here in example remote user being used is ‘root‘ of remote machine 10.1.10..6
scp .ssh/id_dsa.pub root@10.1.10.6:.ssh/authorized_keys |
The authenticity of host '10.1.10.6 (10.1.10.6)' can't be established. RSA key fingerprint is 5d:17:94:69:22:6b:c0:99:79:c2:ff:7e:2d:86:9b:d7. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.1.10.6' (RSA) to the list of known hosts. root@10.1.10.6's password: id_dsa.pub 100% 617 0.6KB/s 00:00 |
Test the configuration by executing some command as follows: (example command used is ‘uptime‘
ssh root@10.1.10.6 uptime |
12:14:43 up 23:18, 0 users, load average: 0.00, 0.03, 0.05 |
anujhere@gmail.com