Results 1 to 10 of 11
Sorry for this stupid question. How to know if the Lan cable is plugged in ethernet card or not. If it possible I want to know how to check it ...
- 12-09-2008 #1
[SOLVED] Detect Lan cable plug/unplug
Sorry for this stupid question. How to know if the Lan cable is plugged in ethernet card or not. If it possible I want to know how to check it at terminal and graphic mode.
If I am not mistaken, to detect cable, we can use ping right? But what the error message do I get when it is unplugged. And also to where should I ping?
- 12-09-2008 #2
Hello,
I do not know how to do this. But on my computer, if I pull the ethernet cable, a balloon notice comes up to tell me about what has happened. The program that does it is GNOME's network monitor applet.
You can find it here
https://launchpad.net/gnome-netstatus/
to look how they did it.Debian GNU/Linux -- You know you want it.
- 12-10-2008 #3
Thanks GNU-Fan...
I will take a look. But I still hope somebody can tell me how to see it, when in terminal...
- 12-10-2008 #4
type ifconfig in terminal, you should see a bunch of stuff, if you are given an ip under eth0 or something like that, it's connected, if it doesn't, you're not
Bodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 12-16-2008 #5
Hm... I've tried it. But no... The result of my ifconfig result when the cable unplugged is same with plugged.
- 12-16-2008 #6
from the command line run the following command
if its connected it will return connected if not it will return disconnected.Code:nm-tool | -m 1 -i state
NOTE - this supposes that you are using NetworkManager(very likely)Linux and me it's a love story
- 12-16-2008 #7
that doesn't make any sense (the ifconfig one). When you are plugged in you'll get an ip address for eth0....it'll be something like 192.168.1.X or something like that (depends on your routher/modem). When you are unplugged you won't get an ip for eth0 at all and it'll just be 000.000.0.0
Bodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 12-16-2008 #8
sorry , in my upper post i forgot the grep command. its as follows]
this is when the cable is disconnected before the NIC gets its IP address but if after the NIC is configured and got its IP address if you unplug the cable ifconfig won't tell you about the state. i think that is what the thread owner is talking about. in that scenario what he said is correct as far as i knowCode:nm-tool | grep -m 1 -i state
Linux and me it's a love story
- 12-17-2008 #9
Yay.... thanks Khafa...
I think this one is sufficient for me to detect the cable...
btw, about the ifconfig problem, could it because I am using static IP, so I won't affect even I am disconnected?
- 12-18-2008 #10
you can sum up like this
1) NetworkManager:
when you use NetworkManager(meaning that you let it control your connection) it will detect that the cable is unplugged and it will trigger a state change using the dbus messaging system. so in this case ifconfig is sufficient to know if the cable is plugged or not.
2) without NetworkManager:
in this case there is nothing to trigger the state change so ifconfig wont know about it and you need nm-tool to check the state as i gave you.Linux and me it's a love story



