#!/bin/sh
#shell script to add static ip
killall dhclinet
echo “Adding static ip”
sudo ifconfig eth0 up 192.168.1.2 netmask 255.255.255.0
echo “successfully added eth0″
echo “checking weather the gw is reachable or not ”
while [ -n "$(ping -c 2 192.168.16.1 | grep 100%)" ]
do
echo “gateway not reachable try it agian”
exit
done
echo “now adding default gateway for this network”
sudo route add default gw 192.168.1.1
echo “now checking weather it is added or not ”
route -n
echo ” sucessfully added”
done