![]() |
Ciao e benvenuto da parte degli Stati Uniti al UNIX e Linux Forum! Grazie per la visita ed unirsi alla nostra Comunità Globale.
|
|
google unix.com
|
|||||||
| Forum | Registrati | Regole Forum | Collegamenti | Album | FAQ | Members List | Calendario | Ricerca | Today's Posts | Mark Forums Read |
| Reti IP Per saperne di TCP / IP, Internet Protocol, Routing, Router, Protocolli di rete in questo forum di UNIX e Linux. |
Più di UNIX e Linux Forum Argomenti potreste trovare utili
|
||||
| Filo | Thread Starter | Forum | Risposte | Ultimo Post |
| Come configurare il protocollo DHCP per IP statico | lee30320 | Reti IP | 5 | 01-27-2009 03:56 AM |
| dhcp e ip statico conflitti. | ts97783 | Reti IP | 1 | 11-01-2008 10:08 AM |
| HP-UX 10.xx Modifica da IP statico a DHCP | Steelysteel | HP-UX | 1 | 08-27-2007 05:55 PM |
| Statico | Wojtyla | Di programmazione ad alto livello | 6 | 02-25-2005 11:57 AM |
| IP statico | Reti IP | 7 | 05-18-2003 08:33 PM | |
![]() |
|
|
LinkBack | Thread Tools | Cerca in questo Thread | Rate Thread | Modalità di visualizzazione |
|
|
|
||||
|
Passare da DHCP a IP statico
Sto cercando di scrivere una serie di script per il mio 810 di Ubuntu Server per consentire a un utente di modificare da DHCP a un utente fornito Static IP, Subnet, Gateway e DNS Server.
Finora mi sono le seguenti, dove $ USERCHOICE è un utente iscritto valore in ogni caso: ifconfig eth0 down & & ifconfig eth0 $ USERCHOICE & & ifconfig eth0 up; ifconfig eth0 down & & ifconfig USERCHOICE netmask $ & & ifconfig eth0 up; ifconfig eth0 down & & route add default gw $ USERCHOICE & & ifconfig eth0 up; ifconfig eth0 down & & echo "nameserver $ USERCHOICE"> / etc / resolv.conf & & ifconfig eth0 up; Problemi: 1.It non funziona , Anche dopo il rilascio /etc / init.d / networking restart2. C'è un modo semplice per, da uno script, prendere più valori ed eseguire ogni comando usando il valore appropriato, piuttosto che in esecuzione di ogni componente, come una diversa opzione? 3. Come faccio a specificare 2 DNS Server invece di 1? Ho il sospetto che qualcuno ci sta già facendo, e in un modo molto più semplice che io sono il tentativo di Grazie per qualsiasi aiuto. Alex |
|
||||
|
Il seguente codice di miniera (citato in estratti) è stato utilizzato per consentire l'aggiornamento delle impostazioni di rete di una Debian-based vivi al momento del boot del sistema ...:
Codice:
eth0|eth1)
updateConsole
echo -ne "\e[33m"
echo ""
echo " \|||/ "
echo " (0 0) "
echo "-------ooO-(_)-Ooo-----------------------"
echo ""
echo "Attempting to upset, er, setup <$OPTION> ..."
echo ""
ADDRESS="192.168.110.100"
echo -n "Address [192.168.110.100]: "
read address
if [ "$address" != "" ]
then
ADDRESS="$address"
fi
GATEWAY="192.168.110.101"
echo -n "Gateway [192.168.110.101]: "
read gateway
if [ "$gateway" != "" ]
then
GATEWAY="$gateway"
fi
echo ""
echo -ne "\e[0m"
ETH=/etc/network/interfaces
mv $ETH $ETH.dhcp
ifconfig lo 127.0.0.1
route add 127.0.0.0 lo
ifconfig "$OPTION" "$ADDRESS" netmask 255.255.255.0
route add "$ADDRESS" "$OPTION"
route add default gw "$GATEWAY" "$OPTION" > /dev/null 2>&1
DNS=/etc/resolv.conf
mv $DNS $DNS.dhcp && touch $DNS
echo "nameserver 208.67.220.220" >> $DNS
echo "nameserver 208.67.222.222" >> $DNS
ping -c 1 housisms.net > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo -ne "\e[32m"
echo "You're now part of the 'World Wide Wait'."
SAVE="yes"
else
echo -ne "\e[31m"
echo "Nice try - to no avail, I'm (not) afraid."
SAVE="no"
fi
echo ""
echo -ne "\e[0m"
if [ "$SAVE" = "yes" ]
then
BROADCAST="`echo $ADDRESS | awk -F '.' '{ print $1"."$2"."$3".255"}'`"
touch $ETH
echo "auto lo" >> $ETH
echo "iface lo inet loopback" >> $ETH
echo "auto $OPTION" >> $ETH
echo "iface $OPTION inet static" >> $ETH
echo "address $ADDRESS" >> $ETH
echo "netmask 255.255.255.0" >> $ETH
echo "broadcast $BROADCAST" >> $ETH
echo "gateway $GATEWAY" >> $ETH
fi
;;
|
![]() |
| Segnalibri |
| Thread Tools | Cerca in questo Thread |
| Modalità di visualizzazione | Vota questo thread |
|
|