Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[UTILITY] Script dhcp per gentoo
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Sun Nov 21, 2004 3:06 pm    Post subject: [UTILITY] Script dhcp per gentoo Reply with quote

Penso che se ne sia gia' parlato, volevo postarvi questo scriptino che ho fatto per farmi andare il dhcp alla partenza solo se il cavo di rete e' collegato. In caso che sia scollegato vi rimane l'ip statico dato da net.eth0. Quindi dovrete prima cambiare in /etc/conf.d/net, da dinamico a statico.

Code:
#!/sbin/runscript

depend()
{
   need net.eth0
}

start()
{
   /bin/sleep 2
   link_down=`/sbin/mii-tool | /bin/grep "no link"`
   if [ "$link_down" = "" ]
   then
      ebegin "Starting net.dynamic"
      dhcpcd eth0
      #/bin/echo "nameserver 127.0.0.1" > /etc/resolv.conf
 eend ${?}
   else
      eerror "No net cable found!"
      return 1
   fi
}

stop()
{
   ebegin "Stoppig net.dynamic"
   /etc/init.d/net.eth0 stop
   eend ${?}
}


Va messo in /etc/init.d/net.dynamic

Potete aggiungerlo al runlevel di default con rc-update add net.dynamic default.

Se il vostro pc ha il server dns locale, dedommentate questa riga:
Code:
#/bin/echo "nameserver 127.0.0.1" > /etc/resolv.conf


Natuarlmante e' uno script non fatto benissimo, del tipo che non ho usato un'altro script di configuarazione, ma solo questo, pero' sembra funzionare (se avete proplemi di lentezza, aumentate i secondi di sleep).

Spero possa servire a qualcuno :roll:
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30925
Location: here

PostPosted: Sun Nov 21, 2004 5:09 pm    Post subject: Reply with quote

Ed usare ifplugd che fa tutto questo?
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
X-Drum
Advocate
Advocate


Joined: 24 Aug 2003
Posts: 2517
Location: ('Modica','Trieste','Ferrara') Italy

PostPosted: Sun Nov 21, 2004 5:12 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Ed usare ifplugd che fa tutto questo?


....non è da "ackari" :lol:
_________________
"...There are two sort of lies, lies and benchmarks..."
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Sun Nov 21, 2004 5:14 pm    Post subject: Reply with quote

Quote:

Ed usare ifplugd che fa tutto questo?


mmmm e'.... mi sa che lo provero'... :oops:
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30925
Location: here

PostPosted: Sun Nov 21, 2004 5:15 pm    Post subject: Reply with quote

silian87 wrote:
mmmm e'.... mi sa che lo provero'... :oops:

Bello anche il tuo ma ormai uso da tempo ifplugd e va benissimo
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Sun Nov 21, 2004 5:20 pm    Post subject: Reply with quote

Quote:
Bello anche il tuo ma ormai uso da tempo ifplugd e va benissimo

thk, infatti era proprio questo che cercavo
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Sun Nov 21, 2004 5:21 pm    Post subject: Reply with quote

Al limite provo a vedere se riesco a sistemare il mio per migliorarlo un po :-D. Almeno ho imparato qualcosina sugli script gentoo-style.
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
Raffo
Veteran
Veteran


Joined: 23 Apr 2004
Posts: 1019
Location: Berlin

PostPosted: Sun Nov 21, 2004 5:39 pm    Post subject: Reply with quote

cos'è questo ifplugd?? mi documento va....
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30925
Location: here

PostPosted: Sun Nov 21, 2004 5:42 pm    Post subject: Reply with quote

Raffo wrote:
cos'è questo ifplugd?? mi documento va....

Niente semplicemente ti alza la rete sono se il cavo e' attacato. Se e' staccato e poi lo atacchi fa partire lui automaticamente
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Raffo
Veteran
Veteran


Joined: 23 Apr 2004
Posts: 1019
Location: Berlin

PostPosted: Sun Nov 21, 2004 5:44 pm    Post subject: Reply with quote

quindi vado di "emerge ifplugd" :D
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30925
Location: here

PostPosted: Sun Nov 21, 2004 5:45 pm    Post subject: Reply with quote

Raffo wrote:
quindi vado di "emerge ifplugd" :D

Si poi lo configuri togli il runlevel net.eth0 e metti ifplugd
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Raffo
Veteran
Veteran


Joined: 23 Apr 2004
Posts: 1019
Location: Berlin

PostPosted: Sun Nov 21, 2004 5:51 pm    Post subject: Reply with quote

quindi edito ifplugd e faccio
Code:

rc-update del net default
rc-update add ifplugd default

le righe
Code:
iface_eth0="dhcp"
dhcpcd_eth0="-h localhost -t 10"

che sono in net le devo copiare in ifplugd??
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30925
Location: here

PostPosted: Sun Nov 21, 2004 6:21 pm    Post subject: Reply with quote

No rc-update del net.eth0 default . Per configurare ifplugd cerca un post di MyZelf
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Raffo
Veteran
Veteran


Joined: 23 Apr 2004
Posts: 1019
Location: Berlin

PostPosted: Sun Nov 21, 2004 6:50 pm    Post subject: Reply with quote

ho seguito il tip trovato, ma nn ne vuole sapere di andare....
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum