LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to detect eth0 status? (https://www.linuxquestions.org/questions/slackware-14/how-to-detect-eth0-status-747737/)

kakaburra 08-15-2009 06:54 AM

How to detect eth0 status?
 
I have an ADSL modem connected to my Ethernet card. I use pppoe-start to connect to the Internet. I want to know whether my modem is switched on (i.e.,if eth0 is up) so that i can run pppoe-start because the pppoe-start script does not seem to check the state of eth0 and tries to start pppoe. Is there any command to know modem's status??

linus72 08-15-2009 06:58 AM

Welcome to LQ kakaburra!

ummm...try ifconfig in terminal

Quote:

ifconfig
and uh..I think you can look in /etc/resolvconf and somwhere in there is a file named resolv.conf

mine says

Code:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#    DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 71.252.0.12
nameserver 71.242.0.12
search linksys

however, also in /etc/dhcp3 or /etc/ifplugd

it matters what distro your using too

please tell us what distro and your computer specs?

repo 08-15-2009 06:58 AM

Welcome to LQ
You can use
ifconfig

kakaburra 08-15-2009 07:11 AM

Quote:

Originally Posted by linus72 (Post 3644272)
Welcome to LQ kakaburra!

ummm...try ifconfig in terminal



and uh..I think you can look in /etc/resolvconf and somwhere in there is a file named resolv.conf

mine says

Code:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#    DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 71.252.0.12
nameserver 71.242.0.12
search linksys

however, also in /etc/dhcp3 or /etc/ifplugd

it matters what distro your using too

please tell us what distro and your computer specs?

Thankyou, but even if i switch off the modem, ifconfig still returns eth0's information.Output being


root@darkstar:/root# ifconfig

eth0 Link encap:Ethernet HWaddr 00:16:76:84:6e:c6
inet6 addr: fe80::216:76ff:fe84:6ec6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5935 errors:0 dropped:0 overruns:0 frame:0
TX packets:5940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3341987 (3.1 MiB) TX bytes:1182225 (1.1 MiB)
Interrupt:23 Base address:0xb800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:786 errors:0 dropped:0 overruns:0 frame:0
TX packets:786 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:88176 (86.1 KiB) TX bytes:88176 (86.1 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:59.93.69.27 P-t-P:59.93.64.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:233 errors:0 dropped:0 overruns:0 frame:0
TX packets:240 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:122686 (119.8 KiB) TX bytes:47759 (46.6 KiB)

I use Slackware 12.2.
There are no /etc/dhcp3 or /etc/ifplugd files.

kakaburra 08-15-2009 07:14 AM

Quote:

Originally Posted by repo (Post 3644273)
Welcome to LQ
You can use
ifconfig

Thankyou, but ifconfig doesn't help as i said in previous post.

NOT: My internet connection is perfectly fine. I just want to know my modem's status (i.e.,switched on/off ) so that i can write a script which automatically runs pppoe-start script if eth0 goes up.

repo 08-15-2009 07:17 AM

can you post the output from ifconfig if the modem is connected, but pppoe isn't started ?

kakaburra 08-15-2009 07:22 AM

Quote:

Originally Posted by repo (Post 3644285)
can you post the output from ifconfig if the modem is connected, but pppoe isn't started ?

root@darkstar:/root# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:76:84:6e:c6
inet6 addr: fe80::216:76ff:fe84:6ec6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6466 errors:0 dropped:0 overruns:0 frame:0
TX packets:6431 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3548870 (3.3 MiB) TX bytes:1319848 (1.2 MiB)
Interrupt:23 Base address:0xb800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:786 errors:0 dropped:0 overruns:0 frame:0
TX packets:786 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:88176 (86.1 KiB) TX bytes:88176 (86.1 KiB)

As you can see, if pppoe is not started, it doesn't show up in ifconfig's output, but eth0 is always been showed.

repo 08-15-2009 07:33 AM

You could try to look in
Code:

/var/log/messages
or
Code:

dmesg
to see if you find a line when the modem is switched on, and go from there

kakaburra 08-15-2009 07:44 AM

@repo

Thankyou. The last few lines of /var/log/messages and dmesg do help.

mRgOBLIN 08-15-2009 05:54 PM

The link status from
Code:

ethtool eth0
might be another way for you to check.

kakaburra 08-30-2009 02:28 AM

@ mRgOBLIN

Thankyou, that also works.


All times are GMT -5. The time now is 06:39 AM.