Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

Hotplug scripting

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
plato
n00b
n00b
Posts: 5
Joined: Wed Dec 20, 2006 3:58 pm
Location: Boston, Massachusetts

Hotplug scripting

  • Quote

Post by plato » Wed Feb 07, 2007 8:22 am

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: Select all

/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.
Top
Lloeki
Guru
Guru
User avatar
Posts: 437
Joined: Wed Jun 14, 2006 2:14 pm
Location: France
Contact:
Contact Lloeki
Website

  • Quote

Post by Lloeki » Thu Feb 15, 2007 1:46 pm

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*** ;)
Top
Post Reply

2 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic