Determine whether the network cable is plugged into the computer

Source: Internet
Author: User

Tool ethtool


If not, sudo apt-Get install ethtool


Run sudo ethtool eth0 on the terminal

Result 1: (when the network cable is inserted)

P {margin-bottom: 0.08in ;}

Supported
Ports: [tp mii]

Supported
Link modes: 10 BaseT/half 10 BaseT/full


100 Baset/half 100 Baset/full


1000 Baset/half 1000 Baset/full

Supports
Auto-negotiation: Yes

Advertised
Link modes: 10 BaseT/half 10 BaseT/full


100 Baset/half 100 Baset/full


1000 Baset/half 1000 Baset/full

Advertised
Pause frame use: No

Advertised
Auto-negotiation: Yes

Link
Partner advertised link modes: 10 BaseT/half 10 BaseT/full


100 Baset/half 100 Baset/full

Link
Partner advertised pause frame use: No

Link
Partner advertised auto-negotiation: Yes

Speed:
100 Mb/s

Duplex:
Full

Port:
MII

Phyad:
0

Transceiver:
Internal

Auto-negotiation:
On

Supports
Wake-on: pumbg

Wake-on:
G

Current
Message Level: Zero X 00000033 (51)

Link
Detected: Yes


Result 2 ):

P {margin-bottom: 0.08in ;}

Supported
Ports: [tp mii]

Supported
Link modes: 10 BaseT/half 10 BaseT/full


100 Baset/half 100 Baset/full


1000 Baset/half 1000 Baset/full

Supports
Auto-negotiation: Yes

Advertised
Link modes: 10 BaseT/half 10 BaseT/full


100 Baset/half 100 Baset/full


1000 Baset/half 1000 Baset/full

Advertised
Pause frame use: No

Advertised
Auto-negotiation: Yes

Link
Partner advertised link modes: not reported

Link
Partner advertised pause frame use: No

Link
Partner advertised auto-negotiation: No

Speed:
10 Mb/s

Duplex:
Half

Port:
MII

Phyad:
0

Transceiver:
Internal

Auto-negotiation:
On

Supports
Wake-on: pumbg

Wake-on:
G

Current
Message Level: Zero X 00000033 (51)

Link
Detected: No


The result of grep "link detected: yes" can be used to determine whether to insert a network cable.



Write the following code in shell:

Ethtool eth0 | grep "link detected: yes"
Check the output of the above command to see if the network cable is connected.
If the output above is empty, the network cable is not connected.
Else network cable connection is normal.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.