LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 10-23-2017, 11:16 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,312
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Detecting hotplugged Ethernet cables in OpenBSD


What is the best way to trigger a script when specific Ethernet interfaces go from status "no carrier" to status "active" and back again?

I'm aware of hotplugd(8) which can detect the status of some devices but not able to find how to make it aware of whether specific Ethernet cables are plugged in or not.
 
Old 10-23-2017, 11:39 AM   #2
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 289

Rep: Reputation: 169Reputation: 169
You want ifstated(8) and ifstated.conf(5).
 
1 members found this post helpful.
Old 10-23-2017, 12:43 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,312

Original Poster
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Sweet. That was hiding in plain sight. The manual pages hostname.if(5) and hotplugd(8) don't mention it at all. The example configuration is a great help though. Now I just have to work out the logic of having hot swappable egress without race conditions.

Last edited by Turbocapitalist; 10-23-2017 at 12:46 PM.
 
Old 10-23-2017, 01:33 PM   #4
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 289

Rep: Reputation: 169Reputation: 169
The hotplugd(8) tool is used for device additions and removals, which occur on a bus (PCI, USB, etc.) That's a little different than a state change reported through an existing NIC.

Consider the case of a USB-attached NICs. The attach/detach of the NIC to the bus would be managed by hotplug(). The state of the network cabling attached to the NIC could be managed by ifstated().

And ifstated() can be used with external scripts so that you can manage all sorts of states. Not just a NIC's media interface.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Crimp Your Own Ethernet Cables LXer Syndicated Linux News 0 11-05-2009 12:30 AM
Question about Ethernet Cables for Gigabit MQMan Linux - Networking 11 08-19-2006 03:54 PM
two (parallel) Ethernet cables between two hosts? linux_newbie_23 Linux - Networking 4 09-15-2004 11:20 PM
connecting two PCs for file transfer via Ethernet cables jax Linux - General 4 02-22-2002 01:39 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 10:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration