Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hotplug scripting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
plato
n00b
n00b


Joined: 20 Dec 2006
Posts: 5
Location: Boston, Massachusetts

PostPosted: Wed Feb 07, 2007 8:22 am    Post subject: Hotplug scripting Reply with quote

I've been scouring the net for hours trying to find a way to have my lovely little Gentoo box figure out a way to keep itself connected to the internet. I have a wired net.eth0 interface and a wireless net.eth1 interface. The goal is to have the following scenarios take place:

1.) If I remove the ethernet cable, call
Code:
/etc/init.d/net.eth0 stop && /etc/init.d/net.eth1 start

and have it restart all the cached dependencies of net.eth0.

In other words, the goal is to formally stop the eth0 interface and start the eth1 interface like nothing ever happened whenever the cable is removed.

2.) If I plug in the ethernet cable, do the opposite: stop eth1 and start eth0, restart cached dependencies.

All the documentation I've read is a bit too technical to digest. If someone could point me in the right direction, I'd be mighty appreciative.
_________________
Never put off today what you can put off tomorrow.
Back to top
View user's profile Send private message
Lloeki
Guru
Guru


Joined: 14 Jun 2006
Posts: 437
Location: France

PostPosted: Thu Feb 15, 2007 1:46 pm    Post subject: Reply with quote

emerge either netplug or ifplugd (I use the latter).
then, it's automagic: plugged in? eth0 goes up. unplugged? eth0 goes down.

if you use wpa_supplicant (along with WPA APs, it can be used also for unencrypted and WEP), it'll basically do just the same with eth1.

there's nothing wrong with having both eth0 and eth1 up at the same time. software will just use the first resolved route (type route in a console to see the current order)

your concern may be that if you have ethernet, then you may want the system to favor routing over ethernet, because it's either more reliable, or has more throughput. there are solutions to that, where the one with the highest metrics is favored, but I can't recall exactly.

personally, I don't care and just do the above, since all I want is connectivity, and wifi is stable enough and performant enough for me. and if I really want eth0, I just stop eth1 manually or slap the rf kill switch.
_________________
Moved to using Arch Linux
Life is meant to be lived, not given up...
HOLY COW I'M TOTALLY GOING SO FAST OH F*** ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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