Saturday, May 29, 2010

Perfumetaste In Mouth

Scripts network administration in Linux

The first script task a little easier if we have to manually assign an IP address to an interface command-line network (in this case has caught the eth0). _______________________________________
#! / Bin / bash
# Author: Juan Jose Fumero Alfonso # Date: 03/26/1910 # Script automation allocation
# a new ip to the eth0 interface.
# check if string $ 1, $ 2 are # empty
if [ -z $ 1
] &

[ -z $ 2
] ; then
echo-e
"mode use:. / Ip \u0026lt;address> \u0026lt;mask>" else echo -e "\\ n ************ ************** eht0 ****"
echo
-e "\\ Tasigna ip: $ 1 "

echo -e
"\\ TCON mask: $ 2 " sudo ifconfig eth0 up $ 1
netmask $ 2 echo -e "\\ n" fi


_______________________________________ The second script deletes the gateway had and added that we indicate as an argument: _______________________________________
#! / Bin / bash

    # Author: Juan Jose Fumero Alfonso  

# Date: 26/03/1910
# Check if the string $ 1 is empty
if
[
   -z $ 1  
]
Then echo-e "Usage:. / routerGateway \u0026lt; address> " else # remove the default route sudo the default route # add the new
sudo route add default gw $ 1
eth0 fi
_______________________________________

0 comments:

Post a Comment