Created
December 14, 2012 13:43
-
-
Save maditnerd/4285559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
interfaces=$(ifconfig |grep "Link"|awk '{print $1}') | |
interface=$(whiptail --inputbox "Listes des cartes reseaux\n-----------\n$interfaces" 0 0 "eth0" 3>&1 1>&2 2>&3) | |
ipaddress=$(ifconfig $interface|head -n2|tail -n1|awk '{print $2}'|sed -e 's/'addr:'//'|sed -e 's/'adr:'//'); | |
netmask=$(ifconfig $interface |head -n2|tail -n1|awk '{print $4}'|sed -e 's/'Mask:'//'|sed -e 's/'Masque:'//') | |
broadcast=$(ifconfig $interface |head -n2|tail -n1|awk '{print $3}'|sed -e 's/'Bcast:'//') | |
gateway=$(route |grep "default" |awk '{ print $2 }') | |
ip_choice=$(whiptail --inputbox "Entrer votre adresse IP - Votre Adresse IP est actuellement :"$ipaddress 0 0 $ipaddress 3>&1 1>&2 2>&3) | |
clear | |
echo -e "Copier ceci dans /etc/network/interfaces\n\niface $interface inet static\n address $ip_choice\n netmask $netmask\n broadcast $broadcast\n gateway $gateway" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment