How to determine interface RUNNING state without ifconfig?
5
votes
1
answer
15446
views
Some background: sometimes my wi-fi connection suddenly goes down so I type
sudo ifconfig wlan0
and check for the word RUNNING
. The corresponding line looks like:
UP BROADCAST RUNNING MULTICAST [...]
When the connection goes down there's no RUNNING
setting; I can't connect to anything but the interface is still up.
I'm thinking of writing a script to periodically check for the RUNNING
state. To extract that string, using awk
would be something like: sudo ifconfig wlan0 | awk '/RUNNING/ {print $3}'
.
Is there another way such as checking the filesystem instead of parsing ifconfig's output?
I'm using Debian Wheezy.
Thanks.
---
**More information:**
OK, just did some research and cleared up some conceptual confusion.
The UP
and RUNNING
flags are different. The first means the interface "is currently initialized" , i.e. "the system allocated the resources for the interface" --it doesn't say anything about packet transmission.
The RUNNING
flag actually indicates that packets are being sent and received. Apparently this flag disappears if e.g. the ethernet cable is unplugged.
https://docs.oracle.com/cd/E19253-01/816-4554/ipconfig-141/index.html
https://stackoverflow.com/questions/11679514/what-is-the-difference-between-iff-up-and-iff-running
I don't know what is going on with my (or any) wireless connection, but the result is the same: the interface remains up (the wi-fi led light remains on in my laptop) while the connection is completely lost.
Asked by undostres
(235 rep)
Apr 1, 2015, 03:43 PM
Last activity: May 27, 2024, 01:35 AM
Last activity: May 27, 2024, 01:35 AM